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.
 
 
 
 
 
 

161 lines
4.9 KiB

  1. /*
  2. * PypyCaca libcaca Python bindings
  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. #include <Python.h>
  14. #include <caca.h>
  15. #define SET_INTCONSTANT(dict, value) \
  16. PyDict_SetItemString(dict, #value, PyInt_FromLong((long) value))
  17. PyMODINIT_FUNC initcaca(void);
  18. /* Basic functions */
  19. static PyObject *
  20. pycaca_init(PyObject *self, PyObject *args);
  21. static PyObject *
  22. pycaca_set_delay(PyObject *self, PyObject *args);
  23. static PyObject *
  24. pycaca_get_rendertime(PyObject *self, PyObject *args);
  25. static PyObject *
  26. pycaca_get_width(PyObject *self, PyObject *args);
  27. static PyObject *
  28. pycaca_get_height(PyObject *self, PyObject *args);
  29. static PyObject *
  30. pycaca_set_size(PyObject *self, PyObject *args);
  31. static PyObject *
  32. pycaca_set_width(PyObject *self, PyObject *args);
  33. static PyObject *
  34. pycaca_set_height(PyObject *self, PyObject *args);
  35. static PyObject *
  36. pycaca_set_window_title(PyObject *self, PyObject *args);
  37. static PyObject *
  38. pycaca_get_window_width(PyObject *self, PyObject *args);
  39. static PyObject *
  40. pycaca_get_window_height(PyObject *self, PyObject *args);
  41. static PyObject *
  42. pycaca_refresh(PyObject *self, PyObject *args);
  43. static PyObject *
  44. pycaca_end(PyObject *self, PyObject *args);
  45. static PyObject *
  46. pycaca_get_feature(PyObject *self, PyObject *args);
  47. static PyObject *
  48. pycaca_set_feature(PyObject *self, PyObject *args);
  49. static PyObject *
  50. pycaca_get_feature_name(PyObject *self, PyObject *args);
  51. /* Event handling */
  52. static PyObject *
  53. pycaca_get_event(PyObject *self, PyObject *args);
  54. static PyObject *
  55. pycaca_wait_event(PyObject *self, PyObject *args);
  56. static PyObject *
  57. pycaca_get_mouse_x(PyObject *self, PyObject *args);
  58. static PyObject *
  59. pycaca_get_mouse_y(PyObject *self, PyObject *args);
  60. /* Primitives drawing */
  61. static PyObject *
  62. pycaca_draw_line(PyObject *self, PyObject *args);
  63. static PyObject *
  64. pycaca_draw_polyline(PyObject *self, PyObject *args);
  65. static PyObject *
  66. pycaca_draw_thin_polyline(PyObject *self, PyObject *args);
  67. static PyObject *
  68. pycaca_draw_thin_line(PyObject *self, PyObject *args);
  69. static PyObject *
  70. pycaca_draw_circle(PyObject *self, PyObject *args);
  71. static PyObject *
  72. pycaca_draw_ellipse(PyObject *self, PyObject *args);
  73. static PyObject *
  74. pycaca_draw_thin_ellipse(PyObject *self, PyObject *args);
  75. static PyObject *
  76. pycaca_fill_ellipse(PyObject *self, PyObject *args);
  77. static PyObject *
  78. pycaca_draw_box(PyObject *self, PyObject *args);
  79. static PyObject *
  80. pycaca_fill_box(PyObject *self, PyObject *args);
  81. static PyObject *
  82. pycaca_draw_thin_box(PyObject *self, PyObject *args);
  83. static PyObject *
  84. pycaca_draw_triangle(PyObject *self, PyObject *args);
  85. static PyObject *
  86. pycaca_draw_thin_triangle(PyObject *self, PyObject *args);
  87. static PyObject *
  88. pycaca_fill_triangle(PyObject *self, PyObject *args);
  89. /* Charactere drawing */
  90. static PyObject *
  91. pycaca_set_color(PyObject *self, PyObject *args);
  92. static PyObject *
  93. pycaca_get_fg_color(PyObject *self, PyObject *args);
  94. static PyObject *
  95. pycaca_get_bg_color(PyObject *self, PyObject *args);
  96. static PyObject *
  97. pycaca_get_color_name(PyObject *self, PyObject *args);
  98. static PyObject *
  99. pycaca_putchar(PyObject *self, PyObject *args);
  100. static PyObject *
  101. pycaca_putstr(PyObject *self, PyObject *args);
  102. static PyObject *
  103. pycaca_printf(PyObject *self, PyObject *args);
  104. /*static PyObject *
  105. pycaca_get_screen(PyObject *self, PyObject *args);*/
  106. static PyObject *
  107. pycaca_clear(PyObject *self, PyObject *args);
  108. /* Sprites functions */
  109. static PyObject *
  110. pycaca_load_sprite(PyObject *self, PyObject *args);
  111. static PyObject *
  112. pycaca_draw_sprite(PyObject *self, PyObject *args);
  113. static PyObject *
  114. pycaca_get_sprite_frames(PyObject *self, PyObject *args);
  115. static PyObject *
  116. pycaca_get_sprite_width(PyObject *self, PyObject *args);
  117. static PyObject *
  118. pycaca_get_sprite_height(PyObject *self, PyObject *args);
  119. static PyObject *
  120. pycaca_get_sprite_dx(PyObject *self, PyObject *args);
  121. static PyObject *
  122. pycaca_get_sprite_dy(PyObject *self, PyObject *args);
  123. static PyObject *
  124. pycaca_free_sprite(PyObject *self, PyObject *args);
  125. /* Exporters */
  126. static PyObject *
  127. pycaca_get_html(PyObject *self, PyObject *args);
  128. static PyObject *
  129. pycaca_get_html3(PyObject *self, PyObject *args);
  130. static PyObject *
  131. pycaca_get_irc(PyObject *self, PyObject *args);
  132. static PyObject *
  133. pycaca_get_ansi(PyObject *self, PyObject *args);
  134. /* Bitmap functions */
  135. static PyObject *
  136. pycaca_create_bitmap(PyObject *self, PyObject *args);
  137. static PyObject *
  138. pycaca_set_bitmap_palette(PyObject *self, PyObject *args);
  139. static PyObject *
  140. pycaca_set_bitmap_gamma(PyObject *self, PyObject *args);
  141. static PyObject *
  142. pycaca_draw_bitmap(PyObject *self, PyObject *args);
  143. static PyObject *
  144. pycaca_free_bitmap(PyObject *self, PyObject *args);