bdd09c992034960525f14107cb8a4586ee1bf387
[cl-gtk2.git] / gdk / gdk.drawing-primitives.lisp
1 (in-package :gdk)
2
3 (defcfun gdk-drawable-get-size :void
4   (drawable (g-object drawable))
5   (width (:pointer :int))
6   (height (:pointer :int)))
7
8 (defun drawable-get-size (drawable)
9   (with-foreign-objects ((x :int)
10                          (y :int))
11     (gdk-drawable-get-size drawable x y)
12     (values (mem-ref x :int) (mem-ref y :int))))
13
14 (export 'drawable-get-size)
15
16 (defcfun (draw-point "gdk_draw_point") :void
17   (drawable (g-object drawable))
18   (gc (g-object graphics-context))
19   (x :int)
20   (y :int))
21
22 (export 'draw-point)
23
24 (defcfun gdk-draw-points :void
25   (drawable (g-object drawable))
26   (gc (g-object graphics-context))
27   (points :pointer)
28   (n :int))
29
30 (defun draw-points (drawable gc points)
31   (with-foreign-boxed-array (n points-ptr point points)
32     (gdk-draw-points drawable gc points-ptr n)))
33
34 (export 'draw-points)
35
36 (defcfun (draw-line "gdk_draw_line") :void
37   (drawable (g-object drawable))
38   (gc (g-object graphics-context))
39   (x1 :int)
40   (y1 :int)
41   (x2 :int)
42   (y2 :int))
43
44 (export 'draw-line)
45
46 (defcfun gdk-draw-lines :void
47   (drawable (g-object drawable))
48   (gc (g-object graphics-context))
49   (points :pointer)
50   (n :int))
51
52 (defun draw-lines (drawable gc points)
53   (with-foreign-boxed-array (n points-ptr point points)
54     (gdk-draw-lines drawable gc points-ptr n)))
55
56 (export 'draw-lines)
57
58 (defcfun (draw-pixbuf "gdk_draw_pixbuf") :void
59   (drawable (g-object drawable))
60   (gc (g-object graphics-context))
61   (pixbuf (g-object pixbuf))
62   (src-x :int)
63   (src-y :int)
64   (dest-x :int)
65   (dest-y :int)
66   (width :int)
67   (height :int)
68   (dither rgb-dither)
69   (x-dither :int)
70   (y-dither :int))
71
72 (export 'draw-pixbuf)
73
74 (defcfun gdk-draw-segments :void
75   (drawable (g-object drawable))
76   (gc (g-object graphics-context))
77   (segments :pointer)
78   (n-segments :int))
79
80 (defun draw-segments (drawable gc segments)
81   (with-foreign-boxed-array (n segments-ptr segment segments)
82     (gdk-draw-segments drawable gc segments-ptr n)))
83
84 (export 'draw-segments)
85
86 (defcfun (draw-rectangle "gdk_draw_rectangle") :void
87   (drawable (g-object drawable))
88   (gc (g-object graphics-context))
89   (filled :boolean)
90   (x :int)
91   (y :int)
92   (width :int)
93   (height :int))
94
95 (defcfun (draw-arc "gdk_draw_arc") :void
96   (drawable (g-object drawable))
97   (gc (g-object graphics-context))
98   (filled :boolean)
99   (x :int)
100   (y :int)
101   (width :int)
102   (height :int)
103   (angle1 :int)
104   (angle2 :int))
105
106 (export 'draw-arc)
107
108 (defcfun gdk-draw-polygon :void
109   (drawable (g-object drawable))
110   (gc (g-object graphics-context))
111   (filled :boolean)
112   (points :pointer)
113   (n-points :int))
114
115 (defun draw-polygon (drawable gc filled points)
116   (with-foreign-boxed-array (n points-ptr point points)
117     (gdk-draw-polygon drawable gc filled points-ptr n)))
118
119 (export 'draw-polygon)
120
121 (defcfun gdk-draw-trapezoids :void
122   (drawable (g-object drawable))
123   (gc (g-object graphics-context))
124   (trapezoids :pointer)
125   (n :int))
126
127 (defun draw-trapezoids (drawable gc trapezoids)
128   (with-foreign-boxed-array (n trapezoids-ptr trapezoid trapezoids)
129     (gdk-draw-trapezoids drawable gc trapezoids-ptr n)))
130
131 (export 'draw-trapezoids)
132
133 (defcfun (draw-glyphs "gdk_draw_glyphs") :void
134   (drawable (g-object drawable))
135   (gc (g-object graphics-context))
136   (font (g-object pango-font))
137   (x :int)
138   (y :int)
139   (glyphs (g-boxed-foreign pango-glyph-string)))
140
141 (export 'draw-glyphs)
142
143 (defcfun (draw-glyphs-transformed "gdk_draw_glyphs_transformed") :void
144   (drawable (g-object drawable))
145   (gc (g-object graphics-context))
146   (matrix (g-boxed-foreign pango-matrix))
147   (font (g-object pango-font))
148   (x :int)
149   (y :int))
150
151 (export 'draw-glyphs-transformed)
152
153 (defcfun (draw-layout-line "gdk_draw_layout_line") :void
154   (drawable (g-object drawable))
155   (gc (g-object graphics-context))
156   (x :int)
157   (y :int)
158   (line (g-boxed-foreign pango-layout-line)))
159
160 (export 'draw-layout-line)
161
162 (defcfun (draw-layout-line-with-colors "gdk_draw_layout_line_with_colors") :void
163   (drawable (g-object drawable))
164   (gc (g-object graphics-context))
165   (x :int)
166   (y :int)
167   (line (g-boxed-foreign pango-layout-line))
168   (foreground (g-boxed-foreign color))
169   (background (g-boxed-foreign color)))
170
171 (export 'draw-layout-line-with-colors)
172
173 (defcfun (draw-layout "gdk_draw_layout") :void
174   (drawable (g-object drawable))
175   (gc (g-object graphics-context))
176   (x :int)
177   (y :int)
178   (layout (g-object pango-layout)))
179
180 (export 'draw-layout)
181
182 (defcfun (draw-layout-with-colors "gdk_draw_layout_with_colors") :void
183   (drawable (g-object drawable))
184   (gc (g-object graphics-context))
185   (x :int)
186   (y :int)
187   (layout (g-object pango-layout))
188   (foreground (g-boxed-foreign color))
189   (background (g-boxed-foreign color)))
190
191 (export 'draw-layout-with-colors)
192
193 ;; ignored:
194 ;; void                gdk_draw_string                     (GdkDrawable *drawable,
195 ;;                                                          GdkFont *font,
196 ;;                                                          GdkGC *gc,
197 ;;                                                          gint x,
198 ;;                                                          gint y,
199 ;;                                                          const gchar *string);
200 ;; void                gdk_draw_text                       (GdkDrawable *drawable,
201 ;;                                                          GdkFont *font,
202 ;;                                                          GdkGC *gc,
203 ;;                                                          gint x,
204 ;;                                                          gint y,
205 ;;                                                          const gchar *text,
206 ;;                                                          gint text_length);
207 ;; void                gdk_draw_text_wc                    (GdkDrawable *drawable,
208 ;;                                                          GdkFont *font,
209 ;;                                                          GdkGC *gc,
210 ;;                                                          gint x,
211 ;;                                                          gint y,
212 ;;                                                          const GdkWChar *text,
213 ;;                                                          gint text_length);
214
215
216 (defcfun (draw-drawable "gdk_draw_drawable") :void
217   (drawable (g-object drawable))
218   (gc (g-object graphics-context))
219   (src (g-object drawable))
220   (x-src :int)
221   (y-src :int)
222   (x-dest :int)
223   (y-dest :int)
224   (width :int)
225   (height :int))
226
227 (export 'draw-drawable)
228
229 (defcfun (draw-image "gdk_draw_image") :void
230   (drawable (g-object drawable))
231   (gc (g-object graphics-context))
232   (image (g-object gdk-image))
233   (x-src :int)
234   (y-src :int)
235   (x-dest :int)
236   (y-dest :int)
237   (width :int)
238   (height :int))
239
240 (export 'draw-image)
241
242 (defcfun (drawable-get-image "gdk_drawable_get_image") (g-object gdk-image)
243   (drawable (g-object drawable))
244   (x :int)
245   (y :int)
246   (width :int)
247   (height :int))
248
249 (export 'drawable-get-image)
250
251 (defcfun (drawable-copy-to-image "gdk_drawable_copy_to_image") (g-object gdk-image)
252   (drawable (g-object drawable))
253   (image (g-object gdk-image))
254   (src-x :int)
255   (src-y :int)
256   (dest-x :int)
257   (dest-y :int)
258   (width :int)
259   (height :int))
260
261 (export 'drawable-copy-to-image)