Set correct GdkNativeWindow typedef on Windows
[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 ;; TODO
134 ;; void                gdk_draw_glyphs                     (GdkDrawable *drawable,
135 ;;                                                          GdkGC *gc,
136 ;;                                                          PangoFont *font,
137 ;;                                                          gint x,
138 ;;                                                          gint y,
139 ;;                                                          PangoGlyphString *glyphs);
140 ;; void                gdk_draw_glyphs_transformed         (GdkDrawable *drawable,
141 ;;                                                          GdkGC *gc,
142 ;;                                                          const PangoMatrix *matrix,
143 ;;                                                          PangoFont *font,
144 ;;                                                          gint x,
145 ;;                                                          gint y,
146 ;;                                                          PangoGlyphString *glyphs);
147 ;; void                gdk_draw_layout_line                (GdkDrawable *drawable,
148 ;;                                                          GdkGC *gc,
149 ;;                                                          gint x,
150 ;;                                                          gint y,
151 ;;                                                          PangoLayoutLine *line);
152 ;; void                gdk_draw_layout_line_with_colors    (GdkDrawable *drawable,
153 ;;                                                          GdkGC *gc,
154 ;;                                                          gint x,
155 ;;                                                          gint y,
156 ;;                                                          PangoLayoutLine *line,
157 ;;                                                          const GdkColor *foreground,
158 ;;                                                          const GdkColor *background);
159
160 (defcfun (draw-layout "gdk_draw_layout") :void
161   (drawable (g-object drawable))
162   (gc (g-object graphics-context))
163   (x :int)
164   (y :int)
165   (layout (g-object pango-layout)))
166
167 (export 'draw-layout)
168
169 (defcfun (draw-layout-with-colors "gdk_draw_layout_with_colors") :void
170   (drawable (g-object drawable))
171   (gc (g-object graphics-context))
172   (x :int)
173   (y :int)
174   (layout (g-object pango-layout))
175   (foreground (g-boxed-foreign color))
176   (background (g-boxed-foreign color)))
177
178 (export 'draw-layout-with-colors)
179
180 ;; ignored:
181 ;; void                gdk_draw_string                     (GdkDrawable *drawable,
182 ;;                                                          GdkFont *font,
183 ;;                                                          GdkGC *gc,
184 ;;                                                          gint x,
185 ;;                                                          gint y,
186 ;;                                                          const gchar *string);
187 ;; void                gdk_draw_text                       (GdkDrawable *drawable,
188 ;;                                                          GdkFont *font,
189 ;;                                                          GdkGC *gc,
190 ;;                                                          gint x,
191 ;;                                                          gint y,
192 ;;                                                          const gchar *text,
193 ;;                                                          gint text_length);
194 ;; void                gdk_draw_text_wc                    (GdkDrawable *drawable,
195 ;;                                                          GdkFont *font,
196 ;;                                                          GdkGC *gc,
197 ;;                                                          gint x,
198 ;;                                                          gint y,
199 ;;                                                          const GdkWChar *text,
200 ;;                                                          gint text_length);
201
202
203 (defcfun (draw-drawable "gdk_draw_drawable") :void
204   (drawable (g-object drawable))
205   (gc (g-object graphics-context))
206   (src (g-object drawable))
207   (x-src :int)
208   (y-src :int)
209   (x-dest :int)
210   (y-dest :int)
211   (width :int)
212   (height :int))
213
214 (export 'draw-drawable)
215
216 (defcfun (draw-image "gdk_draw_image") :void
217   (drawable (g-object drawable))
218   (gc (g-object graphics-context))
219   (image (g-object gdk-image))
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-image)
228
229 (defcfun (drawable-get-image "gdk_drawable_get_image") (g-object gdk-image)
230   (drawable (g-object drawable))
231   (x :int)
232   (y :int)
233   (width :int)
234   (height :int))
235
236 (export 'drawable-get-image)
237
238 (defcfun (drawable-copy-to-image "gdk_drawable_copy_to_image") (g-object gdk-image)
239   (drawable (g-object drawable))
240   (image (g-object gdk-image))
241   (src-x :int)
242   (src-y :int)
243   (dest-x :int)
244   (dest-y :int)
245   (width :int)
246   (height :int))
247
248 (export 'drawable-copy-to-image)