]> Pileus Git - ~andy/gtk/blob - gdk/gdkimage.h
[ Patch from Sebastian Wilhelmi, 52790 ]
[~andy/gtk] / gdk / gdkimage.h
1 #ifndef __GDK_IMAGE_H__
2 #define __GDK_IMAGE_H__
3
4 #include <gdk/gdktypes.h>
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif /* __cplusplus */
9
10 /* Types of images.
11  *   Normal: Normal X image type. These are slow as they involve passing
12  *           the entire image through the X connection each time a draw
13  *           request is required. On Win32, a bitmap.
14  *   Shared: Shared memory X image type. These are fast as the X server
15  *           and the program actually use the same piece of memory. They
16  *           should be used with care though as there is the possibility
17  *           for both the X server and the program to be reading/writing
18  *           the image simultaneously and producing undesired results.
19  *           On Win32, also a bitmap.
20  */
21 typedef enum
22 {
23   GDK_IMAGE_NORMAL,
24   GDK_IMAGE_SHARED,
25   GDK_IMAGE_FASTEST
26 } GdkImageType;
27
28 typedef struct _GdkImageClass GdkImageClass;
29
30 #define GDK_TYPE_IMAGE              (gdk_image_get_type ())
31 #define GDK_IMAGE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_IMAGE, GdkImage))
32 #define GDK_IMAGE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_IMAGE, GdkImageClass))
33 #define GDK_IS_IMAGE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_IMAGE))
34 #define GDK_IS_IMAGE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_IMAGE))
35 #define GDK_IMAGE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_IMAGE, GdkImageClass))
36
37 struct _GdkImage
38 {
39   GObject parent_instance;
40   
41   GdkImageType  type;
42   GdkVisual    *visual;     /* visual used to create the image */
43   GdkByteOrder  byte_order;
44   gint          width;
45   gint          height;
46   guint16       depth;
47   guint16       bpp;            /* bytes per pixel */
48   guint16       bpl;            /* bytes per line */
49   guint16       bits_per_pixel; /* bits per pixel */
50   gpointer      mem;
51
52   GdkColormap  *colormap;
53   
54   gpointer windowing_data;
55 };
56
57 struct _GdkImageClass
58 {
59   GObjectClass parent_class;
60 };
61
62 GType     gdk_image_get_type   (void) G_GNUC_CONST;
63
64 GdkImage*  gdk_image_new       (GdkImageType  type,
65                                 GdkVisual    *visual,
66                                 gint          width,
67                                 gint          height);
68
69 GdkImage*  gdk_image_get       (GdkDrawable  *drawable,
70                                 gint          x,
71                                 gint          y,
72                                 gint          width,
73                                 gint          height);
74
75 GdkImage * gdk_image_ref       (GdkImage     *image);
76 void       gdk_image_unref     (GdkImage     *image);
77
78 void       gdk_image_put_pixel (GdkImage     *image,
79                                 gint          x,
80                                 gint          y,
81                                 guint32       pixel);
82 guint32    gdk_image_get_pixel (GdkImage     *image,
83                                 gint          x,
84                                 gint          y);
85
86 void       gdk_image_set_colormap (GdkImage    *image,
87                                    GdkColormap *colormap);
88 GdkColormap* gdk_image_get_colormap (GdkImage    *image);
89
90
91 #ifdef GDK_ENABLE_BROKEN
92 GdkImage* gdk_image_new_bitmap (GdkVisual     *visual,
93                                 gpointer      data,
94                                 gint          width,
95                                 gint          height);
96 #endif /* GDK_ENABLE_BROKEN */
97
98 #ifndef GDK_DISABLE_DEPRECATED
99 #define gdk_image_destroy              gdk_image_unref
100 #endif /* GDK_DISABLE_DEPRECATED */
101
102 #ifdef __cplusplus
103 }
104 #endif /* __cplusplus */
105
106 #endif /* __GDK_IMAGE_H__ */