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-Colormaps-and-Colors.html
50 * - GdkColor* -> Color
51 * - GdkColormap* -> Colormap
52 * - GdkScreen* -> Screen
53 * - GdkVisual* -> Visual
59 private import gdk
.gdktypes
;
61 private import lib
.gdk
;
63 private import gdk
.Visual
;
64 private import gdk
.Colormap
;
65 private import gdk
.Color
;
66 private import gdk
.Screen
;
70 * These functions are used to modify colormaps.
71 * A colormap is an object that contains the mapping
72 * between the color values stored in memory and
73 * the RGB values that are used to display color
74 * values. In general, colormaps only contain
75 * significant information for pseudo-color visuals,
76 * but even for other visual types, a colormap object
77 * is required in some circumstances.
78 * There are a couple of special colormaps that can
79 * be retrieved. The system colormap (retrieved
80 * with gdk_colormap_get_system()) is the default
81 * colormap of the system. If you are using GdkRGB,
82 * there is another colormap that is important - the
83 * colormap in which GdkRGB works, retrieved with
84 * gdk_rgb_get_cmap(). However, when using GdkRGB,
85 * it is not generally necessary to allocate colors
87 * In previous revisions of this interface, a number
88 * of functions that take a GdkColormap parameter
89 * were replaced with functions whose names began
90 * with "gdk_colormap_". This process will probably
91 * be extended somewhat in the future -
92 * gdk_color_white(), gdk_color_black(), and
93 * gdk_color_change() will probably become aliases.
98 /** the main Gtk struct */
99 protected GdkColormap
* gdkColormap
;
102 public GdkColormap
* getColormapStruct()
108 /** the main Gtk struct as a void* */
109 protected void* getStruct()
111 return cast(void*)gdkColormap
;
115 * Sets our main struct and passes it to the parent class
117 public this (GdkColormap
* gdkColormap
)
119 this.gdkColormap
= gdkColormap
;
128 * Creates a new colormap for the given visual.
132 * if TRUE, the newly created colormap will be
133 * a private colormap, and all colors in it will be
134 * allocated for the applications use.
136 * the new GdkColormap.
138 public this (Visual visual
, int allocate
)
140 // GdkColormap* gdk_colormap_new (GdkVisual *visual, gboolean allocate);
141 this(cast(GdkColormap
*)gdk_colormap_new((visual
is null) ?
null : visual
.getVisualStruct(), allocate
) );
146 * gdk_colormap_ref is deprecated and should not be used in newly-written code.
147 * Deprecated function; use g_object_ref() instead.
153 public Colormap
ref()
155 // GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
156 return new Colormap( gdk_colormap_ref(gdkColormap
) );
161 * gdk_colormap_unref is deprecated and should not be used in newly-written code.
162 * Deprecated function; use g_object_ref() instead.
168 // void gdk_colormap_unref (GdkColormap *cmap);
169 gdk_colormap_unref(gdkColormap
);
173 * Gets the system's default colormap for the default screen. (See
174 * gdk_colormap_get_system_for_screen())
176 * the default colormap.
178 public static Colormap
getSystem()
180 // GdkColormap* gdk_colormap_get_system (void);
181 return new Colormap( gdk_colormap_get_system() );
186 * gdk_colormap_get_system_size is deprecated and should not be used in newly-written code.
187 * Returns the size of the system's default colormap.
188 * (See the description of struct GdkColormap for an
189 * explanation of the size of a colormap.)
191 * the size of the system's default colormap.
193 public static int getSystemSize()
195 // gint gdk_colormap_get_system_size (void);
196 return gdk_colormap_get_system_size();
201 * gdk_colormap_change is deprecated and should not be used in newly-written code.
202 * Changes the value of the first ncolors in a private colormap
203 * to match the values in the colors
204 * array in the colormap. This function is obsolete and
205 * should not be used. See gdk_color_change().
209 * the number of colors to change.
211 public void change(int ncolors
)
213 // void gdk_colormap_change (GdkColormap *colormap, gint ncolors);
214 gdk_colormap_change(gdkColormap
, ncolors
);
218 * Allocates colors from a colormap.
222 * The color values to allocate. On return, the pixel
223 * values for allocated colors will be filled in.
225 * The number of colors in colors.
227 * If TRUE, the colors are allocated writeable
228 * (their values can later be changed using gdk_color_change()).
229 * Writeable colors cannot be shared between applications.
231 * If TRUE, GDK will attempt to do matching against
232 * existing colors if the colors cannot be allocated as requested.
234 * An array of length ncolors. On return, this
235 * indicates whether the corresponding color in colors was
236 * successfully allocated or not.
238 * The number of colors that were not successfully
241 public int allocColors(Color colors
, int ncolors
, int writeable
, int bestMatch
, int* success
)
243 // gint gdk_colormap_alloc_colors (GdkColormap *colormap, GdkColor *colors, gint ncolors, gboolean writeable, gboolean best_match, gboolean *success);
244 return gdk_colormap_alloc_colors(gdkColormap
, (colors
is null) ?
null : colors
.getColorStruct(), ncolors
, writeable
, bestMatch
, success
);
248 * Allocates a single color from a colormap.
252 * the color to allocate. On return the
253 * pixel field will be
254 * filled in if allocation succeeds.
256 * If TRUE, the color is allocated writeable
257 * (their values can later be changed using gdk_color_change()).
258 * Writeable colors cannot be shared between applications.
260 * If TRUE, GDK will attempt to do matching against
261 * existing colors if the color cannot be allocated as requested.
263 * TRUE if the allocation succeeded.
265 public int allocColor(Color color
, int writeable
, int bestMatch
)
267 // gboolean gdk_colormap_alloc_color (GdkColormap *colormap, GdkColor *color, gboolean writeable, gboolean best_match);
268 return gdk_colormap_alloc_color(gdkColormap
, (color
is null) ?
null : color
.getColorStruct(), writeable
, bestMatch
);
272 * Frees previously allocated colors.
276 * the colors to free.
278 * the number of colors in colors.
280 public void freeColors(Color colors
, int ncolors
)
282 // void gdk_colormap_free_colors (GdkColormap *colormap, GdkColor *colors, gint ncolors);
283 gdk_colormap_free_colors(gdkColormap
, (colors
is null) ?
null : colors
.getColorStruct(), ncolors
);
287 * Locates the RGB color in colormap corresponding to the given
288 * hardware pixel pixel. pixel must be a valid pixel in the
289 * colormap; it's a programmer error to call this function with a
290 * pixel which is not in the colormap. Hardware pixels are normally
291 * obtained from gdk_colormap_alloc_colors(), or from a GdkImage. (A
292 * GdkImage contains image data in hardware format, a GdkPixbuf
293 * contains image data in a canonical 24-bit RGB format.)
294 * This function is rarely useful; it's used for example to
295 * implement the eyedropper feature in GtkColorSelection.
299 * pixel value in hardware display format
301 * GdkColor with red, green, blue fields initialized
303 public void queryColor(uint pixel
, Color result
)
305 // void gdk_colormap_query_color (GdkColormap *colormap, gulong pixel, GdkColor *result);
306 gdk_colormap_query_color(gdkColormap
, pixel
, (result
is null) ?
null : result
.getColorStruct());
310 * Returns the visual for which a given colormap was created.
314 * the visual of the colormap.
316 public Visual
getVisual()
318 // GdkVisual* gdk_colormap_get_visual (GdkColormap *colormap);
319 return new Visual( gdk_colormap_get_visual(gdkColormap
) );
323 * Gets the screen for which this colormap was created.
327 * the screen for which this colormap was created.
330 public Screen
getScreen()
332 // GdkScreen* gdk_colormap_get_screen (GdkColormap *cmap);
333 return new Screen( gdk_colormap_get_screen(gdkColormap
) );
338 * gdk_colors_store is deprecated and should not be used in newly-written code.
339 * Changes the value of the first ncolors colors in
340 * a private colormap. This function is obsolete and
341 * should not be used. See gdk_color_change().
345 * the new color values.
347 * the number of colors to change.
349 public void gdkColorsStore(Color colors
, int ncolors
)
351 // void gdk_colors_store (GdkColormap *colormap, GdkColor *colors, gint ncolors);
352 gdk_colors_store(gdkColormap
, (colors
is null) ?
null : colors
.getColorStruct(), ncolors
);
359 * gdk_colors_alloc is deprecated and should not be used in newly-written code.
360 * Allocates colors from a colormap. This function
361 * is obsolete. See gdk_colormap_alloc_colors().
362 * For full documentation of the fields, see
363 * the Xlib documentation for XAllocColorCells().
367 * if TRUE, the colors should be allocated
368 * in contiguous color cells.
370 * an array in which to store the plane masks.
372 * the number of planes to allocate. (Or zero,
373 * to indicate that the color allocation should not be planar.)
375 * an array into which to store allocated pixel values.
377 * the number of pixels in each plane to allocate.
379 * TRUE if the allocation was successful
381 public int gdkColorsAlloc(int contiguous
, uint* planes
, int nplanes
, uint* pixels
, int npixels
)
383 // gint gdk_colors_alloc (GdkColormap *colormap, gboolean contiguous, gulong *planes, gint nplanes, gulong *pixels, gint npixels);
384 return gdk_colors_alloc(gdkColormap
, contiguous
, planes
, nplanes
, pixels
, npixels
);
389 * gdk_colors_free is deprecated and should not be used in newly-written code.
390 * Frees colors allocated with gdk_colors_alloc(). This
391 * function is obsolete. See gdk_colormap_free_colors().
395 * the pixel values of the colors to free.
397 * the number of values in pixels.
399 * the plane masks for all planes to free, OR'd together.
401 public void gdkColorsFree(uint* pixels
, int npixels
, uint planes
)
403 // void gdk_colors_free (GdkColormap *colormap, gulong *pixels, gint npixels, gulong planes);
404 gdk_colors_free(gdkColormap
, pixels
, npixels
, planes
);