]> Pileus Git - ~andy/gtk/blob - gdk/gdkdrawable.h
Annotate gdk_display_manager_list_displays return value
[~andy/gtk] / gdk / gdkdrawable.h
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 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
28 #error "Only <gdk/gdk.h> can be included directly."
29 #endif
30
31 #ifndef __GDK_DRAWABLE_H__
32 #define __GDK_DRAWABLE_H__
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_drawable)  (GdkDrawable  *drawable,
87                           GdkGC        *gc,
88                           GdkDrawable  *src,
89                           gint          xsrc,
90                           gint          ysrc,
91                           gint          xdest,
92                           gint          ydest,
93                           gint          width,
94                           gint          height);
95   void (*draw_points)    (GdkDrawable  *drawable,
96                           GdkGC        *gc,
97                           GdkPoint     *points,
98                           gint          npoints);
99   void (*draw_segments)  (GdkDrawable  *drawable,
100                           GdkGC        *gc,
101                           GdkSegment   *segs,
102                           gint          nsegs);
103   void (*draw_lines)     (GdkDrawable  *drawable,
104                           GdkGC        *gc,
105                           GdkPoint     *points,
106                           gint          npoints);
107
108   void (*draw_glyphs)    (GdkDrawable      *drawable,
109                           GdkGC            *gc,
110                           PangoFont        *font,
111                           gint              x,
112                           gint              y,
113                           PangoGlyphString *glyphs);
114
115   void (*draw_image)     (GdkDrawable *drawable,
116                           GdkGC       *gc,
117                           GdkImage    *image,
118                           gint         xsrc,
119                           gint         ysrc,
120                           gint         xdest,
121                           gint         ydest,
122                           gint         width,
123                           gint         height);
124   
125   gint (*get_depth)      (GdkDrawable  *drawable);
126   void (*get_size)       (GdkDrawable  *drawable,
127                           gint         *width,
128                           gint         *height);
129
130   void (*set_colormap)   (GdkDrawable  *drawable,
131                           GdkColormap  *cmap);
132
133   GdkColormap* (*get_colormap)  (GdkDrawable  *drawable);
134   GdkVisual*   (*get_visual)    (GdkDrawable  *drawable);
135   GdkScreen*   (*get_screen)    (GdkDrawable  *drawable);
136
137   GdkImage*    (*get_image)  (GdkDrawable  *drawable,
138                               gint          x,
139                               gint          y,
140                               gint          width,
141                               gint          height);
142
143   cairo_region_t*   (*get_clip_region)    (GdkDrawable  *drawable);
144   cairo_region_t*   (*get_visible_region) (GdkDrawable  *drawable);
145
146   GdkDrawable* (*get_composite_drawable) (GdkDrawable *drawable,
147                                           gint         x,
148                                           gint         y,
149                                           gint         width,
150                                           gint         height,
151                                           gint        *composite_x_offset,
152                                           gint        *composite_y_offset);
153
154   void         (*draw_pixbuf) (GdkDrawable *drawable,
155                                GdkGC       *gc,
156                                GdkPixbuf   *pixbuf,
157                                gint         src_x,
158                                gint         src_y,
159                                gint         dest_x,
160                                gint         dest_y,
161                                gint         width,
162                                gint         height,
163                                GdkRgbDither dither,
164                                gint         x_dither,
165                                gint         y_dither);
166   GdkImage*    (*_copy_to_image) (GdkDrawable    *drawable,
167                                   GdkImage       *image,
168                                   gint            src_x,
169                                   gint            src_y,
170                                   gint            dest_x,
171                                   gint            dest_y,
172                                   gint            width,
173                                   gint            height);
174   
175   void (*draw_glyphs_transformed) (GdkDrawable      *drawable,
176                                    GdkGC            *gc,
177                                    PangoMatrix      *matrix,
178                                    PangoFont        *font,
179                                    gint              x,
180                                    gint              y,
181                                    PangoGlyphString *glyphs);
182   void (*draw_trapezoids)         (GdkDrawable      *drawable,
183                                    GdkGC            *gc,
184                                    GdkTrapezoid     *trapezoids,
185                                    gint              n_trapezoids);
186
187   cairo_surface_t *(*ref_cairo_surface) (GdkDrawable *drawable);
188
189   GdkDrawable *(*get_source_drawable) (GdkDrawable *drawable);
190
191   void         (*set_cairo_clip)      (GdkDrawable *drawable,
192                                        cairo_t *cr);
193
194   cairo_surface_t * (*create_cairo_surface) (GdkDrawable *drawable,
195                                              int width,
196                                              int height);
197
198   void (*draw_drawable_with_src)  (GdkDrawable  *drawable,
199                                    GdkGC               *gc,
200                                    GdkDrawable  *src,
201                                    gint         xsrc,
202                                    gint         ysrc,
203                                    gint         xdest,
204                                    gint         ydest,
205                                    gint         width,
206                                    gint         height,
207                                    GdkDrawable  *original_src);
208
209   /* Padding for future expansion */
210   void         (*_gdk_reserved7)  (void);
211   void         (*_gdk_reserved9)  (void);
212   void         (*_gdk_reserved10) (void);
213   void         (*_gdk_reserved11) (void);
214   void         (*_gdk_reserved12) (void);
215   void         (*_gdk_reserved13) (void);
216   void         (*_gdk_reserved14) (void);
217   void         (*_gdk_reserved15) (void);
218 };
219
220 struct _GdkTrapezoid
221 {
222   double y1, x11, x21, y2, x12, x22;
223 };
224
225 GType           gdk_drawable_get_type     (void) G_GNUC_CONST;
226
227 /* Manipulation of drawables
228  */
229 void            gdk_drawable_get_size     (GdkDrawable    *drawable,
230                                            gint           *width,
231                                            gint           *height);
232 void            gdk_drawable_set_colormap (GdkDrawable    *drawable,
233                                            GdkColormap    *colormap);
234 GdkColormap*    gdk_drawable_get_colormap (GdkDrawable    *drawable);
235 GdkVisual*      gdk_drawable_get_visual   (GdkDrawable    *drawable);
236 gint            gdk_drawable_get_depth    (GdkDrawable    *drawable);
237 GdkScreen*      gdk_drawable_get_screen   (GdkDrawable    *drawable);
238 GdkDisplay*     gdk_drawable_get_display  (GdkDrawable    *drawable);
239
240 /* Drawing
241  */
242 void gdk_draw_point     (GdkDrawable      *drawable,
243                          GdkGC            *gc,
244                          gint              x,
245                          gint              y);
246 void gdk_draw_line      (GdkDrawable      *drawable,
247                          GdkGC            *gc,
248                          gint              x1_,
249                          gint              y1_,
250                          gint              x2_,
251                          gint              y2_);
252 void gdk_draw_rectangle (GdkDrawable      *drawable,
253                          GdkGC            *gc,
254                          gboolean          filled,
255                          gint              x,
256                          gint              y,
257                          gint              width,
258                          gint              height);
259 void gdk_draw_arc       (GdkDrawable      *drawable,
260                          GdkGC            *gc,
261                          gboolean          filled,
262                          gint              x,
263                          gint              y,
264                          gint              width,
265                          gint              height,
266                          gint              angle1,
267                          gint              angle2);
268 void gdk_draw_polygon   (GdkDrawable      *drawable,
269                          GdkGC            *gc,
270                          gboolean          filled,
271                          const GdkPoint   *points,
272                          gint              n_points);
273 void gdk_draw_drawable  (GdkDrawable      *drawable,
274                          GdkGC            *gc,
275                          GdkDrawable      *src,
276                          gint              xsrc,
277                          gint              ysrc,
278                          gint              xdest,
279                          gint              ydest,
280                          gint              width,
281                          gint              height);
282 void gdk_draw_image     (GdkDrawable      *drawable,
283                          GdkGC            *gc,
284                          GdkImage         *image,
285                          gint              xsrc,
286                          gint              ysrc,
287                          gint              xdest,
288                          gint              ydest,
289                          gint              width,
290                          gint              height);
291 void gdk_draw_points    (GdkDrawable      *drawable,
292                          GdkGC            *gc,
293                          const GdkPoint   *points,
294                          gint              n_points);
295 void gdk_draw_segments  (GdkDrawable      *drawable,
296                          GdkGC            *gc,
297                          const GdkSegment *segs,
298                          gint              n_segs);
299 void gdk_draw_lines     (GdkDrawable      *drawable,
300                          GdkGC            *gc,
301                          const GdkPoint   *points,
302                          gint              n_points);
303 void gdk_draw_pixbuf    (GdkDrawable      *drawable,
304                          GdkGC            *gc,
305                          const GdkPixbuf  *pixbuf,
306                          gint              src_x,
307                          gint              src_y,
308                          gint              dest_x,
309                          gint              dest_y,
310                          gint              width,
311                          gint              height,
312                          GdkRgbDither      dither,
313                          gint              x_dither,
314                          gint              y_dither);
315
316 void gdk_draw_glyphs      (GdkDrawable      *drawable,
317                            GdkGC            *gc,
318                            PangoFont        *font,
319                            gint              x,
320                            gint              y,
321                            PangoGlyphString *glyphs);
322 void gdk_draw_layout_line (GdkDrawable      *drawable,
323                            GdkGC            *gc,
324                            gint              x,
325                            gint              y,
326                            PangoLayoutLine  *line);
327 void gdk_draw_layout      (GdkDrawable      *drawable,
328                            GdkGC            *gc,
329                            gint              x,
330                            gint              y,
331                            PangoLayout      *layout);
332
333 void gdk_draw_layout_line_with_colors (GdkDrawable     *drawable,
334                                        GdkGC           *gc,
335                                        gint             x,
336                                        gint             y,
337                                        PangoLayoutLine *line,
338                                        const GdkColor  *foreground,
339                                        const GdkColor  *background);
340 void gdk_draw_layout_with_colors      (GdkDrawable     *drawable,
341                                        GdkGC           *gc,
342                                        gint             x,
343                                        gint             y,
344                                        PangoLayout     *layout,
345                                        const GdkColor  *foreground,
346                                        const GdkColor  *background);
347
348 void gdk_draw_glyphs_transformed (GdkDrawable        *drawable,
349                                   GdkGC              *gc,
350                                   const PangoMatrix  *matrix,
351                                   PangoFont          *font,
352                                   gint                x,
353                                   gint                y,
354                                   PangoGlyphString   *glyphs);
355 void gdk_draw_trapezoids         (GdkDrawable        *drawable,
356                                   GdkGC              *gc,
357                                   const GdkTrapezoid *trapezoids,
358                                   gint                n_trapezoids);
359
360
361 GdkImage* gdk_drawable_get_image      (GdkDrawable *drawable,
362                                        gint         x,
363                                        gint         y,
364                                        gint         width,
365                                        gint         height);
366 GdkImage *gdk_drawable_copy_to_image (GdkDrawable  *drawable,
367                                       GdkImage     *image,
368                                       gint          src_x,
369                                       gint          src_y,
370                                       gint          dest_x,
371                                       gint          dest_y,
372                                       gint          width,
373                                       gint          height);
374
375 cairo_region_t *gdk_drawable_get_clip_region    (GdkDrawable *drawable);
376 cairo_region_t *gdk_drawable_get_visible_region (GdkDrawable *drawable);
377
378 G_END_DECLS
379
380 #endif /* __GDK_DRAWABLE_H__ */