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.
 
 
 
 
 
 

140 lines
3.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; 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. /* Ugly, I know */
  26. class Font
  27. {
  28. public:
  29. ~Font();
  30. Font(void const *, unsigned int);
  31. char const *const * getList(void);
  32. unsigned int getWidth();
  33. unsigned int getHeight();
  34. void renderCanvas(Cucul *, unsigned char *, unsigned int, unsigned int, unsigned int);
  35. private:
  36. cucul_font *font;
  37. };
  38. class Dither
  39. {
  40. public:
  41. Dither(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
  42. ~Dither();
  43. void setPalette(unsigned int r[], unsigned int g[], unsigned int b[], unsigned int a[]);
  44. void setBrightness(float);
  45. void setGamma(float);
  46. void setContrast(float);
  47. void setInvert(int);
  48. void setAntialias(char const *);
  49. char const *const * getAntialiasList();
  50. void setColor(char const *);
  51. char const *const * getColorList();
  52. void setCharset(char const *);
  53. char const *const * getCharsetList();
  54. void setMode(char const *);
  55. char const *const * getModeList();
  56. void Bitmap(Cucul *, int, int, int, int, void *);
  57. private:
  58. cucul_dither *dither;
  59. };
  60. class Buffer
  61. {
  62. friend class Cucul;
  63. public:
  64. Buffer(Cucul *cv, char const *);
  65. ~Buffer();
  66. char const *const * getExportList(void);
  67. protected:
  68. cucul_buffer *get_buffer();
  69. private:
  70. cucul_buffer *buffer;
  71. };
  72. class Cucul
  73. {
  74. friend class Caca;
  75. friend class Dither;
  76. friend class Font;
  77. friend class Buffer;
  78. public:
  79. Cucul();
  80. Cucul(int width, int height);
  81. Cucul(Buffer *, char const *);
  82. ~Cucul();
  83. void setSize(unsigned int w, unsigned int h);
  84. unsigned int getWidth(void);
  85. unsigned int getHeight(void);
  86. void setColor(unsigned int f, unsigned int b);
  87. char const * getColorName(unsigned int color);
  88. void Printf(int x , int y , char const * format,...);
  89. void putChar(int x, int y, char ch);
  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, char const *);
  98. void drawPolyline(int const x[], int const y[], int, char const *);
  99. void drawThinLine(int, int, int, int);
  100. void drawThinPolyline(int const x[], int const y[], int);
  101. void drawCircle(int, int, int, char const *);
  102. void drawEllipse(int, int, int, int, char const *);
  103. void drawThinEllipse(int, int, int, int);
  104. void fillEllipse(int, int, int, int, char const *);
  105. void drawBox(int, int, int, int, char const *);
  106. void drawThinBox(int, int, int, int);
  107. void fillBox(int, int, int, int, char const *);
  108. void drawTriangle(int, int, int, int, int, int, char const *);
  109. void drawThinTriangle(int, int, int, int, int, int);
  110. void fillTriangle(int, int, int, int, int, int, char const *);
  111. int Rand(int, int);
  112. protected:
  113. cucul_canvas_t *get_cucul_canvas_t();
  114. private:
  115. cucul_canvas_t *cv;
  116. };
  117. #endif /* _CUCUL_PP_H */