2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit 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
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gdk-Images.html
48 * - GdkColormap* -> Colormap
49 * - GdkDrawable* -> Drawable
50 * - GdkVisual* -> Visual
56 private import gdk
.gdktypes
;
58 private import lib
.gdk
;
60 private import gdk
.Visual
;
61 private import gdk
.Drawable
;
62 private import gdk
.Colormap
;
66 * The GdkImage type represents an area for drawing graphics.
67 * It has now been superceded to a large extent by the much more flexible
69 * To create an empty GdkImage use gdk_image_new().
70 * To create a GdkImage from bitmap data use gdk_image_new_bitmap().
71 * To create an image from part of a GdkWindow use gdk_drawable_get_image().
72 * The image can be manipulated with gdk_image_get_pixel() and
73 * gdk_image_put_pixel(), or alternatively by changing the actual pixel data.
74 * Though manipulating the pixel data requires complicated code to cope with
75 * the different formats that may be used.
76 * To draw a GdkImage in a GdkWindow or GdkPixmap use gdk_draw_image().
77 * To destroy a GdkImage use gdk_image_destroy().
82 /** the main Gtk struct */
83 protected GdkImage
* gdkImage
;
86 public GdkImage
* getImageGdkStruct()
92 /** the main Gtk struct as a void* */
93 protected void* getStruct()
95 return cast(void*)gdkImage
;
99 * Sets our main struct and passes it to the parent class
101 public this (GdkImage
* gdkImage
)
103 this.gdkImage
= gdkImage
;
111 * Creates a new GdkImage.
113 * the type of the GdkImage, one of GDK_IMAGE_NORMAL, GDK_IMAGE_SHARED
114 * and GDK_IMAGE_FASTEST. GDK_IMAGE_FASTEST is probably the best choice, since
115 * it will try creating a GDK_IMAGE_SHARED image first and if that fails it will
116 * then use GDK_IMAGE_NORMAL.
118 * the GdkVisual to use for the image.
120 * the width of the image in pixels.
122 * the height of the image in pixels.
124 * a new GdkImage, or NULL if the image could not be created.
126 public this (GdkImageType type
, Visual visual
, int width
, int height
)
128 // GdkImage* gdk_image_new (GdkImageType type, GdkVisual *visual, gint width, gint height);
129 this(cast(GdkImage
*)gdk_image_new(type
, (visual
is null) ?
null : visual
.getVisualStruct(), width
, height
) );
135 * gdk_image_new_bitmap is deprecated and should not be used in newly-written code.
136 * Creates a new GdkImage with a depth of 1 from the given data.
138 * THIS FUNCTION IS INCREDIBLY BROKEN. The passed-in data must
139 * be allocated by malloc() (NOT g_malloc()) and will be freed when the
142 * the GdkVisual to use for the image.
146 * the width of the image in pixels.
148 * the height of the image in pixels.
152 public this (Visual visual
, void* data
, int width
, int height
)
154 // GdkImage* gdk_image_new_bitmap (GdkVisual *visual, gpointer data, gint width, gint height);
155 this(cast(GdkImage
*)gdk_image_new_bitmap((visual
is null) ?
null : visual
.getVisualStruct(), data
, width
, height
) );
160 * gdk_image_get is deprecated and should not be used in newly-written code.
161 * This is a deprecated wrapper for gdk_drawable_get_image();
162 * gdk_drawable_get_image() should be used instead. Or even better: in
163 * most cases gdk_pixbuf_get_from_drawable() is the most convenient
168 * x coordinate in window
170 * y coordinate in window
172 * width of area in window
174 * height of area in window
176 * a new GdkImage or NULL
178 public static GdkImage
* get(Drawable drawable
, int x
, int y
, int width
, int height
)
180 // GdkImage* gdk_image_get (GdkDrawable *drawable, gint x, gint y, gint width, gint height);
181 return gdk_image_get((drawable
is null) ?
null : drawable
.getDrawableStruct(), x
, y
, width
, height
);
186 * gdk_image_ref is deprecated and should not be used in newly-written code.
187 * Deprecated function; use g_object_ref() instead.
193 public GdkImage
* ref()
195 // GdkImage* gdk_image_ref (GdkImage *image);
196 return gdk_image_ref(gdkImage
);
201 * gdk_image_unref is deprecated and should not be used in newly-written code.
202 * Deprecated function; use g_object_unref() instead.
208 // void gdk_image_unref (GdkImage *image);
209 gdk_image_unref(gdkImage
);
214 * Retrieves the colormap for a given image, if it exists. An image
215 * will have a colormap if the drawable from which it was created has
216 * a colormap, or if a colormap was set explicitely with
217 * gdk_image_set_colormap().
221 * colormap for the image
223 public Colormap
getColormap()
225 // GdkColormap* gdk_image_get_colormap (GdkImage *image);
226 return new Colormap( gdk_image_get_colormap(gdkImage
) );
230 * Sets the colormap for the image to the given colormap. Normally
231 * there's no need to use this function, images are created with the
232 * correct colormap if you get the image from a drawable. If you
233 * create the image from scratch, use the colormap of the drawable you
234 * intend to render the image to.
240 public void setColormap(Colormap colormap
)
242 // void gdk_image_set_colormap (GdkImage *image, GdkColormap *colormap);
243 gdk_image_set_colormap(gdkImage
, (colormap
is null) ?
null : colormap
.getColormapStruct());
247 * Sets a pixel in a GdkImage to a given pixel value.
251 * the x coordinate of the pixel to set.
253 * the y coordinate of the pixel to set.
255 * the pixel value to set.
257 public void putPixel(int x
, int y
, uint pixel
)
259 // void gdk_image_put_pixel (GdkImage *image, gint x, gint y, guint32 pixel);
260 gdk_image_put_pixel(gdkImage
, x
, y
, pixel
);
264 * Gets a pixel value at a specified position in a GdkImage.
268 * the x coordinate of the pixel to get.
270 * the y coordinate of the pixel to get.
272 * the pixel value at the given position.
274 * Bitmaps and Pixmaps
275 * Graphics which are stored on the X Windows server.
276 * Since these are stored on the server they can be drawn very quickly, and all
277 * of the Drawing Primitives can be
278 * used to draw on them. Their main disadvantage is that manipulating individual
279 * pixels can be very slow.
281 * Built on top of GdkImage, this provides much more functionality,
282 * including the dithering of colors to produce better output on low-color
285 public uint getPixel(int x
, int y
)
287 // guint32 gdk_image_get_pixel (GdkImage *image, gint x, gint y);
288 return gdk_image_get_pixel(gdkImage
, x
, y
);