Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

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