alternative to assert
[gtkD.git] / src / gdk / Pixmap.d
blob7f614b6592b299541653289dee345de970369ad7
1 /*
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-Bitmaps-and-Pixmaps.html
26 * outPack = gdk
27 * outFile = Pixmap
28 * strct = GdkPixmap
29 * realStrct=
30 * ctorStrct=
31 * clss = Pixmap
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gdk_pixmap_
40 * omit structs:
41 * omit prefixes:
42 * - gdk_bitmap_
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gdk.Drawable
47 * - gdk.Pixmap
48 * - gdk.Color
49 * - gdk.Colormap
50 * structWrap:
51 * - GdkColor* -> Color
52 * - GdkColormap* -> Colormap
53 * - GdkDrawable* -> Drawable
54 * - GdkPixmap* -> Pixmap
55 * local aliases:
58 module gdk.Pixmap;
60 private import gdk.gdktypes;
62 private import lib.gdk;
64 private import glib.Str;
65 private import gdk.Drawable;
66 private import gdk.Pixmap;
67 private import gdk.Color;
68 private import gdk.Colormap;
70 /**
71 * Description
72 * Pixmaps are offscreen drawables. They can be drawn upon with the
73 * standard drawing primitives, then copied to another drawable (such as
74 * a GdkWindow) with gdk_pixmap_draw(). The depth of a pixmap
75 * is the number of bits per pixels. Bitmaps are simply pixmaps
76 * with a depth of 1. (That is, they are monochrome bitmaps - each
77 * pixel can be either on or off).
79 private import gdk.Drawable;
80 public class Pixmap : Drawable
83 /** the main Gtk struct */
84 protected GdkPixmap* gdkPixmap;
87 public GdkPixmap* getPixmapStruct()
89 return gdkPixmap;
93 /** the main Gtk struct as a void* */
94 protected void* getStruct()
96 return cast(void*)gdkPixmap;
99 /**
100 * Sets our main struct and passes it to the parent class
102 public this (GdkPixmap* gdkPixmap)
104 super(cast(GdkDrawable*)gdkPixmap);
105 this.gdkPixmap = gdkPixmap;
113 * Create a new pixmap with a given size and depth.
114 * drawable:
115 * A GdkDrawable, used to determine default values
116 * for the new pixmap. Can be NULL if depth is specified,
117 * width:
118 * The width of the new pixmap in pixels.
119 * height:
120 * The height of the new pixmap in pixels.
121 * depth:
122 * The depth (number of bits per pixel) of the new pixmap.
123 * If -1, and drawable is not NULL, the depth of the new
124 * pixmap will be equal to that of drawable.
125 * Returns:
126 * the GdkPixmap
128 public this (Drawable drawable, int width, int height, int depth)
130 // GdkPixmap* gdk_pixmap_new (GdkDrawable *drawable, gint width, gint height, gint depth);
131 this(cast(GdkPixmap*)gdk_pixmap_new((drawable is null) ? null : drawable.getDrawableStruct(), width, height, depth) );
136 * Create a two-color pixmap from data in XBM data.
137 * drawable:
138 * a GdkDrawable, used to determine default values
139 * for the new pixmap. Can be NULL, if the depth is given.
140 * data:
141 * a pointer to the data.
142 * width:
143 * the width of the new pixmap in pixels.
144 * height:
145 * the height of the new pixmap in pixels.
146 * depth:
147 * the depth (number of bits per pixel) of the new pixmap.
148 * fg:
149 * the foreground color.
150 * bg:
151 * the background color.
152 * Returns:
153 * the GdkPixmap
155 public static Pixmap createFromData(Drawable drawable, char[] data, int width, int height, int depth, Color fg, Color bg)
157 // GdkPixmap* gdk_pixmap_create_from_data (GdkDrawable *drawable, const gchar *data, gint width, gint height, gint depth, const GdkColor *fg, const GdkColor *bg);
158 return new Pixmap( gdk_pixmap_create_from_data((drawable is null) ? null : drawable.getDrawableStruct(), Str.toStringz(data), width, height, depth, (fg is null) ? null : fg.getColorStruct(), (bg is null) ? null : bg.getColorStruct()) );
162 * Create a pixmap from a XPM file.
163 * drawable:
164 * a GdkDrawable, used to determine default values
165 * for the new pixmap.
166 * mask:
167 * a pointer to a place to store a bitmap representing
168 * the transparency mask of the XPM file. Can be NULL,
169 * in which case transparency will be ignored.
170 * transparent_color:
171 * the color to be used for the pixels
172 * that are transparent in the input file. Can be NULL,
173 * in which case a default color will be used.
174 * filename:
175 * the filename of a file containing XPM data.
176 * Returns:
177 * the GdkPixmap
179 public static Pixmap createFromXpm(Drawable drawable, GdkBitmap** mask, Color transparentColor, char[] filename)
181 // GdkPixmap* gdk_pixmap_create_from_xpm (GdkDrawable *drawable, GdkBitmap **mask, const GdkColor *transparent_color, const gchar *filename);
182 return new Pixmap( gdk_pixmap_create_from_xpm((drawable is null) ? null : drawable.getDrawableStruct(), mask, (transparentColor is null) ? null : transparentColor.getColorStruct(), Str.toStringz(filename)) );
186 * Create a pixmap from a XPM file using a particular colormap.
187 * drawable:
188 * a GdkDrawable, used to determine default values
189 * for the new pixmap. Can be NULL if colormap is given.
190 * colormap:
191 * the GdkColormap that the new pixmap will be use.
192 * If omitted, the colormap for window will be used.
193 * mask:
194 * a pointer to a place to store a bitmap representing
195 * the transparency mask of the XPM file. Can be NULL,
196 * in which case transparency will be ignored.
197 * transparent_color:
198 * the color to be used for the pixels
199 * that are transparent in the input file. Can be NULL,
200 * in which case a default color will be used.
201 * filename:
202 * the filename of a file containing XPM data.
203 * Returns:
204 * the GdkPixmap.
206 public static Pixmap colormapCreateFromXpm(Drawable drawable, Colormap colormap, GdkBitmap** mask, Color transparentColor, char[] filename)
208 // GdkPixmap* gdk_pixmap_colormap_create_from_xpm (GdkDrawable *drawable, GdkColormap *colormap, GdkBitmap **mask, const GdkColor *transparent_color, const gchar *filename);
209 return new Pixmap( gdk_pixmap_colormap_create_from_xpm((drawable is null) ? null : drawable.getDrawableStruct(), (colormap is null) ? null : colormap.getColormapStruct(), mask, (transparentColor is null) ? null : transparentColor.getColorStruct(), Str.toStringz(filename)) );
213 * Create a pixmap from data in XPM format.
214 * drawable:
215 * a GdkDrawable, used to determine default values
216 * for the new pixmap.
217 * mask:
218 * Pointer to a place to store a bitmap representing
219 * the transparency mask of the XPM file. Can be NULL,
220 * in which case transparency will be ignored.
221 * transparent_color:
222 * This color will be used for the pixels
223 * that are transparent in the input file. Can be NULL
224 * in which case a default color will be used.
225 * data:
226 * Pointer to a string containing the XPM data.
227 * Returns:
228 * the GdkPixmap
230 public static Pixmap createFromXpmD(Drawable drawable, GdkBitmap** mask, Color transparentColor, char** data)
232 // GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkDrawable *drawable, GdkBitmap **mask, const GdkColor *transparent_color, gchar **data);
233 return new Pixmap( gdk_pixmap_create_from_xpm_d((drawable is null) ? null : drawable.getDrawableStruct(), mask, (transparentColor is null) ? null : transparentColor.getColorStruct(), data) );
237 * Create a pixmap from data in XPM format using a particular
238 * colormap.
239 * drawable:
240 * a GdkDrawable, used to determine default values
241 * for the new pixmap. Can be NULL if colormap is given.
242 * colormap:
243 * the GdkColormap that the new pixmap will be use.
244 * If omitted, the colormap for window will be used.
245 * mask:
246 * a pointer to a place to store a bitmap representing
247 * the transparency mask of the XPM file. Can be NULL,
248 * in which case transparency will be ignored.
249 * transparent_color:
250 * the color to be used for the pixels
251 * that are transparent in the input file. Can be NULL,
252 * in which case a default color will be used.
253 * data:
254 * Pointer to a string containing the XPM data.
255 * Returns:
256 * the GdkPixmap.
258 public static Pixmap colormapCreateFromXpmD(Drawable drawable, Colormap colormap, GdkBitmap** mask, Color transparentColor, char** data)
260 // GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d (GdkDrawable *drawable, GdkColormap *colormap, GdkBitmap **mask, const GdkColor *transparent_color, gchar **data);
261 return new Pixmap( gdk_pixmap_colormap_create_from_xpm_d((drawable is null) ? null : drawable.getDrawableStruct(), (colormap is null) ? null : colormap.getColormapStruct(), mask, (transparentColor is null) ? null : transparentColor.getColorStruct(), data) );