You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cucul++.h 4.4 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * libcucul++ C++ bindings for libcucul
  3. * Copyright (c) 2006 Jean-Yves Lamoureux <jylam@lnxscene.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This library is free software. It comes without any warranty, to
  9. * the extent permitted by applicable law. You can redistribute it
  10. * and/or modify it under the terms of the Do What The Fuck You Want
  11. * To Public License, Version 2, as published by Sam Hocevar. See
  12. * http://sam.zoy.org/wtfpl/COPYING for more details.
  13. */
  14. /** \file cucul++.h
  15. * \version \$Id$
  16. * \author Jean-Yves Lamoureux <jylam@lnxscene.org>
  17. * \brief The \e libcucul++ public header.
  18. *
  19. * This header contains the public types and functions that applications
  20. * using \e libcucul++ may use.
  21. */
  22. #ifndef _CUCUL_PP_H
  23. #define _CUCUL_PP_H
  24. #include <cucul.h>
  25. class Cucul;
  26. class Charset
  27. {
  28. unsigned long int utf8ToUtf32(char const *, unsigned int *);
  29. unsigned int utf32ToUtf8(char *, unsigned long int);
  30. unsigned char utf32ToCp437(unsigned long int);
  31. unsigned long int cp437ToUtf32(unsigned char);
  32. };
  33. /* Ugly, I know */
  34. class Font
  35. {
  36. public:
  37. ~Font();
  38. Font(void const *, unsigned int);
  39. char const *const * getList(void);
  40. unsigned int getWidth();
  41. unsigned int getHeight();
  42. void renderCanvas(Cucul *, unsigned char *, unsigned int,
  43. unsigned int, unsigned int);
  44. unsigned long int const *getBlocks();
  45. private:
  46. cucul_font *font;
  47. };
  48. class Dither
  49. {
  50. public:
  51. Dither(unsigned int, unsigned int, unsigned int, unsigned int,
  52. unsigned int, unsigned int, unsigned int, unsigned int);
  53. ~Dither();
  54. void setPalette(unsigned int r[], unsigned int g[],
  55. unsigned int b[], unsigned int a[]);
  56. void setBrightness(float);
  57. void setGamma(float);
  58. void setContrast(float);
  59. void setAntialias(char const *);
  60. char const *const * getAntialiasList();
  61. void setColor(char const *);
  62. char const *const * getColorList();
  63. void setCharset(char const *);
  64. char const *const * getCharsetList();
  65. void setMode(char const *);
  66. char const *const * getModeList();
  67. void Bitmap(Cucul *, int, int, int, int, void *);
  68. private:
  69. cucul_dither *dither;
  70. };
  71. class Cucul
  72. {
  73. friend class Caca;
  74. friend class Dither;
  75. friend class Font;
  76. public:
  77. Cucul();
  78. Cucul(int width, int height);
  79. ~Cucul();
  80. void setSize(unsigned int w, unsigned int h);
  81. unsigned int getWidth(void);
  82. unsigned int getHeight(void);
  83. unsigned long int getAttr(int, int);
  84. int setAttr(unsigned long int);
  85. int setColorANSI(unsigned char f, unsigned char b);
  86. int setColorARGB(unsigned int f, unsigned int b);
  87. void Printf(int x, int y , char const * format, ...);
  88. void putChar(int x, int y, unsigned long int ch);
  89. unsigned long int getChar(int, int);
  90. void putStr(int x, int y, char *str);
  91. void Clear(void);
  92. void Blit(int, int, Cucul* c1, Cucul* c2);
  93. void Invert();
  94. void Flip();
  95. void Flop();
  96. void Rotate();
  97. void drawLine(int, int, int, int, unsigned long int);
  98. void drawPolyline(int const x[], int const y[], int, unsigned long int);
  99. void drawThinLine(int, int, int, int);
  100. void drawThinPolyline(int const x[], int const y[], int);
  101. void drawCircle(int, int, int, unsigned long int);
  102. void drawEllipse(int, int, int, int, unsigned long int);
  103. void drawThinEllipse(int, int, int, int);
  104. void fillEllipse(int, int, int, int, unsigned long int);
  105. void drawBox(int, int, int, int, unsigned long int);
  106. void drawThinBox(int, int, int, int);
  107. void drawCP437Box(int, int, int, int);
  108. void fillBox(int, int, int, int, unsigned long int);
  109. void drawTriangle(int, int, int, int, int, int, unsigned long int);
  110. void drawThinTriangle(int, int, int, int, int, int);
  111. void fillTriangle(int, int, int, int, int, int, unsigned long int);
  112. int Rand(int, int);
  113. int setBoundaries(cucul_canvas_t *, int, int, unsigned int, unsigned int);
  114. unsigned int getFrameCount();
  115. int setFrame(unsigned int);
  116. int createFrame(unsigned int);
  117. int freeFrame(unsigned int);
  118. char const * const * getImportList(void);
  119. long int importMemory(void const *, unsigned long int, char const *);
  120. long int importFile(char const *, char const *);
  121. char const * const * getExportList(void);
  122. void *exportMemory(char const *, unsigned long int *);
  123. protected:
  124. cucul_canvas_t *get_cucul_canvas_t();
  125. private:
  126. cucul_canvas_t *cv;
  127. };
  128. #endif /* _CUCUL_PP_H */