155 行
4.6 KiB

  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. #if !defined(_DOXYGEN_SKIP_ME)
  26. # undef __class
  27. # if defined(_WIN32) && defined(__LIBCUCUL_PP__)
  28. # define __class class __declspec(dllexport)
  29. # else
  30. # define __class class
  31. # endif
  32. #endif
  33. class Cucul;
  34. __class Charset
  35. {
  36. public:
  37. unsigned long int utf8ToUtf32(char const *, unsigned int *);
  38. unsigned int utf32ToUtf8(char *, unsigned long int);
  39. unsigned char utf32ToCp437(unsigned long int);
  40. unsigned long int cp437ToUtf32(unsigned char);
  41. };
  42. /* Ugly, I know */
  43. __class Font
  44. {
  45. public:
  46. ~Font();
  47. Font(void const *, unsigned int);
  48. char const *const * getList(void);
  49. unsigned int getWidth();
  50. unsigned int getHeight();
  51. void renderCanvas(Cucul *, unsigned char *, unsigned int,
  52. unsigned int, unsigned int);
  53. unsigned long int const *getBlocks();
  54. private:
  55. cucul_font *font;
  56. };
  57. __class Dither
  58. {
  59. public:
  60. Dither(unsigned int, unsigned int, unsigned int, unsigned int,
  61. unsigned int, unsigned int, unsigned int, unsigned int);
  62. ~Dither();
  63. void setPalette(unsigned int r[], unsigned int g[],
  64. unsigned int b[], unsigned int a[]);
  65. void setBrightness(float);
  66. void setGamma(float);
  67. void setContrast(float);
  68. void setAntialias(char const *);
  69. char const *const * getAntialiasList();
  70. void setColor(char const *);
  71. char const *const * getColorList();
  72. void setCharset(char const *);
  73. char const *const * getCharsetList();
  74. void setMode(char const *);
  75. char const *const * getModeList();
  76. void Bitmap(Cucul *, int, int, int, int, void *);
  77. private:
  78. cucul_dither *dither;
  79. };
  80. __class Cucul
  81. {
  82. friend class Caca;
  83. friend class Dither;
  84. friend class Font;
  85. public:
  86. Cucul();
  87. Cucul(int width, int height);
  88. ~Cucul();
  89. void setSize(unsigned int w, unsigned int h);
  90. unsigned int getWidth(void);
  91. unsigned int getHeight(void);
  92. unsigned long int getAttr(int, int);
  93. int setAttr(unsigned long int);
  94. int setColorANSI(unsigned char f, unsigned char b);
  95. int setColorARGB(unsigned int f, unsigned int b);
  96. void Printf(int x, int y , char const * format, ...);
  97. void putChar(int x, int y, unsigned long int ch);
  98. unsigned long int getChar(int, int);
  99. void putStr(int x, int y, char *str);
  100. void Clear(void);
  101. void Blit(int, int, Cucul* c1, Cucul* c2);
  102. void Invert();
  103. void Flip();
  104. void Flop();
  105. void Rotate();
  106. void drawLine(int, int, int, int, unsigned long int);
  107. void drawPolyline(int const x[], int const y[], int, unsigned long int);
  108. void drawThinLine(int, int, int, int);
  109. void drawThinPolyline(int const x[], int const y[], int);
  110. void drawCircle(int, int, int, unsigned long int);
  111. void drawEllipse(int, int, int, int, unsigned long int);
  112. void drawThinEllipse(int, int, int, int);
  113. void fillEllipse(int, int, int, int, unsigned long int);
  114. void drawBox(int, int, int, int, unsigned long int);
  115. void drawThinBox(int, int, int, int);
  116. void drawCP437Box(int, int, int, int);
  117. void fillBox(int, int, int, int, unsigned long int);
  118. void drawTriangle(int, int, int, int, int, int, unsigned long int);
  119. void drawThinTriangle(int, int, int, int, int, int);
  120. void fillTriangle(int, int, int, int, int, int, unsigned long int);
  121. int Rand(int, int);
  122. int setBoundaries(cucul_canvas_t *, int, int, unsigned int, unsigned int);
  123. unsigned int getFrameCount();
  124. int setFrame(unsigned int);
  125. int createFrame(unsigned int);
  126. int freeFrame(unsigned int);
  127. char const * const * getImportList(void);
  128. long int importMemory(void const *, unsigned long int, char const *);
  129. long int importFile(char const *, char const *);
  130. char const * const * getExportList(void);
  131. void *exportMemory(char const *, unsigned long int *);
  132. protected:
  133. cucul_canvas_t *get_cucul_canvas_t();
  134. private:
  135. cucul_canvas_t *cv;
  136. };
  137. #endif /* _CUCUL_PP_H */