ruby-iup 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. data/Rakefile +1 -1
  2. data/examples/ctrl/degrade.rb +5 -2
  3. data/examples/ctrl/iupgauge.rb +5 -5
  4. data/examples/ctrl/iupplot2.rb +2 -5
  5. data/examples/dlg/iupalarm.rb +3 -1
  6. data/examples/elem/iupbutton.rb +42 -59
  7. data/examples/elem/iupcanvas.rb +4 -2
  8. data/examples/elem/iupcanvas2.rb +9 -8
  9. data/examples/elem/iupcanvas3.rb +19 -29
  10. data/examples/elem/iupdialog.rb +3 -7
  11. data/examples/elem/progressbar.rb +104 -118
  12. data/ext/iup-linux/include/cd.h +494 -494
  13. data/ext/iup-linux/include/cd_canvas.hpp +358 -358
  14. data/ext/iup-linux/include/cd_old.h +158 -158
  15. data/ext/iup-linux/include/cd_private.h +362 -362
  16. data/ext/iup-linux/include/cdcgm.h +34 -34
  17. data/ext/iup-linux/include/cdclipbd.h +22 -22
  18. data/ext/iup-linux/include/cddbuf.h +23 -23
  19. data/ext/iup-linux/include/cddebug.h +24 -24
  20. data/ext/iup-linux/include/cddgn.h +23 -23
  21. data/ext/iup-linux/include/cddxf.h +22 -22
  22. data/ext/iup-linux/include/cdemf.h +22 -22
  23. data/ext/iup-linux/include/cdgdiplus.h +29 -29
  24. data/ext/iup-linux/include/cdimage.h +23 -23
  25. data/ext/iup-linux/include/cdirgb.h +30 -30
  26. data/ext/iup-linux/include/cdiup.h +22 -22
  27. data/ext/iup-linux/include/cdlua.h +39 -39
  28. data/ext/iup-linux/include/cdlua3_private.h +120 -120
  29. data/ext/iup-linux/include/cdlua5_private.h +141 -141
  30. data/ext/iup-linux/include/cdluaim.h +24 -24
  31. data/ext/iup-linux/include/cdluaiup.h +27 -27
  32. data/ext/iup-linux/include/cdluapdf.h +27 -27
  33. data/ext/iup-linux/include/cdmf.h +24 -24
  34. data/ext/iup-linux/include/cdmf_private.h +32 -32
  35. data/ext/iup-linux/include/cdnative.h +26 -26
  36. data/ext/iup-linux/include/cdpdf.h +38 -38
  37. data/ext/iup-linux/include/cdpicture.h +22 -22
  38. data/ext/iup-linux/include/cdprint.h +23 -23
  39. data/ext/iup-linux/include/cdps.h +37 -37
  40. data/ext/iup-linux/include/cdwmf.h +22 -22
  41. data/ext/iup-linux/include/iup.h +318 -255
  42. data/ext/iup-linux/include/iup_pplot.h +40 -40
  43. data/ext/iup-linux/include/iupcb.h +25 -25
  44. data/ext/iup-linux/include/iupcbs.h +43 -42
  45. data/ext/iup-linux/include/iupcells.h +130 -130
  46. data/ext/iup-linux/include/iupcolorbar.h +126 -126
  47. data/ext/iup-linux/include/iupcontrols.h +36 -40
  48. data/ext/iup-linux/include/iupdef.h +520 -520
  49. data/ext/iup-linux/include/iupdial.h +63 -64
  50. data/ext/iup-linux/include/iupgauge.h +57 -57
  51. data/ext/iup-linux/include/iupgetparam.h +1 -1
  52. data/ext/iup-linux/include/iupgl.h +101 -101
  53. data/ext/iup-linux/include/iupim.h +21 -21
  54. data/ext/iup-linux/include/iupkey.h +457 -290
  55. data/ext/iup-linux/include/iuplua.h +41 -41
  56. data/ext/iup-linux/include/iuplua_pplot.h +26 -26
  57. data/ext/iup-linux/include/iupluacontrols.h +27 -27
  58. data/ext/iup-linux/include/iupluagl.h +26 -26
  59. data/ext/iup-linux/include/iupluaim.h +26 -26
  60. data/ext/iup-linux/include/iupluaole.h +26 -26
  61. data/ext/iup-linux/include/iupmask.h +40 -52
  62. data/ext/iup-linux/include/iupmatrix.h +63 -69
  63. data/ext/iup-linux/include/iupole.h +24 -24
  64. data/ext/iup-linux/include/iupspin.h +21 -21
  65. data/ext/iup-linux/include/iuptabs.h +75 -79
  66. data/ext/iup-linux/include/iuptree.h +93 -93
  67. data/ext/iup-linux/include/iupval.h +46 -46
  68. data/ext/iup-linux/include/wd.h +78 -78
  69. data/ext/iup-linux/include/wd_old.h +85 -85
  70. data/ext/iup-linux/libcd.so +0 -0
  71. data/ext/iup-linux/libcdcontextplus.so +0 -0
  72. data/ext/iup-linux/libcdpdf.so +0 -0
  73. data/ext/iup-linux/libim.so +0 -0
  74. data/ext/iup-linux/libim_fftw.so +0 -0
  75. data/ext/iup-linux/libim_jp2.so +0 -0
  76. data/ext/iup-linux/libim_process.so +0 -0
  77. data/ext/iup-linux/libiup.so +0 -0
  78. data/ext/iup-linux/libiup_pplot.so +0 -0
  79. data/ext/iup-linux/libiupcontrols.so +0 -0
  80. data/ext/iup-linux/libiupgl.so +0 -0
  81. data/ext/iup-linux/libiupim.so +0 -0
  82. data/ext/iup-linux/libiupimglib.so +0 -0
  83. data/ext/iup-linux/libiupmot.so +0 -0
  84. data/ext/iup-win32/cd.dll +0 -0
  85. data/ext/iup-win32/cd.lib +0 -0
  86. data/ext/iup-win32/cdcontextplus.dll +0 -0
  87. data/ext/iup-win32/cdcontextplus.lib +0 -0
  88. data/ext/iup-win32/cdpdf.dll +0 -0
  89. data/ext/iup-win32/cdpdf.lib +0 -0
  90. data/ext/iup-win32/freetype6.dll +0 -0
  91. data/ext/iup-win32/freetype6.lib +0 -0
  92. data/ext/iup-win32/im.dll +0 -0
  93. data/ext/iup-win32/im.lib +0 -0
  94. data/ext/iup-win32/im_avi.dll +0 -0
  95. data/ext/iup-win32/im_avi.lib +0 -0
  96. data/ext/iup-win32/im_capture.dll +0 -0
  97. data/ext/iup-win32/im_capture.lib +0 -0
  98. data/ext/iup-win32/im_fftw.dll +0 -0
  99. data/ext/iup-win32/im_fftw.lib +0 -0
  100. data/ext/iup-win32/im_jp2.dll +0 -0
  101. data/ext/iup-win32/im_jp2.lib +0 -0
  102. data/ext/iup-win32/im_process.dll +0 -0
  103. data/ext/iup-win32/im_process.lib +0 -0
  104. data/ext/iup-win32/im_wmv.dll +0 -0
  105. data/ext/iup-win32/im_wmv.lib +0 -0
  106. data/ext/iup-win32/imlua_capture51.dll +0 -0
  107. data/ext/iup-win32/imlua_capture51.lib +0 -0
  108. data/ext/iup-win32/imlua_wmv51.dll +0 -0
  109. data/ext/iup-win32/imlua_wmv51.lib +0 -0
  110. data/ext/iup-win32/include/cd.h +494 -494
  111. data/ext/iup-win32/include/cd_canvas.hpp +358 -358
  112. data/ext/iup-win32/include/cd_old.h +158 -158
  113. data/ext/iup-win32/include/cd_private.h +362 -362
  114. data/ext/iup-win32/include/cdcgm.h +34 -34
  115. data/ext/iup-win32/include/cdclipbd.h +22 -22
  116. data/ext/iup-win32/include/cddbuf.h +23 -23
  117. data/ext/iup-win32/include/cddebug.h +24 -24
  118. data/ext/iup-win32/include/cddgn.h +23 -23
  119. data/ext/iup-win32/include/cddxf.h +22 -22
  120. data/ext/iup-win32/include/cdemf.h +22 -22
  121. data/ext/iup-win32/include/cdgdiplus.h +29 -29
  122. data/ext/iup-win32/include/cdimage.h +23 -23
  123. data/ext/iup-win32/include/cdirgb.h +30 -30
  124. data/ext/iup-win32/include/cdiup.h +22 -22
  125. data/ext/iup-win32/include/cdlua.h +39 -39
  126. data/ext/iup-win32/include/cdlua3_private.h +120 -120
  127. data/ext/iup-win32/include/cdlua5_private.h +141 -141
  128. data/ext/iup-win32/include/cdluaim.h +24 -24
  129. data/ext/iup-win32/include/cdluaiup.h +27 -27
  130. data/ext/iup-win32/include/cdluapdf.h +27 -27
  131. data/ext/iup-win32/include/cdmf.h +24 -24
  132. data/ext/iup-win32/include/cdmf_private.h +32 -32
  133. data/ext/iup-win32/include/cdnative.h +26 -26
  134. data/ext/iup-win32/include/cdpdf.h +38 -38
  135. data/ext/iup-win32/include/cdpicture.h +22 -22
  136. data/ext/iup-win32/include/cdprint.h +23 -23
  137. data/ext/iup-win32/include/cdps.h +37 -37
  138. data/ext/iup-win32/include/cdwmf.h +22 -22
  139. data/ext/iup-win32/include/iup.h +318 -255
  140. data/ext/iup-win32/include/iup_pplot.h +40 -40
  141. data/ext/iup-win32/include/iupcb.h +25 -25
  142. data/ext/iup-win32/include/iupcbs.h +43 -42
  143. data/ext/iup-win32/include/iupcells.h +130 -130
  144. data/ext/iup-win32/include/iupcolorbar.h +126 -126
  145. data/ext/iup-win32/include/iupcontrols.h +36 -40
  146. data/ext/iup-win32/include/iupdef.h +520 -520
  147. data/ext/iup-win32/include/iupdial.h +63 -64
  148. data/ext/iup-win32/include/iupgauge.h +57 -57
  149. data/ext/iup-win32/include/iupgetparam.h +1 -1
  150. data/ext/iup-win32/include/iupgl.h +101 -101
  151. data/ext/iup-win32/include/iupim.h +21 -21
  152. data/ext/iup-win32/include/iupkey.h +457 -290
  153. data/ext/iup-win32/include/iuplua.h +41 -41
  154. data/ext/iup-win32/include/iuplua_pplot.h +26 -26
  155. data/ext/iup-win32/include/iupluacontrols.h +27 -27
  156. data/ext/iup-win32/include/iupluagl.h +26 -26
  157. data/ext/iup-win32/include/iupluaim.h +26 -26
  158. data/ext/iup-win32/include/iupluaole.h +26 -26
  159. data/ext/iup-win32/include/iupmask.h +40 -52
  160. data/ext/iup-win32/include/iupmatrix.h +63 -69
  161. data/ext/iup-win32/include/iupole.h +24 -24
  162. data/ext/iup-win32/include/iupspin.h +21 -21
  163. data/ext/iup-win32/include/iuptabs.h +75 -79
  164. data/ext/iup-win32/include/iuptree.h +93 -93
  165. data/ext/iup-win32/include/iupval.h +46 -46
  166. data/ext/iup-win32/include/wd.h +78 -78
  167. data/ext/iup-win32/include/wd_old.h +85 -85
  168. data/ext/iup-win32/iup.dll +0 -0
  169. data/ext/iup-win32/iup.lib +0 -0
  170. data/ext/iup-win32/iup_pplot.dll +0 -0
  171. data/ext/iup-win32/iup_pplot.lib +0 -0
  172. data/ext/iup-win32/iupcd.dll +0 -0
  173. data/ext/iup-win32/iupcd.lib +0 -0
  174. data/ext/iup-win32/iupcontrols.dll +0 -0
  175. data/ext/iup-win32/iupcontrols.lib +0 -0
  176. data/ext/iup-win32/iupgl.dll +0 -0
  177. data/ext/iup-win32/iupgl.lib +0 -0
  178. data/ext/iup-win32/iupgtk.dll +0 -0
  179. data/ext/iup-win32/iupgtk.lib +0 -0
  180. data/ext/iup-win32/iupim.dll +0 -0
  181. data/ext/iup-win32/iupim.lib +0 -0
  182. data/ext/iup-win32/iupimglib.dll +0 -0
  183. data/ext/iup-win32/iupimglib.lib +0 -0
  184. data/ext/iup-win32/iupole.dll +0 -0
  185. data/ext/iup-win32/iupole.lib +0 -0
  186. data/ext/iup-win32/iupstub.lib +0 -0
  187. data/ext/iup-win32/pdflib.dll +0 -0
  188. data/ext/iup-win32/pdflib.lib +0 -0
  189. data/ext/iup.c +3 -351
  190. data/ext/rb_iup.h +48 -15
  191. data/ext/rb_iupcb.h +1 -0
  192. data/ext/rb_iupcells.h +1 -0
  193. data/ext/rb_iupcolorbar.h +1 -4
  194. data/ext/rb_iupcontrols.h +0 -5
  195. data/ext/rb_iupdial.h +1 -0
  196. data/ext/rb_iupgauge.h +1 -0
  197. data/ext/rb_iupgc.h +0 -1
  198. data/ext/rb_iupmatrix.h +1 -0
  199. data/ext/rb_iupsbox.h +0 -1
  200. data/ext/rb_iuptabs.h +1 -0
  201. data/ext/rb_iuptree.h +1 -0
  202. data/ext/rb_iupval.h +1 -0
  203. metadata +16 -29
  204. data/ext/iup-linux/include/iupcbox.h +0 -23
  205. data/ext/iup-linux/include/iupcompat.h +0 -62
  206. data/ext/iup-linux/include/iupcpi.h +0 -76
  207. data/ext/iup-linux/include/iupgc.h +0 -20
  208. data/ext/iup-linux/include/iupsbox.h +0 -20
  209. data/ext/iup-linux/include/iupspeech.h +0 -23
  210. data/ext/iup-linux/libcdluacontextplus51.so +0 -0
  211. data/ext/iup-win32/cdlua51.lib +0 -0
  212. data/ext/iup-win32/cdluacontextplus51.lib +0 -0
  213. data/ext/iup-win32/cdluaim51.lib +0 -0
  214. data/ext/iup-win32/cdluapdf51.lib +0 -0
  215. data/ext/iup-win32/include/iupcbox.h +0 -23
  216. data/ext/iup-win32/include/iupcompat.h +0 -62
  217. data/ext/iup-win32/include/iupcpi.h +0 -76
  218. data/ext/iup-win32/include/iupgc.h +0 -20
  219. data/ext/iup-win32/include/iupsbox.h +0 -20
  220. data/ext/iup-win32/include/iupspeech.h +0 -23
  221. data/ext/iup-win32/iuplua51.lib +0 -0
  222. data/ext/iup-win32/iuplua_pplot51.lib +0 -0
  223. data/ext/iup-win32/iupluacd51.lib +0 -0
  224. data/ext/iup-win32/iupluacontrols51.lib +0 -0
  225. data/ext/iup-win32/iupluagl51.lib +0 -0
  226. data/ext/iup-win32/iupluaim51.lib +0 -0
  227. data/ext/iup-win32/iupluaimglib51.lib +0 -0
  228. data/ext/iup-win32/iupluaole51.lib +0 -0
  229. data/ext/rb_iupcbox.h +0 -40
  230. data/ext/rb_iupspeech.h +0 -25
@@ -1,78 +1,78 @@
1
- /** \file
2
- * \brief World Coordinate Functions
3
- *
4
- * See Copyright Notice in cd.h
5
- */
6
-
7
- #ifndef __WD_H
8
- #define __WD_H
9
-
10
- #ifdef __cplusplus
11
- extern "C" {
12
- #endif
13
-
14
- /* coordinate transformation */
15
- void wdCanvasWindow(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
16
- void wdCanvasGetWindow(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
17
- void wdCanvasViewport(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
18
- void wdCanvasGetViewport(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
19
- void wdCanvasWorld2Canvas(cdCanvas* canvas, double xw, double yw, int *xv, int *yv);
20
- void wdCanvasWorld2CanvasSize(cdCanvas* canvas, double hw, double vw, int *hv, int *vv);
21
- void wdCanvasCanvas2World(cdCanvas* canvas, int xv, int yv, double *xw, double *yw);
22
-
23
- void wdCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
24
- int wdCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
25
- int wdCanvasIsPointInRegion(cdCanvas* canvas, double x, double y);
26
- void wdCanvasOffsetRegion(cdCanvas* canvas, double x, double y);
27
- void wdCanvasGetRegionBox(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
28
-
29
- void wdCanvasHardcopy(cdCanvas* canvas, cdContext* ctx, void *data, void(*draw_func)(cdCanvas *canvas_copy));
30
-
31
- /* primitives */
32
- void wdCanvasPixel(cdCanvas* canvas, double x, double y, long color);
33
- void wdCanvasMark(cdCanvas* canvas, double x, double y);
34
- void wdCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2);
35
- void wdCanvasVertex(cdCanvas* canvas, double x, double y);
36
- void wdCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
37
- void wdCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
38
- void wdCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
39
- void wdCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
40
- void wdCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
41
- void wdCanvasText(cdCanvas* canvas, double x, double y, const char* s);
42
-
43
- void wdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax);
44
- void wdCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
45
- void wdCanvasPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
46
- void wdCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
47
- void wdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, double x, double y, double w, double h);
48
-
49
- /* attributes */
50
- double wdCanvasLineWidth(cdCanvas* canvas, double width);
51
- int wdCanvasFont(cdCanvas* canvas, const char* type_face, int style, double size);
52
- void wdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, double *size);
53
- double wdCanvasMarkSize(cdCanvas* canvas, double size);
54
- void wdCanvasGetFontDim(cdCanvas* canvas, double *max_width, double *height, double *ascent, double *descent);
55
- void wdCanvasGetTextSize(cdCanvas* canvas, const char* s, double *width, double *height);
56
- void wdCanvasGetTextBox(cdCanvas* canvas, double x, double y, const char* s, double *xmin, double *xmax, double *ymin, double *ymax);
57
- void wdCanvasGetTextBounds(cdCanvas* canvas, double x, double y, const char* s, double *rect);
58
- void wdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char*fgbg, double w_mm, double h_mm);
59
- void wdCanvasPattern(cdCanvas* canvas, int w, int h, const long *color, double w_mm, double h_mm);
60
-
61
- /* vector text */
62
- void wdCanvasVectorTextDirection(cdCanvas* canvas, double x1, double y1, double x2, double y2);
63
- void wdCanvasVectorTextSize(cdCanvas* canvas, double size_x, double size_y, const char* s);
64
- void wdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, double *x, double *y);
65
- double wdCanvasVectorCharSize(cdCanvas* canvas, double size);
66
- void wdCanvasVectorText(cdCanvas* canvas, double x, double y, const char* s);
67
- void wdCanvasMultiLineVectorText(cdCanvas* canvas, double x, double y, const char* s);
68
- void wdCanvasGetVectorTextBounds(cdCanvas* canvas, const char* s, double x, double y, double *rect);
69
-
70
- #ifdef __cplusplus
71
- }
72
- #endif
73
-
74
- #ifndef CD_NO_OLD_INTERFACE
75
- #include "wd_old.h"
76
- #endif
77
-
78
- #endif
1
+ /** \file
2
+ * \brief World Coordinate Functions
3
+ *
4
+ * See Copyright Notice in cd.h
5
+ */
6
+
7
+ #ifndef __WD_H
8
+ #define __WD_H
9
+
10
+ #ifdef __cplusplus
11
+ extern "C" {
12
+ #endif
13
+
14
+ /* coordinate transformation */
15
+ void wdCanvasWindow(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
16
+ void wdCanvasGetWindow(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
17
+ void wdCanvasViewport(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
18
+ void wdCanvasGetViewport(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
19
+ void wdCanvasWorld2Canvas(cdCanvas* canvas, double xw, double yw, int *xv, int *yv);
20
+ void wdCanvasWorld2CanvasSize(cdCanvas* canvas, double hw, double vw, int *hv, int *vv);
21
+ void wdCanvasCanvas2World(cdCanvas* canvas, int xv, int yv, double *xw, double *yw);
22
+
23
+ void wdCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
24
+ int wdCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
25
+ int wdCanvasIsPointInRegion(cdCanvas* canvas, double x, double y);
26
+ void wdCanvasOffsetRegion(cdCanvas* canvas, double x, double y);
27
+ void wdCanvasGetRegionBox(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
28
+
29
+ void wdCanvasHardcopy(cdCanvas* canvas, cdContext* ctx, void *data, void(*draw_func)(cdCanvas *canvas_copy));
30
+
31
+ /* primitives */
32
+ void wdCanvasPixel(cdCanvas* canvas, double x, double y, long color);
33
+ void wdCanvasMark(cdCanvas* canvas, double x, double y);
34
+ void wdCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2);
35
+ void wdCanvasVertex(cdCanvas* canvas, double x, double y);
36
+ void wdCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
37
+ void wdCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
38
+ void wdCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
39
+ void wdCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
40
+ void wdCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
41
+ void wdCanvasText(cdCanvas* canvas, double x, double y, const char* s);
42
+
43
+ void wdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax);
44
+ void wdCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
45
+ void wdCanvasPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
46
+ void wdCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
47
+ void wdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, double x, double y, double w, double h);
48
+
49
+ /* attributes */
50
+ double wdCanvasLineWidth(cdCanvas* canvas, double width);
51
+ int wdCanvasFont(cdCanvas* canvas, const char* type_face, int style, double size);
52
+ void wdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, double *size);
53
+ double wdCanvasMarkSize(cdCanvas* canvas, double size);
54
+ void wdCanvasGetFontDim(cdCanvas* canvas, double *max_width, double *height, double *ascent, double *descent);
55
+ void wdCanvasGetTextSize(cdCanvas* canvas, const char* s, double *width, double *height);
56
+ void wdCanvasGetTextBox(cdCanvas* canvas, double x, double y, const char* s, double *xmin, double *xmax, double *ymin, double *ymax);
57
+ void wdCanvasGetTextBounds(cdCanvas* canvas, double x, double y, const char* s, double *rect);
58
+ void wdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char*fgbg, double w_mm, double h_mm);
59
+ void wdCanvasPattern(cdCanvas* canvas, int w, int h, const long *color, double w_mm, double h_mm);
60
+
61
+ /* vector text */
62
+ void wdCanvasVectorTextDirection(cdCanvas* canvas, double x1, double y1, double x2, double y2);
63
+ void wdCanvasVectorTextSize(cdCanvas* canvas, double size_x, double size_y, const char* s);
64
+ void wdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, double *x, double *y);
65
+ double wdCanvasVectorCharSize(cdCanvas* canvas, double size);
66
+ void wdCanvasVectorText(cdCanvas* canvas, double x, double y, const char* s);
67
+ void wdCanvasMultiLineVectorText(cdCanvas* canvas, double x, double y, const char* s);
68
+ void wdCanvasGetVectorTextBounds(cdCanvas* canvas, const char* s, double x, double y, double *rect);
69
+
70
+ #ifdef __cplusplus
71
+ }
72
+ #endif
73
+
74
+ #ifndef CD_NO_OLD_INTERFACE
75
+ #include "wd_old.h"
76
+ #endif
77
+
78
+ #endif
@@ -1,85 +1,85 @@
1
- /** \file
2
- * \brief Old WC API
3
- *
4
- * See Copyright Notice in cd.h
5
- */
6
-
7
- #ifndef WD_OLD_H
8
- #define WD_OLD_H
9
-
10
- #ifdef __cplusplus
11
- extern "C" {
12
- #endif
13
-
14
- /* coordinate transformation */
15
- void wdWindow(double xmin, double xmax, double ymin, double ymax);
16
- void wdGetWindow(double *xmin, double *xmax, double *ymin, double *ymax);
17
- void wdViewport(int xmin, int xmax, int ymin, int ymax);
18
- void wdGetViewport(int *xmin, int *xmax, int *ymin, int *ymax);
19
- void wdWorld2Canvas(double xw, double yw, int *xv, int *yv);
20
- void wdWorld2CanvasSize(double hw, double vw, int *hv, int *vv);
21
- void wdCanvas2World(int xv, int yv, double *xw, double *yw);
22
-
23
- void wdClipArea(double xmin, double xmax, double ymin, double ymax);
24
- int wdGetClipArea(double *xmin, double *xmax, double *ymin, double *ymax);
25
- double* wdGetClipPoly(int *n);
26
- int wdPointInRegion(double x, double y);
27
- void wdOffsetRegion(double x, double y);
28
- void wdRegionBox(double *xmin, double *xmax, double *ymin, double *ymax);
29
-
30
- void wdHardcopy(cdContext* ctx, void *data, cdCanvas *cnv, void(*draw_func)(void));
31
-
32
- /* primitives */
33
- void wdPixel(double x, double y, long color);
34
- void wdMark(double x, double y);
35
- void wdLine(double x1, double y1, double x2, double y2);
36
- void wdVertex(double x, double y);
37
- void wdRect(double xmin, double xmax, double ymin, double ymax);
38
- void wdBox(double xmin, double xmax, double ymin, double ymax);
39
- void wdArc(double xc, double yc, double w, double h, double angle1, double angle2);
40
- void wdSector(double xc, double yc, double w, double h, double angle1, double angle2);
41
- void wdChord(double xc, double yc, double w, double h, double angle1, double angle2);
42
- void wdText(double x, double y, const char* s);
43
-
44
- void wdPutImageRect(cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax);
45
- void wdPutImageRectRGB(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
46
- void wdPutImageRectRGBA(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
47
- void wdPutImageRectMap(int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
48
- void wdPutBitmap(cdBitmap* bitmap, double x, double y, double w, double h);
49
-
50
- /* attributes */
51
- double wdLineWidth(double width);
52
- void wdFont(int type_face, int style, double size);
53
- void wdGetFont(int *type_face, int *style, double *size);
54
- double wdMarkSize(double size);
55
- void wdFontDim(double *max_width, double *height, double *ascent, double *descent);
56
- void wdTextSize(const char* s, double *width, double *height);
57
- void wdTextBox(double x, double y, const char* s, double *xmin, double *xmax, double *ymin, double *ymax);
58
- void wdTextBounds(double x, double y, const char* s, double *rect);
59
- void wdStipple(int w, int h, const unsigned char* stipple, double w_mm, double h_mm);
60
- void wdPattern(int w, int h, const long* pattern, double w_mm, double h_mm);
61
-
62
- /* vector text */
63
- void wdVectorTextDirection(double x1, double y1, double x2, double y2);
64
- void wdVectorTextSize(double size_x, double size_y, const char* s);
65
- void wdGetVectorTextSize(const char* s, double *x, double *y);
66
- double wdVectorCharSize(double size);
67
- void wdVectorText(double x, double y, const char* s);
68
- void wdMultiLineVectorText(double x, double y, const char* s);
69
- void wdGetVectorTextBounds(const char* s, double x, double y, double *rect);
70
-
71
- /* OLD definitions, defined for backward compatibility */
72
- #define wdVectorFont cdVectorFont
73
- #define wdVectorTextTransform cdVectorTextTransform
74
- #define wdActivate cdActivate
75
- #define wdClip(mode) cdClip(mode)
76
- #define wdBegin(mode) cdBegin(mode)
77
- #define wdEnd() cdEnd();
78
- #define wdMM2Pixel(mm_dx, mm_dy, dx, dy) cdMM2Pixel(mm_dx, mm_dy, dx, dy)
79
- #define wdPixel2MM(dx, dy, mm_dx, mm_dy) cdPixel2MM(dx, dy, mm_dx, mm_dy)
80
-
81
- #ifdef __cplusplus
82
- }
83
- #endif
84
-
85
- #endif
1
+ /** \file
2
+ * \brief Old WC API
3
+ *
4
+ * See Copyright Notice in cd.h
5
+ */
6
+
7
+ #ifndef WD_OLD_H
8
+ #define WD_OLD_H
9
+
10
+ #ifdef __cplusplus
11
+ extern "C" {
12
+ #endif
13
+
14
+ /* coordinate transformation */
15
+ void wdWindow(double xmin, double xmax, double ymin, double ymax);
16
+ void wdGetWindow(double *xmin, double *xmax, double *ymin, double *ymax);
17
+ void wdViewport(int xmin, int xmax, int ymin, int ymax);
18
+ void wdGetViewport(int *xmin, int *xmax, int *ymin, int *ymax);
19
+ void wdWorld2Canvas(double xw, double yw, int *xv, int *yv);
20
+ void wdWorld2CanvasSize(double hw, double vw, int *hv, int *vv);
21
+ void wdCanvas2World(int xv, int yv, double *xw, double *yw);
22
+
23
+ void wdClipArea(double xmin, double xmax, double ymin, double ymax);
24
+ int wdGetClipArea(double *xmin, double *xmax, double *ymin, double *ymax);
25
+ double* wdGetClipPoly(int *n);
26
+ int wdPointInRegion(double x, double y);
27
+ void wdOffsetRegion(double x, double y);
28
+ void wdRegionBox(double *xmin, double *xmax, double *ymin, double *ymax);
29
+
30
+ void wdHardcopy(cdContext* ctx, void *data, cdCanvas *cnv, void(*draw_func)(void));
31
+
32
+ /* primitives */
33
+ void wdPixel(double x, double y, long color);
34
+ void wdMark(double x, double y);
35
+ void wdLine(double x1, double y1, double x2, double y2);
36
+ void wdVertex(double x, double y);
37
+ void wdRect(double xmin, double xmax, double ymin, double ymax);
38
+ void wdBox(double xmin, double xmax, double ymin, double ymax);
39
+ void wdArc(double xc, double yc, double w, double h, double angle1, double angle2);
40
+ void wdSector(double xc, double yc, double w, double h, double angle1, double angle2);
41
+ void wdChord(double xc, double yc, double w, double h, double angle1, double angle2);
42
+ void wdText(double x, double y, const char* s);
43
+
44
+ void wdPutImageRect(cdImage* image, double x, double y, int xmin, int xmax, int ymin, int ymax);
45
+ void wdPutImageRectRGB(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
46
+ void wdPutImageRectRGBA(int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
47
+ void wdPutImageRectMap(int iw, int ih, const unsigned char* index, const long* colors, double x, double y, double w, double h, int xmin, int xmax, int ymin, int ymax);
48
+ void wdPutBitmap(cdBitmap* bitmap, double x, double y, double w, double h);
49
+
50
+ /* attributes */
51
+ double wdLineWidth(double width);
52
+ void wdFont(int type_face, int style, double size);
53
+ void wdGetFont(int *type_face, int *style, double *size);
54
+ double wdMarkSize(double size);
55
+ void wdFontDim(double *max_width, double *height, double *ascent, double *descent);
56
+ void wdTextSize(const char* s, double *width, double *height);
57
+ void wdTextBox(double x, double y, const char* s, double *xmin, double *xmax, double *ymin, double *ymax);
58
+ void wdTextBounds(double x, double y, const char* s, double *rect);
59
+ void wdStipple(int w, int h, const unsigned char* stipple, double w_mm, double h_mm);
60
+ void wdPattern(int w, int h, const long* pattern, double w_mm, double h_mm);
61
+
62
+ /* vector text */
63
+ void wdVectorTextDirection(double x1, double y1, double x2, double y2);
64
+ void wdVectorTextSize(double size_x, double size_y, const char* s);
65
+ void wdGetVectorTextSize(const char* s, double *x, double *y);
66
+ double wdVectorCharSize(double size);
67
+ void wdVectorText(double x, double y, const char* s);
68
+ void wdMultiLineVectorText(double x, double y, const char* s);
69
+ void wdGetVectorTextBounds(const char* s, double x, double y, double *rect);
70
+
71
+ /* OLD definitions, defined for backward compatibility */
72
+ #define wdVectorFont cdVectorFont
73
+ #define wdVectorTextTransform cdVectorTextTransform
74
+ #define wdActivate cdActivate
75
+ #define wdClip(mode) cdClip(mode)
76
+ #define wdBegin(mode) cdBegin(mode)
77
+ #define wdEnd() cdEnd();
78
+ #define wdMM2Pixel(mm_dx, mm_dy, dx, dy) cdMM2Pixel(mm_dx, mm_dy, dx, dy)
79
+ #define wdPixel2MM(dx, dy, mm_dx, mm_dy) cdPixel2MM(dx, dy, mm_dx, mm_dy)
80
+
81
+ #ifdef __cplusplus
82
+ }
83
+ #endif
84
+
85
+ #endif
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,494 +1,494 @@
1
- /** \file
2
- * \brief User API
3
- * CD - Canvas Draw
4
- * Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
5
- * http://www.tecgraf.puc-rio.br/cd
6
- * mailto:cd@tecgraf.puc-rio.br
7
- *
8
- * See Copyright Notice at the end of this file
9
- */
10
-
11
- #ifndef __CD_H
12
- #define __CD_H
13
-
14
- #ifdef __cplusplus
15
- extern "C" {
16
- #endif
17
-
18
-
19
- #define CD_NAME "CD - Canvas Draw"
20
- #define CD_DESCRIPTION "A 2D Graphics Library"
21
- #define CD_COPYRIGHT "Copyright (C) 1994-2008 Tecgraf, PUC-Rio."
22
- #define CD_VERSION "5.1.0"
23
- #define CD_VERSION_DATE "2008/10/14"
24
- #define CD_VERSION_NUMBER 501000
25
-
26
- typedef struct _cdContext cdContext;
27
- typedef struct _cdCanvas cdCanvas;
28
- typedef struct _cdCanvas cdState;
29
- typedef struct _cdImage cdImage;
30
-
31
- /* client images using bitmap structure */
32
- typedef struct _cdBitmap {
33
- int w;
34
- int h;
35
- int type;
36
- void *data;
37
- } cdBitmap;
38
-
39
-
40
- /* library */
41
- char* cdVersion(void);
42
- char* cdVersionDate(void);
43
- int cdVersionNumber(void);
44
-
45
- /* canvas init */
46
- cdCanvas* cdCreateCanvas(cdContext *context, void *data);
47
- cdCanvas* cdCreateCanvasf(cdContext *context, const char* format, ...);
48
- void cdKillCanvas(cdCanvas* canvas);
49
-
50
- cdContext* cdCanvasGetContext(cdCanvas* canvas);
51
- int cdCanvasActivate(cdCanvas* canvas);
52
- void cdCanvasDeactivate(cdCanvas* canvas);
53
- int cdUseContextPlus(int use);
54
- void cdInitContextPlus(void); /* need an external library */
55
-
56
- /* context */
57
- typedef int (*cdCallback)(cdCanvas* canvas, ...);
58
- int cdContextRegisterCallback(cdContext *context, int cb, cdCallback func);
59
- unsigned long cdContextCaps(cdContext *context);
60
-
61
- /* control */
62
- int cdCanvasSimulate(cdCanvas* canvas, int mode);
63
- void cdCanvasFlush(cdCanvas* canvas);
64
- void cdCanvasClear(cdCanvas* canvas);
65
- cdState* cdCanvasSaveState(cdCanvas* canvas);
66
- void cdCanvasRestoreState(cdCanvas* canvas, cdState* state);
67
- void cdReleaseState(cdState* state);
68
- void cdCanvasSetAttribute(cdCanvas* canvas, const char* name, char* data);
69
- void cdCanvasSetfAttribute(cdCanvas* canvas, const char* name, const char* format, ...);
70
- char* cdCanvasGetAttribute(cdCanvas* canvas, const char* name);
71
-
72
- /* interpretation */
73
- int cdCanvasPlay(cdCanvas* canvas, cdContext *context, int xmin, int xmax, int ymin, int ymax, void *data);
74
-
75
- /* coordinate transformation */
76
- void cdCanvasGetSize(cdCanvas* canvas, int *width, int *height, double *width_mm, double *height_mm);
77
- int cdCanvasUpdateYAxis(cdCanvas* canvas, int* y);
78
- double cdfCanvasUpdateYAxis(cdCanvas* canvas, double* y);
79
- int cdCanvasInvertYAxis(cdCanvas* canvas, int y);
80
- double cdfCanvasInvertYAxis(cdCanvas* canvas, double y);
81
- void cdCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, int *dx, int *dy);
82
- void cdCanvasPixel2MM(cdCanvas* canvas, int dx, int dy, double *mm_dx, double *mm_dy);
83
- void cdfCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, double *dx, double *dy);
84
- void cdfCanvasPixel2MM(cdCanvas* canvas, double dx, double dy, double *mm_dx, double *mm_dy);
85
- void cdCanvasOrigin(cdCanvas* canvas, int x, int y);
86
- void cdfCanvasOrigin(cdCanvas* canvas, double x, double y);
87
- void cdCanvasGetOrigin(cdCanvas* canvas, int *x, int *y);
88
- void cdfCanvasGetOrigin(cdCanvas* canvas, double *x, double *y);
89
- void cdCanvasTransform(cdCanvas* canvas, const double* matrix);
90
- double* cdCanvasGetTransform(cdCanvas* canvas);
91
- void cdCanvasTransformMultiply(cdCanvas* canvas, const double* matrix);
92
- void cdCanvasTransformRotate(cdCanvas* canvas, double angle);
93
- void cdCanvasTransformScale(cdCanvas* canvas, double sx, double sy);
94
- void cdCanvasTransformTranslate(cdCanvas* canvas, double dx, double dy);
95
- void cdCanvasTransformPoint(cdCanvas* canvas, int x, int y, int *tx, int *ty);
96
- void cdfCanvasTransformPoint(cdCanvas* canvas, double x, double y, double *tx, double *ty);
97
-
98
- /* clipping */
99
- int cdCanvasClip(cdCanvas* canvas, int mode);
100
- void cdCanvasClipArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
101
- int cdCanvasGetClipArea(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
102
- void cdfCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
103
- int cdfCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
104
-
105
- /* clipping region */
106
- int cdCanvasIsPointInRegion(cdCanvas* canvas, int x, int y);
107
- void cdCanvasOffsetRegion(cdCanvas* canvas, int x, int y);
108
- void cdCanvasGetRegionBox(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
109
- int cdCanvasRegionCombineMode(cdCanvas* canvas, int mode);
110
-
111
- /* primitives */
112
- void cdCanvasPixel(cdCanvas* canvas, int x, int y, long color);
113
- void cdCanvasMark(cdCanvas* canvas, int x, int y);
114
-
115
- void cdCanvasLine(cdCanvas* canvas, int x1, int y1, int x2, int y2);
116
- void cdCanvasBegin(cdCanvas* canvas, int mode);
117
- void cdCanvasVertex(cdCanvas* canvas, int x, int y);
118
- void cdCanvasEnd(cdCanvas* canvas);
119
- void cdCanvasRect(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
120
- void cdCanvasBox(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
121
- void cdCanvasArc(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
122
- void cdCanvasSector(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
123
- void cdCanvasChord(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
124
- void cdCanvasText(cdCanvas* canvas, int x, int y, const char* s);
125
-
126
- void cdfCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2);
127
- void cdfCanvasVertex(cdCanvas* canvas, double x, double y);
128
- void cdfCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
129
- void cdfCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
130
- void cdfCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
131
- void cdfCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
132
- void cdfCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
133
- void cdfCanvasText(cdCanvas* canvas, double x, double y, const char* s);
134
-
135
- /* attributes */
136
- void cdCanvasSetBackground(cdCanvas* canvas, long color);
137
- void cdCanvasSetForeground(cdCanvas* canvas, long color);
138
- long cdCanvasBackground(cdCanvas* canvas, long color);
139
- long cdCanvasForeground(cdCanvas* canvas, long color);
140
- int cdCanvasBackOpacity(cdCanvas* canvas, int opacity);
141
- int cdCanvasWriteMode(cdCanvas* canvas, int mode);
142
- int cdCanvasLineStyle(cdCanvas* canvas, int style);
143
- void cdCanvasLineStyleDashes(cdCanvas* canvas, const int* dashes, int count);
144
- int cdCanvasLineWidth(cdCanvas* canvas, int width);
145
- int cdCanvasLineJoin(cdCanvas* canvas, int join);
146
- int cdCanvasLineCap(cdCanvas* canvas, int cap);
147
- int cdCanvasInteriorStyle(cdCanvas* canvas, int style);
148
- int cdCanvasHatch(cdCanvas* canvas, int style);
149
- void cdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char* stipple);
150
- unsigned char* cdCanvasGetStipple(cdCanvas* canvas, int *n, int *m);
151
- void cdCanvasPattern(cdCanvas* canvas, int w, int h, long const int *pattern);
152
- long* cdCanvasGetPattern(cdCanvas* canvas, int* n, int* m);
153
- int cdCanvasFillMode(cdCanvas* canvas, int mode);
154
- int cdCanvasFont(cdCanvas* canvas, const char* type_face, int style, int size);
155
- void cdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, int *size);
156
- char* cdCanvasNativeFont(cdCanvas* canvas, const char* font);
157
- int cdCanvasTextAlignment(cdCanvas* canvas, int alignment);
158
- double cdCanvasTextOrientation(cdCanvas* canvas, double angle);
159
- int cdCanvasMarkType(cdCanvas* canvas, int type);
160
- int cdCanvasMarkSize(cdCanvas* canvas, int size);
161
-
162
- /* vector text */
163
- void cdCanvasVectorText(cdCanvas* canvas, int x, int y, const char* s);
164
- void cdCanvasMultiLineVectorText(cdCanvas* canvas, int x, int y, const char* s);
165
-
166
- /* vector text attributes */
167
- char *cdCanvasVectorFont(cdCanvas* canvas, const char *filename);
168
- void cdCanvasVectorTextDirection(cdCanvas* canvas, int x1, int y1, int x2, int y2);
169
- double* cdCanvasVectorTextTransform(cdCanvas* canvas, const double* matrix);
170
- void cdCanvasVectorTextSize(cdCanvas* canvas, int size_x, int size_y, const char* s);
171
- int cdCanvasVectorCharSize(cdCanvas* canvas, int size);
172
-
173
- /* vector text properties */
174
- void cdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, int *x, int *y);
175
- void cdCanvasGetVectorTextBounds(cdCanvas* canvas, const char* s, int x, int y, int *rect);
176
-
177
- /* properties */
178
- void cdCanvasGetFontDim(cdCanvas* canvas, int *max_width, int *height, int *ascent, int *descent);
179
- void cdCanvasGetTextSize(cdCanvas* canvas, const char* s, int *width, int *height);
180
- void cdCanvasGetTextBox(cdCanvas* canvas, int x, int y, const char* s, int *xmin, int *xmax, int *ymin, int *ymax);
181
- void cdCanvasGetTextBounds(cdCanvas* canvas, int x, int y, const char* s, int *rect);
182
- int cdCanvasGetColorPlanes(cdCanvas* canvas);
183
-
184
- /* color */
185
- void cdCanvasPalette(cdCanvas* canvas, int n, const long *palette, int mode);
186
-
187
- /* client images */
188
- void cdCanvasGetImageRGB(cdCanvas* canvas, unsigned char* r, unsigned char* g, unsigned char* b, int x, int y, int w, int h);
189
- void cdCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
190
- void cdCanvasPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
191
- void cdCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, const unsigned char* index, const long* colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
192
-
193
- /* server images */
194
- cdImage* cdCanvasCreateImage(cdCanvas* canvas, int w, int h);
195
- void cdKillImage(cdImage* image);
196
- void cdCanvasGetImage(cdCanvas* canvas, cdImage* image, int x, int y);
197
- void cdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, int x, int y, int xmin, int xmax, int ymin, int ymax);
198
- void cdCanvasScrollArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax, int dx, int dy);
199
-
200
- /* bitmap */
201
- cdBitmap* cdCreateBitmap(int w, int h, int type);
202
- cdBitmap* cdInitBitmap(int w, int h, int type, ...);
203
- void cdKillBitmap(cdBitmap* bitmap);
204
- unsigned char* cdBitmapGetData(cdBitmap* bitmap, int dataptr);
205
- void cdBitmapSetRect(cdBitmap* bitmap, int xmin, int xmax, int ymin, int ymax);
206
- void cdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y, int w, int h);
207
- void cdCanvasGetBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y);
208
- void cdBitmapRGB2Map(cdBitmap* bitmap_rgb, cdBitmap* bitmap_map);
209
-
210
- /* color */
211
- long cdEncodeColor(unsigned char red, unsigned char green, unsigned char blue);
212
- void cdDecodeColor(long color, unsigned char* red, unsigned char* green, unsigned char* blue);
213
- unsigned char cdDecodeAlpha(long color);
214
- long cdEncodeAlpha(long color, unsigned char alpha);
215
-
216
- #define cdAlpha(_) (unsigned char)(~(((_) >> 24) & 0xFF))
217
- #define cdReserved(_) (unsigned char)(((_) >> 24) & 0xFF)
218
- #define cdRed(_) (unsigned char)(((_) >> 16) & 0xFF)
219
- #define cdGreen(_) (unsigned char)(((_) >> 8) & 0xFF)
220
- #define cdBlue(_) (unsigned char)(((_) >> 0) & 0xFF)
221
-
222
- /* client image color convertion */
223
- void cdRGB2Map(int width, int height, const unsigned char* red, const unsigned char* green, const unsigned char* blue, unsigned char* index, int pal_size, long *color);
224
-
225
-
226
- /* CD Values */
227
-
228
- #define CD_QUERY -1 /* query value */
229
-
230
- enum { /* bitmap type */
231
- CD_RGB, /* these definitions are compatible with the IM library */
232
- CD_MAP,
233
- CD_RGBA = 0x100
234
- };
235
-
236
- enum { /* bitmap data */
237
- CD_IRED,
238
- CD_IGREEN,
239
- CD_IBLUE,
240
- CD_IALPHA,
241
- CD_INDEX,
242
- CD_COLORS
243
- };
244
-
245
- enum { /* status report */
246
- CD_ERROR = -1,
247
- CD_OK = 0
248
- };
249
-
250
- enum { /* clip mode */
251
- CD_CLIPOFF,
252
- CD_CLIPAREA,
253
- CD_CLIPPOLYGON,
254
- CD_CLIPREGION
255
- };
256
-
257
- enum { /* region combine mode */
258
- CD_UNION,
259
- CD_INTERSECT,
260
- CD_DIFFERENCE,
261
- CD_NOTINTERSECT
262
- };
263
-
264
- enum { /* polygon mode (begin...end) */
265
- CD_FILL,
266
- CD_OPEN_LINES,
267
- CD_CLOSED_LINES,
268
- CD_CLIP,
269
- CD_BEZIER,
270
- CD_REGION
271
- };
272
-
273
- #define CD_POLYCUSTOM 10
274
-
275
- enum { /* fill mode */
276
- CD_EVENODD,
277
- CD_WINDING
278
- };
279
-
280
- enum { /* line join */
281
- CD_MITER,
282
- CD_BEVEL,
283
- CD_ROUND
284
- };
285
-
286
- enum { /* line cap */
287
- CD_CAPFLAT,
288
- CD_CAPSQUARE,
289
- CD_CAPROUND
290
- };
291
-
292
- enum { /* background opacity mode */
293
- CD_OPAQUE,
294
- CD_TRANSPARENT
295
- };
296
-
297
- enum { /* write mode */
298
- CD_REPLACE,
299
- CD_XOR,
300
- CD_NOT_XOR
301
- };
302
-
303
- enum { /* color allocation mode (palette) */
304
- CD_POLITE,
305
- CD_FORCE
306
- };
307
-
308
- enum { /* line style */
309
- CD_CONTINUOUS,
310
- CD_DASHED,
311
- CD_DOTTED,
312
- CD_DASH_DOT,
313
- CD_DASH_DOT_DOT,
314
- CD_CUSTOM
315
- };
316
-
317
- enum { /* marker type */
318
- CD_PLUS,
319
- CD_STAR,
320
- CD_CIRCLE,
321
- CD_X,
322
- CD_BOX,
323
- CD_DIAMOND,
324
- CD_HOLLOW_CIRCLE,
325
- CD_HOLLOW_BOX,
326
- CD_HOLLOW_DIAMOND
327
- };
328
-
329
- enum { /* hatch type */
330
- CD_HORIZONTAL,
331
- CD_VERTICAL,
332
- CD_FDIAGONAL,
333
- CD_BDIAGONAL,
334
- CD_CROSS,
335
- CD_DIAGCROSS
336
- };
337
-
338
- enum { /* interior style */
339
- CD_SOLID,
340
- CD_HATCH,
341
- CD_STIPPLE,
342
- CD_PATTERN,
343
- CD_HOLLOW
344
- };
345
-
346
- enum { /* text alignment */
347
- CD_NORTH,
348
- CD_SOUTH,
349
- CD_EAST,
350
- CD_WEST,
351
- CD_NORTH_EAST,
352
- CD_NORTH_WEST,
353
- CD_SOUTH_EAST,
354
- CD_SOUTH_WEST,
355
- CD_CENTER,
356
- CD_BASE_LEFT,
357
- CD_BASE_CENTER,
358
- CD_BASE_RIGHT
359
- };
360
-
361
- enum { /* style */
362
- CD_PLAIN = 0,
363
- CD_BOLD = 1,
364
- CD_ITALIC = 2,
365
- CD_UNDERLINE = 4,
366
- CD_STRIKEOUT = 8
367
- };
368
-
369
- #define CD_BOLD_ITALIC (CD_BOLD|CD_ITALIC) /* compatibility name */
370
-
371
- enum { /* some font sizes */
372
- CD_SMALL = 8,
373
- CD_STANDARD = 12,
374
- CD_LARGE = 18
375
- };
376
-
377
- /* Canvas Capabilities */
378
- #define CD_CAP_NONE 0x00000000
379
- #define CD_CAP_FLUSH 0x00000001
380
- #define CD_CAP_CLEAR 0x00000002
381
- #define CD_CAP_PLAY 0x00000004
382
- #define CD_CAP_YAXIS 0x00000008
383
- #define CD_CAP_CLIPAREA 0x00000010
384
- #define CD_CAP_CLIPPOLY 0x00000020
385
- #define CD_CAP_REGION 0x00000040
386
- #define CD_CAP_RECT 0x00000080
387
- #define CD_CAP_CHORD 0x00000100
388
- #define CD_CAP_IMAGERGB 0x00000200
389
- #define CD_CAP_IMAGERGBA 0x00000400
390
- #define CD_CAP_IMAGEMAP 0x00000800
391
- #define CD_CAP_GETIMAGERGB 0x00001000
392
- #define CD_CAP_IMAGESRV 0x00002000
393
- #define CD_CAP_BACKGROUND 0x00004000
394
- #define CD_CAP_BACKOPACITY 0x00008000
395
- #define CD_CAP_WRITEMODE 0x00010000
396
- #define CD_CAP_LINESTYLE 0x00020000
397
- #define CD_CAP_LINEWITH 0x00040000
398
- #define CD_CAP_FPRIMTIVES 0x00080000
399
- #define CD_CAP_HATCH 0x00100000
400
- #define CD_CAP_STIPPLE 0x00200000
401
- #define CD_CAP_PATTERN 0x00400000
402
- #define CD_CAP_FONT 0x00800000
403
- #define CD_CAP_FONTDIM 0x01000000
404
- #define CD_CAP_TEXTSIZE 0x02000000
405
- #define CD_CAP_TEXTORIENTATION 0x04000000
406
- #define CD_CAP_PALETTE 0x08000000
407
- #define CD_CAP_LINECAP 0x10000000
408
- #define CD_CAP_LINEJOIN 0x20000000
409
- #define CD_CAP_ALL 0xFFFFFFFF
410
-
411
- /* cdPlay definitions */
412
- #define CD_SIZECB 0 /* size callback */
413
- typedef int(*cdSizeCB)(cdCanvas *canvas, int w, int h, double w_mm, double h_mm);
414
- #define CD_ABORT 1
415
- #define CD_CONTINUE 0
416
-
417
- /* simulation flags */
418
- #define CD_SIM_NONE 0x0000
419
- #define CD_SIM_LINE 0x0001
420
- #define CD_SIM_RECT 0x0002
421
- #define CD_SIM_BOX 0x0004
422
- #define CD_SIM_ARC 0x0008
423
- #define CD_SIM_SECTOR 0x0010
424
- #define CD_SIM_CHORD 0x0020
425
- #define CD_SIM_POLYLINE 0x0040
426
- #define CD_SIM_POLYGON 0x0080
427
- #define CD_SIM_TEXT 0x0100
428
- #define CD_SIM_ALL 0xFFFF
429
-
430
- #define CD_SIM_LINES (CD_SIM_LINE | CD_SIM_RECT | CD_SIM_ARC | CD_SIM_POLYLINE)
431
- #define CD_SIM_FILLS (CD_SIM_BOX | CD_SIM_SECTOR | CD_SIM_CHORD | CD_SIM_POLYGON)
432
-
433
- /* some predefined colors for convenience */
434
- #define CD_RED 0xFF0000L /* 255, 0, 0 */
435
- #define CD_DARK_RED 0x800000L /* 128, 0, 0 */
436
- #define CD_GREEN 0x00FF00L /* 0,255, 0 */
437
- #define CD_DARK_GREEN 0x008000L /* 0,128, 0 */
438
- #define CD_BLUE 0x0000FFL /* 0, 0,255 */
439
- #define CD_DARK_BLUE 0x000080L /* 0, 0,128 */
440
-
441
- #define CD_YELLOW 0xFFFF00L /* 255,255, 0 */
442
- #define CD_DARK_YELLOW 0x808000L /* 128,128, 0 */
443
- #define CD_MAGENTA 0xFF00FFL /* 255, 0,255 */
444
- #define CD_DARK_MAGENTA 0x800080L /* 128, 0,128 */
445
- #define CD_CYAN 0x00FFFFL /* 0,255,255 */
446
- #define CD_DARK_CYAN 0x008080L /* 0,128,128 */
447
-
448
- #define CD_WHITE 0xFFFFFFL /* 255,255,255 */
449
- #define CD_BLACK 0x000000L /* 0, 0, 0 */
450
-
451
- #define CD_DARK_GRAY 0x808080L /* 128,128,128 */
452
- #define CD_GRAY 0xC0C0C0L /* 192,192,192 */
453
-
454
- /* some usefull conversion factors */
455
- #define CD_MM2PT 2.834645669 /* milimeters to points (pt = CD_MM2PT * mm) */
456
- #define CD_RAD2DEG 57.295779513 /* radians to degrees (deg = CD_RAD2DEG * rad) */
457
- #define CD_DEG2RAD 0.01745329252 /* degrees to radians (rad = CD_DEG2RAD * deg) */
458
-
459
-
460
- #ifdef __cplusplus
461
- }
462
- #endif
463
-
464
-
465
- #ifndef CD_NO_OLD_INTERFACE
466
- #include "cd_old.h"
467
- #endif
468
-
469
-
470
- /******************************************************************************
471
- Copyright (C) 1994-2008 Tecgraf, PUC-Rio.
472
-
473
- Permission is hereby granted, free of charge, to any person obtaining
474
- a copy of this software and associated documentation files (the
475
- "Software"), to deal in the Software without restriction, including
476
- without limitation the rights to use, copy, modify, merge, publish,
477
- distribute, sublicense, and/or sell copies of the Software, and to
478
- permit persons to whom the Software is furnished to do so, subject to
479
- the following conditions:
480
-
481
- The above copyright notice and this permission notice shall be
482
- included in all copies or substantial portions of the Software.
483
-
484
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
485
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
486
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
487
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
488
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
489
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
490
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
491
- ******************************************************************************/
492
-
493
- #endif /* ifndef CD_H */
494
-
1
+ /** \file
2
+ * \brief User API
3
+ * CD - Canvas Draw
4
+ * Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
5
+ * http://www.tecgraf.puc-rio.br/cd
6
+ * mailto:cd@tecgraf.puc-rio.br
7
+ *
8
+ * See Copyright Notice at the end of this file
9
+ */
10
+
11
+ #ifndef __CD_H
12
+ #define __CD_H
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
18
+
19
+ #define CD_NAME "CD - Canvas Draw"
20
+ #define CD_DESCRIPTION "A 2D Graphics Library"
21
+ #define CD_COPYRIGHT "Copyright (C) 1994-2008 Tecgraf, PUC-Rio."
22
+ #define CD_VERSION "5.1"
23
+ #define CD_VERSION_DATE "2008/10/14"
24
+ #define CD_VERSION_NUMBER 501000
25
+
26
+ typedef struct _cdContext cdContext;
27
+ typedef struct _cdCanvas cdCanvas;
28
+ typedef struct _cdCanvas cdState;
29
+ typedef struct _cdImage cdImage;
30
+
31
+ /* client images using bitmap structure */
32
+ typedef struct _cdBitmap {
33
+ int w;
34
+ int h;
35
+ int type;
36
+ void *data;
37
+ } cdBitmap;
38
+
39
+
40
+ /* library */
41
+ char* cdVersion(void);
42
+ char* cdVersionDate(void);
43
+ int cdVersionNumber(void);
44
+
45
+ /* canvas init */
46
+ cdCanvas* cdCreateCanvas(cdContext *context, void *data);
47
+ cdCanvas* cdCreateCanvasf(cdContext *context, const char* format, ...);
48
+ void cdKillCanvas(cdCanvas* canvas);
49
+
50
+ cdContext* cdCanvasGetContext(cdCanvas* canvas);
51
+ int cdCanvasActivate(cdCanvas* canvas);
52
+ void cdCanvasDeactivate(cdCanvas* canvas);
53
+ int cdUseContextPlus(int use);
54
+ void cdInitContextPlus(void); /* need an external library */
55
+
56
+ /* context */
57
+ typedef int (*cdCallback)(cdCanvas* canvas, ...);
58
+ int cdContextRegisterCallback(cdContext *context, int cb, cdCallback func);
59
+ unsigned long cdContextCaps(cdContext *context);
60
+
61
+ /* control */
62
+ int cdCanvasSimulate(cdCanvas* canvas, int mode);
63
+ void cdCanvasFlush(cdCanvas* canvas);
64
+ void cdCanvasClear(cdCanvas* canvas);
65
+ cdState* cdCanvasSaveState(cdCanvas* canvas);
66
+ void cdCanvasRestoreState(cdCanvas* canvas, cdState* state);
67
+ void cdReleaseState(cdState* state);
68
+ void cdCanvasSetAttribute(cdCanvas* canvas, const char* name, char* data);
69
+ void cdCanvasSetfAttribute(cdCanvas* canvas, const char* name, const char* format, ...);
70
+ char* cdCanvasGetAttribute(cdCanvas* canvas, const char* name);
71
+
72
+ /* interpretation */
73
+ int cdCanvasPlay(cdCanvas* canvas, cdContext *context, int xmin, int xmax, int ymin, int ymax, void *data);
74
+
75
+ /* coordinate transformation */
76
+ void cdCanvasGetSize(cdCanvas* canvas, int *width, int *height, double *width_mm, double *height_mm);
77
+ int cdCanvasUpdateYAxis(cdCanvas* canvas, int* y);
78
+ double cdfCanvasUpdateYAxis(cdCanvas* canvas, double* y);
79
+ int cdCanvasInvertYAxis(cdCanvas* canvas, int y);
80
+ double cdfCanvasInvertYAxis(cdCanvas* canvas, double y);
81
+ void cdCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, int *dx, int *dy);
82
+ void cdCanvasPixel2MM(cdCanvas* canvas, int dx, int dy, double *mm_dx, double *mm_dy);
83
+ void cdfCanvasMM2Pixel(cdCanvas* canvas, double mm_dx, double mm_dy, double *dx, double *dy);
84
+ void cdfCanvasPixel2MM(cdCanvas* canvas, double dx, double dy, double *mm_dx, double *mm_dy);
85
+ void cdCanvasOrigin(cdCanvas* canvas, int x, int y);
86
+ void cdfCanvasOrigin(cdCanvas* canvas, double x, double y);
87
+ void cdCanvasGetOrigin(cdCanvas* canvas, int *x, int *y);
88
+ void cdfCanvasGetOrigin(cdCanvas* canvas, double *x, double *y);
89
+ void cdCanvasTransform(cdCanvas* canvas, const double* matrix);
90
+ double* cdCanvasGetTransform(cdCanvas* canvas);
91
+ void cdCanvasTransformMultiply(cdCanvas* canvas, const double* matrix);
92
+ void cdCanvasTransformRotate(cdCanvas* canvas, double angle);
93
+ void cdCanvasTransformScale(cdCanvas* canvas, double sx, double sy);
94
+ void cdCanvasTransformTranslate(cdCanvas* canvas, double dx, double dy);
95
+ void cdCanvasTransformPoint(cdCanvas* canvas, int x, int y, int *tx, int *ty);
96
+ void cdfCanvasTransformPoint(cdCanvas* canvas, double x, double y, double *tx, double *ty);
97
+
98
+ /* clipping */
99
+ int cdCanvasClip(cdCanvas* canvas, int mode);
100
+ void cdCanvasClipArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
101
+ int cdCanvasGetClipArea(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
102
+ void cdfCanvasClipArea(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
103
+ int cdfCanvasGetClipArea(cdCanvas* canvas, double *xmin, double *xmax, double *ymin, double *ymax);
104
+
105
+ /* clipping region */
106
+ int cdCanvasIsPointInRegion(cdCanvas* canvas, int x, int y);
107
+ void cdCanvasOffsetRegion(cdCanvas* canvas, int x, int y);
108
+ void cdCanvasGetRegionBox(cdCanvas* canvas, int *xmin, int *xmax, int *ymin, int *ymax);
109
+ int cdCanvasRegionCombineMode(cdCanvas* canvas, int mode);
110
+
111
+ /* primitives */
112
+ void cdCanvasPixel(cdCanvas* canvas, int x, int y, long color);
113
+ void cdCanvasMark(cdCanvas* canvas, int x, int y);
114
+
115
+ void cdCanvasLine(cdCanvas* canvas, int x1, int y1, int x2, int y2);
116
+ void cdCanvasBegin(cdCanvas* canvas, int mode);
117
+ void cdCanvasVertex(cdCanvas* canvas, int x, int y);
118
+ void cdCanvasEnd(cdCanvas* canvas);
119
+ void cdCanvasRect(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
120
+ void cdCanvasBox(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax);
121
+ void cdCanvasArc(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
122
+ void cdCanvasSector(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
123
+ void cdCanvasChord(cdCanvas* canvas, int xc, int yc, int w, int h, double angle1, double angle2);
124
+ void cdCanvasText(cdCanvas* canvas, int x, int y, const char* s);
125
+
126
+ void cdfCanvasLine(cdCanvas* canvas, double x1, double y1, double x2, double y2);
127
+ void cdfCanvasVertex(cdCanvas* canvas, double x, double y);
128
+ void cdfCanvasRect(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
129
+ void cdfCanvasBox(cdCanvas* canvas, double xmin, double xmax, double ymin, double ymax);
130
+ void cdfCanvasArc(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
131
+ void cdfCanvasSector(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
132
+ void cdfCanvasChord(cdCanvas* canvas, double xc, double yc, double w, double h, double angle1, double angle2);
133
+ void cdfCanvasText(cdCanvas* canvas, double x, double y, const char* s);
134
+
135
+ /* attributes */
136
+ void cdCanvasSetBackground(cdCanvas* canvas, long color);
137
+ void cdCanvasSetForeground(cdCanvas* canvas, long color);
138
+ long cdCanvasBackground(cdCanvas* canvas, long color);
139
+ long cdCanvasForeground(cdCanvas* canvas, long color);
140
+ int cdCanvasBackOpacity(cdCanvas* canvas, int opacity);
141
+ int cdCanvasWriteMode(cdCanvas* canvas, int mode);
142
+ int cdCanvasLineStyle(cdCanvas* canvas, int style);
143
+ void cdCanvasLineStyleDashes(cdCanvas* canvas, const int* dashes, int count);
144
+ int cdCanvasLineWidth(cdCanvas* canvas, int width);
145
+ int cdCanvasLineJoin(cdCanvas* canvas, int join);
146
+ int cdCanvasLineCap(cdCanvas* canvas, int cap);
147
+ int cdCanvasInteriorStyle(cdCanvas* canvas, int style);
148
+ int cdCanvasHatch(cdCanvas* canvas, int style);
149
+ void cdCanvasStipple(cdCanvas* canvas, int w, int h, const unsigned char* stipple);
150
+ unsigned char* cdCanvasGetStipple(cdCanvas* canvas, int *n, int *m);
151
+ void cdCanvasPattern(cdCanvas* canvas, int w, int h, long const int *pattern);
152
+ long* cdCanvasGetPattern(cdCanvas* canvas, int* n, int* m);
153
+ int cdCanvasFillMode(cdCanvas* canvas, int mode);
154
+ int cdCanvasFont(cdCanvas* canvas, const char* type_face, int style, int size);
155
+ void cdCanvasGetFont(cdCanvas* canvas, char *type_face, int *style, int *size);
156
+ char* cdCanvasNativeFont(cdCanvas* canvas, const char* font);
157
+ int cdCanvasTextAlignment(cdCanvas* canvas, int alignment);
158
+ double cdCanvasTextOrientation(cdCanvas* canvas, double angle);
159
+ int cdCanvasMarkType(cdCanvas* canvas, int type);
160
+ int cdCanvasMarkSize(cdCanvas* canvas, int size);
161
+
162
+ /* vector text */
163
+ void cdCanvasVectorText(cdCanvas* canvas, int x, int y, const char* s);
164
+ void cdCanvasMultiLineVectorText(cdCanvas* canvas, int x, int y, const char* s);
165
+
166
+ /* vector text attributes */
167
+ char *cdCanvasVectorFont(cdCanvas* canvas, const char *filename);
168
+ void cdCanvasVectorTextDirection(cdCanvas* canvas, int x1, int y1, int x2, int y2);
169
+ double* cdCanvasVectorTextTransform(cdCanvas* canvas, const double* matrix);
170
+ void cdCanvasVectorTextSize(cdCanvas* canvas, int size_x, int size_y, const char* s);
171
+ int cdCanvasVectorCharSize(cdCanvas* canvas, int size);
172
+
173
+ /* vector text properties */
174
+ void cdCanvasGetVectorTextSize(cdCanvas* canvas, const char* s, int *x, int *y);
175
+ void cdCanvasGetVectorTextBounds(cdCanvas* canvas, const char* s, int x, int y, int *rect);
176
+
177
+ /* properties */
178
+ void cdCanvasGetFontDim(cdCanvas* canvas, int *max_width, int *height, int *ascent, int *descent);
179
+ void cdCanvasGetTextSize(cdCanvas* canvas, const char* s, int *width, int *height);
180
+ void cdCanvasGetTextBox(cdCanvas* canvas, int x, int y, const char* s, int *xmin, int *xmax, int *ymin, int *ymax);
181
+ void cdCanvasGetTextBounds(cdCanvas* canvas, int x, int y, const char* s, int *rect);
182
+ int cdCanvasGetColorPlanes(cdCanvas* canvas);
183
+
184
+ /* color */
185
+ void cdCanvasPalette(cdCanvas* canvas, int n, const long *palette, int mode);
186
+
187
+ /* client images */
188
+ void cdCanvasGetImageRGB(cdCanvas* canvas, unsigned char* r, unsigned char* g, unsigned char* b, int x, int y, int w, int h);
189
+ void cdCanvasPutImageRectRGB(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
190
+ void cdCanvasPutImageRectRGBA(cdCanvas* canvas, int iw, int ih, const unsigned char* r, const unsigned char* g, const unsigned char* b, const unsigned char* a, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
191
+ void cdCanvasPutImageRectMap(cdCanvas* canvas, int iw, int ih, const unsigned char* index, const long* colors, int x, int y, int w, int h, int xmin, int xmax, int ymin, int ymax);
192
+
193
+ /* server images */
194
+ cdImage* cdCanvasCreateImage(cdCanvas* canvas, int w, int h);
195
+ void cdKillImage(cdImage* image);
196
+ void cdCanvasGetImage(cdCanvas* canvas, cdImage* image, int x, int y);
197
+ void cdCanvasPutImageRect(cdCanvas* canvas, cdImage* image, int x, int y, int xmin, int xmax, int ymin, int ymax);
198
+ void cdCanvasScrollArea(cdCanvas* canvas, int xmin, int xmax, int ymin, int ymax, int dx, int dy);
199
+
200
+ /* bitmap */
201
+ cdBitmap* cdCreateBitmap(int w, int h, int type);
202
+ cdBitmap* cdInitBitmap(int w, int h, int type, ...);
203
+ void cdKillBitmap(cdBitmap* bitmap);
204
+ unsigned char* cdBitmapGetData(cdBitmap* bitmap, int dataptr);
205
+ void cdBitmapSetRect(cdBitmap* bitmap, int xmin, int xmax, int ymin, int ymax);
206
+ void cdCanvasPutBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y, int w, int h);
207
+ void cdCanvasGetBitmap(cdCanvas* canvas, cdBitmap* bitmap, int x, int y);
208
+ void cdBitmapRGB2Map(cdBitmap* bitmap_rgb, cdBitmap* bitmap_map);
209
+
210
+ /* color */
211
+ long cdEncodeColor(unsigned char red, unsigned char green, unsigned char blue);
212
+ void cdDecodeColor(long color, unsigned char* red, unsigned char* green, unsigned char* blue);
213
+ unsigned char cdDecodeAlpha(long color);
214
+ long cdEncodeAlpha(long color, unsigned char alpha);
215
+
216
+ #define cdAlpha(_) (unsigned char)(~(((_) >> 24) & 0xFF))
217
+ #define cdReserved(_) (unsigned char)(((_) >> 24) & 0xFF)
218
+ #define cdRed(_) (unsigned char)(((_) >> 16) & 0xFF)
219
+ #define cdGreen(_) (unsigned char)(((_) >> 8) & 0xFF)
220
+ #define cdBlue(_) (unsigned char)(((_) >> 0) & 0xFF)
221
+
222
+ /* client image color convertion */
223
+ void cdRGB2Map(int width, int height, const unsigned char* red, const unsigned char* green, const unsigned char* blue, unsigned char* index, int pal_size, long *color);
224
+
225
+
226
+ /* CD Values */
227
+
228
+ #define CD_QUERY -1 /* query value */
229
+
230
+ enum { /* bitmap type */
231
+ CD_RGB, /* these definitions are compatible with the IM library */
232
+ CD_MAP,
233
+ CD_RGBA = 0x100
234
+ };
235
+
236
+ enum { /* bitmap data */
237
+ CD_IRED,
238
+ CD_IGREEN,
239
+ CD_IBLUE,
240
+ CD_IALPHA,
241
+ CD_INDEX,
242
+ CD_COLORS
243
+ };
244
+
245
+ enum { /* status report */
246
+ CD_ERROR = -1,
247
+ CD_OK = 0
248
+ };
249
+
250
+ enum { /* clip mode */
251
+ CD_CLIPOFF,
252
+ CD_CLIPAREA,
253
+ CD_CLIPPOLYGON,
254
+ CD_CLIPREGION
255
+ };
256
+
257
+ enum { /* region combine mode */
258
+ CD_UNION,
259
+ CD_INTERSECT,
260
+ CD_DIFFERENCE,
261
+ CD_NOTINTERSECT
262
+ };
263
+
264
+ enum { /* polygon mode (begin...end) */
265
+ CD_FILL,
266
+ CD_OPEN_LINES,
267
+ CD_CLOSED_LINES,
268
+ CD_CLIP,
269
+ CD_BEZIER,
270
+ CD_REGION
271
+ };
272
+
273
+ #define CD_POLYCUSTOM 10
274
+
275
+ enum { /* fill mode */
276
+ CD_EVENODD,
277
+ CD_WINDING
278
+ };
279
+
280
+ enum { /* line join */
281
+ CD_MITER,
282
+ CD_BEVEL,
283
+ CD_ROUND
284
+ };
285
+
286
+ enum { /* line cap */
287
+ CD_CAPFLAT,
288
+ CD_CAPSQUARE,
289
+ CD_CAPROUND
290
+ };
291
+
292
+ enum { /* background opacity mode */
293
+ CD_OPAQUE,
294
+ CD_TRANSPARENT
295
+ };
296
+
297
+ enum { /* write mode */
298
+ CD_REPLACE,
299
+ CD_XOR,
300
+ CD_NOT_XOR
301
+ };
302
+
303
+ enum { /* color allocation mode (palette) */
304
+ CD_POLITE,
305
+ CD_FORCE
306
+ };
307
+
308
+ enum { /* line style */
309
+ CD_CONTINUOUS,
310
+ CD_DASHED,
311
+ CD_DOTTED,
312
+ CD_DASH_DOT,
313
+ CD_DASH_DOT_DOT,
314
+ CD_CUSTOM
315
+ };
316
+
317
+ enum { /* marker type */
318
+ CD_PLUS,
319
+ CD_STAR,
320
+ CD_CIRCLE,
321
+ CD_X,
322
+ CD_BOX,
323
+ CD_DIAMOND,
324
+ CD_HOLLOW_CIRCLE,
325
+ CD_HOLLOW_BOX,
326
+ CD_HOLLOW_DIAMOND
327
+ };
328
+
329
+ enum { /* hatch type */
330
+ CD_HORIZONTAL,
331
+ CD_VERTICAL,
332
+ CD_FDIAGONAL,
333
+ CD_BDIAGONAL,
334
+ CD_CROSS,
335
+ CD_DIAGCROSS
336
+ };
337
+
338
+ enum { /* interior style */
339
+ CD_SOLID,
340
+ CD_HATCH,
341
+ CD_STIPPLE,
342
+ CD_PATTERN,
343
+ CD_HOLLOW
344
+ };
345
+
346
+ enum { /* text alignment */
347
+ CD_NORTH,
348
+ CD_SOUTH,
349
+ CD_EAST,
350
+ CD_WEST,
351
+ CD_NORTH_EAST,
352
+ CD_NORTH_WEST,
353
+ CD_SOUTH_EAST,
354
+ CD_SOUTH_WEST,
355
+ CD_CENTER,
356
+ CD_BASE_LEFT,
357
+ CD_BASE_CENTER,
358
+ CD_BASE_RIGHT
359
+ };
360
+
361
+ enum { /* style */
362
+ CD_PLAIN = 0,
363
+ CD_BOLD = 1,
364
+ CD_ITALIC = 2,
365
+ CD_UNDERLINE = 4,
366
+ CD_STRIKEOUT = 8
367
+ };
368
+
369
+ #define CD_BOLD_ITALIC (CD_BOLD|CD_ITALIC) /* compatibility name */
370
+
371
+ enum { /* some font sizes */
372
+ CD_SMALL = 8,
373
+ CD_STANDARD = 12,
374
+ CD_LARGE = 18
375
+ };
376
+
377
+ /* Canvas Capabilities */
378
+ #define CD_CAP_NONE 0x00000000
379
+ #define CD_CAP_FLUSH 0x00000001
380
+ #define CD_CAP_CLEAR 0x00000002
381
+ #define CD_CAP_PLAY 0x00000004
382
+ #define CD_CAP_YAXIS 0x00000008
383
+ #define CD_CAP_CLIPAREA 0x00000010
384
+ #define CD_CAP_CLIPPOLY 0x00000020
385
+ #define CD_CAP_REGION 0x00000040
386
+ #define CD_CAP_RECT 0x00000080
387
+ #define CD_CAP_CHORD 0x00000100
388
+ #define CD_CAP_IMAGERGB 0x00000200
389
+ #define CD_CAP_IMAGERGBA 0x00000400
390
+ #define CD_CAP_IMAGEMAP 0x00000800
391
+ #define CD_CAP_GETIMAGERGB 0x00001000
392
+ #define CD_CAP_IMAGESRV 0x00002000
393
+ #define CD_CAP_BACKGROUND 0x00004000
394
+ #define CD_CAP_BACKOPACITY 0x00008000
395
+ #define CD_CAP_WRITEMODE 0x00010000
396
+ #define CD_CAP_LINESTYLE 0x00020000
397
+ #define CD_CAP_LINEWITH 0x00040000
398
+ #define CD_CAP_FPRIMTIVES 0x00080000
399
+ #define CD_CAP_HATCH 0x00100000
400
+ #define CD_CAP_STIPPLE 0x00200000
401
+ #define CD_CAP_PATTERN 0x00400000
402
+ #define CD_CAP_FONT 0x00800000
403
+ #define CD_CAP_FONTDIM 0x01000000
404
+ #define CD_CAP_TEXTSIZE 0x02000000
405
+ #define CD_CAP_TEXTORIENTATION 0x04000000
406
+ #define CD_CAP_PALETTE 0x08000000
407
+ #define CD_CAP_LINECAP 0x10000000
408
+ #define CD_CAP_LINEJOIN 0x20000000
409
+ #define CD_CAP_ALL 0xFFFFFFFF
410
+
411
+ /* cdPlay definitions */
412
+ #define CD_SIZECB 0 /* size callback */
413
+ typedef int(*cdSizeCB)(cdCanvas *canvas, int w, int h, double w_mm, double h_mm);
414
+ #define CD_ABORT 1
415
+ #define CD_CONTINUE 0
416
+
417
+ /* simulation flags */
418
+ #define CD_SIM_NONE 0x0000
419
+ #define CD_SIM_LINE 0x0001
420
+ #define CD_SIM_RECT 0x0002
421
+ #define CD_SIM_BOX 0x0004
422
+ #define CD_SIM_ARC 0x0008
423
+ #define CD_SIM_SECTOR 0x0010
424
+ #define CD_SIM_CHORD 0x0020
425
+ #define CD_SIM_POLYLINE 0x0040
426
+ #define CD_SIM_POLYGON 0x0080
427
+ #define CD_SIM_TEXT 0x0100
428
+ #define CD_SIM_ALL 0xFFFF
429
+
430
+ #define CD_SIM_LINES (CD_SIM_LINE | CD_SIM_RECT | CD_SIM_ARC | CD_SIM_POLYLINE)
431
+ #define CD_SIM_FILLS (CD_SIM_BOX | CD_SIM_SECTOR | CD_SIM_CHORD | CD_SIM_POLYGON)
432
+
433
+ /* some predefined colors for convenience */
434
+ #define CD_RED 0xFF0000L /* 255, 0, 0 */
435
+ #define CD_DARK_RED 0x800000L /* 128, 0, 0 */
436
+ #define CD_GREEN 0x00FF00L /* 0,255, 0 */
437
+ #define CD_DARK_GREEN 0x008000L /* 0,128, 0 */
438
+ #define CD_BLUE 0x0000FFL /* 0, 0,255 */
439
+ #define CD_DARK_BLUE 0x000080L /* 0, 0,128 */
440
+
441
+ #define CD_YELLOW 0xFFFF00L /* 255,255, 0 */
442
+ #define CD_DARK_YELLOW 0x808000L /* 128,128, 0 */
443
+ #define CD_MAGENTA 0xFF00FFL /* 255, 0,255 */
444
+ #define CD_DARK_MAGENTA 0x800080L /* 128, 0,128 */
445
+ #define CD_CYAN 0x00FFFFL /* 0,255,255 */
446
+ #define CD_DARK_CYAN 0x008080L /* 0,128,128 */
447
+
448
+ #define CD_WHITE 0xFFFFFFL /* 255,255,255 */
449
+ #define CD_BLACK 0x000000L /* 0, 0, 0 */
450
+
451
+ #define CD_DARK_GRAY 0x808080L /* 128,128,128 */
452
+ #define CD_GRAY 0xC0C0C0L /* 192,192,192 */
453
+
454
+ /* some usefull conversion factors */
455
+ #define CD_MM2PT 2.834645669 /* milimeters to points (pt = CD_MM2PT * mm) */
456
+ #define CD_RAD2DEG 57.295779513 /* radians to degrees (deg = CD_RAD2DEG * rad) */
457
+ #define CD_DEG2RAD 0.01745329252 /* degrees to radians (rad = CD_DEG2RAD * deg) */
458
+
459
+
460
+ #ifdef __cplusplus
461
+ }
462
+ #endif
463
+
464
+
465
+ #ifndef CD_NO_OLD_INTERFACE
466
+ #include "cd_old.h"
467
+ #endif
468
+
469
+
470
+ /******************************************************************************
471
+ Copyright (C) 1994-2008 Tecgraf, PUC-Rio.
472
+
473
+ Permission is hereby granted, free of charge, to any person obtaining
474
+ a copy of this software and associated documentation files (the
475
+ "Software"), to deal in the Software without restriction, including
476
+ without limitation the rights to use, copy, modify, merge, publish,
477
+ distribute, sublicense, and/or sell copies of the Software, and to
478
+ permit persons to whom the Software is furnished to do so, subject to
479
+ the following conditions:
480
+
481
+ The above copyright notice and this permission notice shall be
482
+ included in all copies or substantial portions of the Software.
483
+
484
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
485
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
486
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
487
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
488
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
489
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
490
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
491
+ ******************************************************************************/
492
+
493
+ #endif /* ifndef CD_H */
494
+