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.
 
 
 
 
 
 

145 lines
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,
  42. unsigned int, unsigned int);
  43. unsigned long int const *getBlocks();
  44. private:
  45. cucul_font *font;
  46. };
  47. class Dither
  48. {
  49. public:
  50. Dither(unsigned int, unsigned int, unsigned int, unsigned int,
  51. unsigned int, unsigned int, unsigned int, unsigned int);
  52. ~Dither();
  53. void setPalette(unsigned int r[], unsigned int g[],
  54. unsigned int b[], unsigned int a[]);
  55. void setBrightness(float);
  56. void setGamma(float);
  57. void setContrast(float);
  58. void setInvert(int);
  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 */