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.
 
 
 
 
 
 

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