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.
 
 
 
 
 
 

136 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. public:
  63. Buffer(Cucul *cv, char const *);
  64. ~Buffer();
  65. char const *const * getExportList(void);
  66. private:
  67. cucul_buffer *buffer;
  68. };
  69. class Cucul
  70. {
  71. friend class Caca;
  72. friend class Dither;
  73. friend class Font;
  74. friend class Buffer;
  75. public:
  76. Cucul();
  77. Cucul(int width, int height);
  78. Cucul(void const *, unsigned int, char const *);
  79. ~Cucul();
  80. void setSize(unsigned int w, unsigned int h);
  81. unsigned int getWidth(void);
  82. unsigned int getHeight(void);
  83. void setColor(unsigned int f, unsigned int b);
  84. char const * getColorName(unsigned int color);
  85. void Printf(int x , int y , char const * format,...);
  86. void putChar(int x, int y, char ch);
  87. void putStr(int x, int y, char *str);
  88. void Clear(void);
  89. void Blit(int, int, Cucul* c1, Cucul* c2);
  90. void Invert();
  91. void Flip();
  92. void Flop();
  93. void Rotate();
  94. void drawLine(int, int, int, int, char const *);
  95. void drawPolyline(int const x[], int const y[], int, char const *);
  96. void drawThinLine(int, int, int, int);
  97. void drawThinPolyline(int const x[], int const y[], int);
  98. void drawCircle(int, int, int, char const *);
  99. void drawEllipse(int, int, int, int, char const *);
  100. void drawThinEllipse(int, int, int, int);
  101. void fillEllipse(int, int, int, int, char const *);
  102. void drawBox(int, int, int, int, char const *);
  103. void drawThinBox(int, int, int, int);
  104. void fillBox(int, int, int, int, char const *);
  105. void drawTriangle(int, int, int, int, int, int, char const *);
  106. void drawThinTriangle(int, int, int, int, int, int);
  107. void fillTriangle(int, int, int, int, int, int, char const *);
  108. int Rand(int, int);
  109. protected:
  110. cucul_canvas_t *get_cucul_canvas_t();
  111. private:
  112. cucul_canvas_t *cv;
  113. };
  114. #endif /* _CUCUL_PP_H */