1 | /* GDK - The GIMP Drawing Kit |
2 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library; if not, write to the |
16 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | * Boston, MA 02111-1307, USA. |
18 | */ |
19 | |
20 | /* |
21 | * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS |
22 | * file for a list of people on the GTK+ Team. See the ChangeLog |
23 | * files for a list of changes. These files are distributed with |
24 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
25 | */ |
26 | |
27 | #ifndef __GDK_DRAWABLE_H__ |
28 | #define __GDK_DRAWABLE_H__ |
29 | |
30 | #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION) |
31 | #error "Only <gdk/gdk.h> can be included directly." |
32 | #endif |
33 | |
34 | #include <gdk/gdktypes.h> |
35 | #include <gdk/gdkgc.h> |
36 | #include <gdk/gdkrgb.h> |
37 | #include <gdk-pixbuf/gdk-pixbuf.h> |
38 | |
39 | #include <cairo.h> |
40 | |
41 | G_BEGIN_DECLS |
42 | |
43 | typedef struct _GdkDrawableClass GdkDrawableClass; |
44 | typedef struct _GdkTrapezoid GdkTrapezoid; |
45 | |
46 | #define GDK_TYPE_DRAWABLE (gdk_drawable_get_type ()) |
47 | #define GDK_DRAWABLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE, GdkDrawable)) |
48 | #define GDK_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE, GdkDrawableClass)) |
49 | #define GDK_IS_DRAWABLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE)) |
50 | #define GDK_IS_DRAWABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWABLE)) |
51 | #define GDK_DRAWABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWABLE, GdkDrawableClass)) |
52 | |
53 | struct _GdkDrawable |
54 | { |
55 | GObject parent_instance; |
56 | }; |
57 | |
58 | struct _GdkDrawableClass |
59 | { |
60 | GObjectClass parent_class; |
61 | |
62 | GdkGC *(*create_gc) (GdkDrawable *drawable, |
63 | GdkGCValues *values, |
64 | GdkGCValuesMask mask); |
65 | void (*draw_rectangle) (GdkDrawable *drawable, |
66 | GdkGC *gc, |
67 | gboolean filled, |
68 | gint x, |
69 | gint y, |
70 | gint width, |
71 | gint height); |
72 | void (*draw_arc) (GdkDrawable *drawable, |
73 | GdkGC *gc, |
74 | gboolean filled, |
75 | gint x, |
76 | gint y, |
77 | gint width, |
78 | gint height, |
79 | gint angle1, |
80 | gint angle2); |
81 | void (*draw_polygon) (GdkDrawable *drawable, |
82 | GdkGC *gc, |
83 | gboolean filled, |
84 | GdkPoint *points, |
85 | gint npoints); |
86 | void (*draw_text) (GdkDrawable *drawable, |
87 | GdkFont *font, |
88 | GdkGC *gc, |
89 | gint x, |
90 | gint y, |
91 | const gchar *text, |
92 | gint text_length); |
93 | void (*draw_text_wc) (GdkDrawable *drawable, |
94 | GdkFont *font, |
95 | GdkGC *gc, |
96 | gint x, |
97 | gint y, |
98 | const GdkWChar *text, |
99 | gint text_length); |
100 | void (*draw_drawable) (GdkDrawable *drawable, |
101 | GdkGC *gc, |
102 | GdkDrawable *src, |
103 | gint xsrc, |
104 | gint ysrc, |
105 | gint xdest, |
106 | gint ydest, |
107 | gint width, |
108 | gint height); |
109 | void (*draw_points) (GdkDrawable *drawable, |
110 | GdkGC *gc, |
111 | GdkPoint *points, |
112 | gint npoints); |
113 | void (*draw_segments) (GdkDrawable *drawable, |
114 | GdkGC *gc, |
115 | GdkSegment *segs, |
116 | gint nsegs); |
117 | void (*draw_lines) (GdkDrawable *drawable, |
118 | GdkGC *gc, |
119 | GdkPoint *points, |
120 | gint npoints); |
121 | |
122 | void (*draw_glyphs) (GdkDrawable *drawable, |
123 | GdkGC *gc, |
124 | PangoFont *font, |
125 | gint x, |
126 | gint y, |
127 | PangoGlyphString *glyphs); |
128 | |
129 | void (*draw_image) (GdkDrawable *drawable, |
130 | GdkGC *gc, |
131 | GdkImage *image, |
132 | gint xsrc, |
133 | gint ysrc, |
134 | gint xdest, |
135 | gint ydest, |
136 | gint width, |
137 | gint height); |
138 | |
139 | gint (*get_depth) (GdkDrawable *drawable); |
140 | void (*get_size) (GdkDrawable *drawable, |
141 | gint *width, |
142 | gint *height); |
143 | |
144 | void (*set_colormap) (GdkDrawable *drawable, |
145 | GdkColormap *cmap); |
146 | |
147 | GdkColormap* (*get_colormap) (GdkDrawable *drawable); |
148 | GdkVisual* (*get_visual) (GdkDrawable *drawable); |
149 | GdkScreen* (*get_screen) (GdkDrawable *drawable); |
150 | |
151 | GdkImage* (*get_image) (GdkDrawable *drawable, |
152 | gint x, |
153 | gint y, |
154 | gint width, |
155 | gint height); |
156 | |
157 | GdkRegion* (*get_clip_region) (GdkDrawable *drawable); |
158 | GdkRegion* (*get_visible_region) (GdkDrawable *drawable); |
159 | |
160 | GdkDrawable* (*get_composite_drawable) (GdkDrawable *drawable, |
161 | gint x, |
162 | gint y, |
163 | gint width, |
164 | gint height, |
165 | gint *composite_x_offset, |
166 | gint *composite_y_offset); |
167 | |
168 | void (*draw_pixbuf) (GdkDrawable *drawable, |
169 | GdkGC *gc, |
170 | GdkPixbuf *pixbuf, |
171 | gint src_x, |
172 | gint src_y, |
173 | gint dest_x, |
174 | gint dest_y, |
175 | gint width, |
176 | gint height, |
177 | GdkRgbDither dither, |
178 | gint x_dither, |
179 | gint y_dither); |
180 | GdkImage* (*_copy_to_image) (GdkDrawable *drawable, |
181 | GdkImage *image, |
182 | gint src_x, |
183 | gint src_y, |
184 | gint dest_x, |
185 | gint dest_y, |
186 | gint width, |
187 | gint height); |
188 | |
189 | void (*draw_glyphs_transformed) (GdkDrawable *drawable, |
190 | GdkGC *gc, |
191 | PangoMatrix *matrix, |
192 | PangoFont *font, |
193 | gint x, |
194 | gint y, |
195 | PangoGlyphString *glyphs); |
196 | void (*draw_trapezoids) (GdkDrawable *drawable, |
197 | GdkGC *gc, |
198 | GdkTrapezoid *trapezoids, |
199 | gint n_trapezoids); |
200 | |
201 | cairo_surface_t *(*ref_cairo_surface) (GdkDrawable *drawable); |
202 | |
203 | GdkDrawable *(*get_source_drawable) (GdkDrawable *drawable); |
204 | |
205 | void (*set_cairo_clip) (GdkDrawable *drawable, |
206 | cairo_t *cr); |
207 | |
208 | cairo_surface_t * (*create_cairo_surface) (GdkDrawable *drawable, |
209 | int width, |
210 | int height); |
211 | |
212 | void (*draw_drawable_with_src) (GdkDrawable *drawable, |
213 | GdkGC *gc, |
214 | GdkDrawable *src, |
215 | gint xsrc, |
216 | gint ysrc, |
217 | gint xdest, |
218 | gint ydest, |
219 | gint width, |
220 | gint height, |
221 | GdkDrawable *original_src); |
222 | |
223 | /* Padding for future expansion */ |
224 | void (*_gdk_reserved7) (void); |
225 | void (*_gdk_reserved9) (void); |
226 | void (*_gdk_reserved10) (void); |
227 | void (*_gdk_reserved11) (void); |
228 | void (*_gdk_reserved12) (void); |
229 | void (*_gdk_reserved13) (void); |
230 | void (*_gdk_reserved14) (void); |
231 | void (*_gdk_reserved15) (void); |
232 | }; |
233 | |
234 | struct _GdkTrapezoid |
235 | { |
236 | double y1, x11, x21, y2, x12, x22; |
237 | }; |
238 | |
239 | GType gdk_drawable_get_type (void) G_GNUC_CONST; |
240 | |
241 | /* Manipulation of drawables |
242 | */ |
243 | |
244 | #ifndef GDK_DISABLE_DEPRECATED |
245 | void gdk_drawable_set_data (GdkDrawable *drawable, |
246 | const gchar *key, |
247 | gpointer data, |
248 | GDestroyNotify destroy_func); |
249 | gpointer gdk_drawable_get_data (GdkDrawable *drawable, |
250 | const gchar *key); |
251 | #endif /* GDK_DISABLE_DEPRECATED */ |
252 | |
253 | void gdk_drawable_set_colormap (GdkDrawable *drawable, |
254 | GdkColormap *colormap); |
255 | GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable); |
256 | gint gdk_drawable_get_depth (GdkDrawable *drawable); |
257 | |
258 | #if !defined (GDK_DISABLE_DEPRECATED) |
259 | void gdk_drawable_get_size (GdkDrawable *drawable, |
260 | gint *width, |
261 | gint *height); |
262 | GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable); |
263 | GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable); |
264 | GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable); |
265 | #endif /* GDK_DISABLE_DEPRECATED */ |
266 | |
267 | #ifndef GDK_DISABLE_DEPRECATED |
268 | GdkDrawable* gdk_drawable_ref (GdkDrawable *drawable); |
269 | void gdk_drawable_unref (GdkDrawable *drawable); |
270 | #endif /* GDK_DISABLE_DEPRECATED */ |
271 | |
272 | /* Drawing |
273 | */ |
274 | #ifndef GDK_DISABLE_DEPRECATED |
275 | void gdk_draw_point (GdkDrawable *drawable, |
276 | GdkGC *gc, |
277 | gint x, |
278 | gint y); |
279 | void gdk_draw_line (GdkDrawable *drawable, |
280 | GdkGC *gc, |
281 | gint x1_, |
282 | gint y1_, |
283 | gint x2_, |
284 | gint y2_); |
285 | void gdk_draw_rectangle (GdkDrawable *drawable, |
286 | GdkGC *gc, |
287 | gboolean filled, |
288 | gint x, |
289 | gint y, |
290 | gint width, |
291 | gint height); |
292 | void gdk_draw_arc (GdkDrawable *drawable, |
293 | GdkGC *gc, |
294 | gboolean filled, |
295 | gint x, |
296 | gint y, |
297 | gint width, |
298 | gint height, |
299 | gint angle1, |
300 | gint angle2); |
301 | void gdk_draw_polygon (GdkDrawable *drawable, |
302 | GdkGC *gc, |
303 | gboolean filled, |
304 | const GdkPoint *points, |
305 | gint n_points); |
306 | void gdk_draw_string (GdkDrawable *drawable, |
307 | GdkFont *font, |
308 | GdkGC *gc, |
309 | gint x, |
310 | gint y, |
311 | const gchar *string); |
312 | void gdk_draw_text (GdkDrawable *drawable, |
313 | GdkFont *font, |
314 | GdkGC *gc, |
315 | gint x, |
316 | gint y, |
317 | const gchar *text, |
318 | gint text_length); |
319 | void gdk_draw_text_wc (GdkDrawable *drawable, |
320 | GdkFont *font, |
321 | GdkGC *gc, |
322 | gint x, |
323 | gint y, |
324 | const GdkWChar *text, |
325 | gint text_length); |
326 | void gdk_draw_drawable (GdkDrawable *drawable, |
327 | GdkGC *gc, |
328 | GdkDrawable *src, |
329 | gint xsrc, |
330 | gint ysrc, |
331 | gint xdest, |
332 | gint ydest, |
333 | gint width, |
334 | gint height); |
335 | void gdk_draw_image (GdkDrawable *drawable, |
336 | GdkGC *gc, |
337 | GdkImage *image, |
338 | gint xsrc, |
339 | gint ysrc, |
340 | gint xdest, |
341 | gint ydest, |
342 | gint width, |
343 | gint height); |
344 | void gdk_draw_points (GdkDrawable *drawable, |
345 | GdkGC *gc, |
346 | const GdkPoint *points, |
347 | gint n_points); |
348 | void gdk_draw_segments (GdkDrawable *drawable, |
349 | GdkGC *gc, |
350 | const GdkSegment *segs, |
351 | gint n_segs); |
352 | void gdk_draw_lines (GdkDrawable *drawable, |
353 | GdkGC *gc, |
354 | const GdkPoint *points, |
355 | gint n_points); |
356 | void gdk_draw_pixbuf (GdkDrawable *drawable, |
357 | GdkGC *gc, |
358 | const GdkPixbuf *pixbuf, |
359 | gint src_x, |
360 | gint src_y, |
361 | gint dest_x, |
362 | gint dest_y, |
363 | gint width, |
364 | gint height, |
365 | GdkRgbDither dither, |
366 | gint x_dither, |
367 | gint y_dither); |
368 | |
369 | void gdk_draw_glyphs (GdkDrawable *drawable, |
370 | GdkGC *gc, |
371 | PangoFont *font, |
372 | gint x, |
373 | gint y, |
374 | PangoGlyphString *glyphs); |
375 | void gdk_draw_layout_line (GdkDrawable *drawable, |
376 | GdkGC *gc, |
377 | gint x, |
378 | gint y, |
379 | PangoLayoutLine *line); |
380 | void gdk_draw_layout (GdkDrawable *drawable, |
381 | GdkGC *gc, |
382 | gint x, |
383 | gint y, |
384 | PangoLayout *layout); |
385 | |
386 | void gdk_draw_layout_line_with_colors (GdkDrawable *drawable, |
387 | GdkGC *gc, |
388 | gint x, |
389 | gint y, |
390 | PangoLayoutLine *line, |
391 | const GdkColor *foreground, |
392 | const GdkColor *background); |
393 | void gdk_draw_layout_with_colors (GdkDrawable *drawable, |
394 | GdkGC *gc, |
395 | gint x, |
396 | gint y, |
397 | PangoLayout *layout, |
398 | const GdkColor *foreground, |
399 | const GdkColor *background); |
400 | |
401 | void gdk_draw_glyphs_transformed (GdkDrawable *drawable, |
402 | GdkGC *gc, |
403 | const PangoMatrix *matrix, |
404 | PangoFont *font, |
405 | gint x, |
406 | gint y, |
407 | PangoGlyphString *glyphs); |
408 | void gdk_draw_trapezoids (GdkDrawable *drawable, |
409 | GdkGC *gc, |
410 | const GdkTrapezoid *trapezoids, |
411 | gint n_trapezoids); |
412 | |
413 | #define gdk_draw_pixmap gdk_draw_drawable |
414 | #define gdk_draw_bitmap gdk_draw_drawable |
415 | |
416 | GdkImage* gdk_drawable_get_image (GdkDrawable *drawable, |
417 | gint x, |
418 | gint y, |
419 | gint width, |
420 | gint height); |
421 | GdkImage *gdk_drawable_copy_to_image (GdkDrawable *drawable, |
422 | GdkImage *image, |
423 | gint src_x, |
424 | gint src_y, |
425 | gint dest_x, |
426 | gint dest_y, |
427 | gint width, |
428 | gint height); |
429 | #endif /* GDK_DISABLE_DEPRECATED */ |
430 | |
431 | GdkRegion *gdk_drawable_get_clip_region (GdkDrawable *drawable); |
432 | GdkRegion *gdk_drawable_get_visible_region (GdkDrawable *drawable); |
433 | |
434 | G_END_DECLS |
435 | |
436 | #endif /* __GDK_DRAWABLE_H__ */ |
437 | |