]> Pileus Git - ~andy/gtk/blob - gdk/gdkimage.h
Large changes to the Win32 backend, partially made necessary by the
[~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  *   Shared Pixmap: Also a shared memory image, which also has a
21  *           pixmap using the same memory. Used by gdk_imlib with the
22  *           Win32 backend.
23  */
24 typedef enum
25 {
26   GDK_IMAGE_NORMAL,
27   GDK_IMAGE_SHARED,
28   GDK_IMAGE_FASTEST,
29   GDK_IMAGE_SHARED_PIXMAP
30 } GdkImageType;
31
32 struct _GdkImage
33 {
34   GdkImageType  type;
35   GdkVisual    *visual;     /* visual used to create the image */
36   GdkByteOrder  byte_order;
37   gint          width;
38   gint          height;
39   guint16       depth;
40   guint16       bpp;        /* bytes per pixel */
41   guint16       bpl;        /* bytes per line */
42   gpointer      mem;
43 };
44
45 GdkImage* gdk_image_new_bitmap(GdkVisual     *visual,
46                                 gpointer      data,
47                                 gint          width,
48                                 gint          height);
49 GdkImage*  gdk_image_new       (GdkImageType  type,
50                                 GdkVisual    *visual,
51                                 gint          width,
52                                 gint          height);
53 #ifdef GDK_WINDOWING_WIN32
54 GdkImage*  gdk_image_bitmap_new(GdkImageType  type,
55                                 GdkVisual    *visual,
56                                 gint          width,
57                                 gint          height);
58
59 #endif
60 GdkImage*  gdk_image_get       (GdkDrawable  *drawable,
61                                 gint          x,
62                                 gint          y,
63                                 gint          width,
64                                 gint          height);
65
66 GdkImage * gdk_image_ref       (GdkImage     *image);
67 void       gdk_image_unref     (GdkImage     *image);
68
69 void       gdk_image_put_pixel (GdkImage     *image,
70                                 gint          x,
71                                 gint          y,
72                                 guint32       pixel);
73 guint32    gdk_image_get_pixel (GdkImage     *image,
74                                 gint          x,
75                                 gint          y);
76
77
78 #ifdef __cplusplus
79 }
80 #endif /* __cplusplus */
81
82 #endif /* __GDK_IMAGE_H__ */