2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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
64 import tango
.io
.Stdout
; // use the tango loging?
68 private import gtkc
.gdktypes
;
70 private import gtkc
.gdk
;
73 private import gdk
.Visual
;
74 private import gdk
.Colormap
;
75 private import gdk
.Color
;
76 private import gdk
.Screen
;
83 * These functions are used to modify colormaps.
84 * A colormap is an object that contains the mapping
85 * between the color values stored in memory and
86 * the RGB values that are used to display color
87 * values. In general, colormaps only contain
88 * significant information for pseudo-color visuals,
89 * but even for other visual types, a colormap object
90 * is required in some circumstances.
91 * There are a couple of special colormaps that can
92 * be retrieved. The system colormap (retrieved
93 * with gdk_colormap_get_system()) is the default
94 * colormap of the system. If you are using GdkRGB,
95 * there is another colormap that is important - the
96 * colormap in which GdkRGB works, retrieved with
97 * gdk_rgb_get_cmap(). However, when using GdkRGB,
98 * it is not generally necessary to allocate colors
100 * In previous revisions of this interface, a number
101 * of functions that take a GdkColormap parameter
102 * were replaced with functions whose names began
103 * with "gdk_colormap_". This process will probably
104 * be extended somewhat in the future -
105 * gdk_color_white(), gdk_color_black(), and
106 * gdk_color_change() will probably become aliases.
108 public class Colormap
111 /** the main Gtk struct */
112 protected GdkColormap
* gdkColormap
;
115 public GdkColormap
* getColormapStruct()
121 /** the main Gtk struct as a void* */
122 protected void* getStruct()
124 return cast(void*)gdkColormap
;
128 * Sets our main struct and passes it to the parent class
130 public this (GdkColormap
* gdkColormap
)
134 if ( gdkColormap
is null )
139 Stdout("struct gdkColormap is null on constructor").newline
;
143 printf("struct gdkColormap is null on constructor");
150 assert(gdkColormap
!is null, "struct gdkColormap is null on constructor");
152 this.gdkColormap
= gdkColormap
;
161 * Creates a new colormap for the given visual.
165 * if TRUE, the newly created colormap will be
166 * a private colormap, and all colors in it will be
167 * allocated for the applications use.
169 * the new GdkColormap.
171 public this (Visual visual
, int allocate
)
173 // GdkColormap* gdk_colormap_new (GdkVisual *visual, gboolean allocate);
174 this(cast(GdkColormap
*)gdk_colormap_new((visual
is null) ?
null : visual
.getVisualStruct(), allocate
) );
179 * gdk_colormap_ref is deprecated and should not be used in newly-written code.
180 * Deprecated function; use g_object_ref() instead.
186 public Colormap
doref()
188 // GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
189 return new Colormap( gdk_colormap_ref(gdkColormap
) );
194 * gdk_colormap_unref is deprecated and should not be used in newly-written code.
195 * Deprecated function; use g_object_ref() instead.
201 // void gdk_colormap_unref (GdkColormap *cmap);
202 gdk_colormap_unref(gdkColormap
);
206 * Gets the system's default colormap for the default screen. (See
207 * gdk_colormap_get_system_for_screen())
209 * the default colormap.
211 public static Colormap
getSystem()
213 // GdkColormap* gdk_colormap_get_system (void);
214 return new Colormap( gdk_colormap_get_system() );
219 * gdk_colormap_get_system_size is deprecated and should not be used in newly-written code.
220 * Returns the size of the system's default colormap.
221 * (See the description of struct GdkColormap for an
222 * explanation of the size of a colormap.)
224 * the size of the system's default colormap.
226 public static int getSystemSize()
228 // gint gdk_colormap_get_system_size (void);
229 return gdk_colormap_get_system_size();
234 * gdk_colormap_change is deprecated and should not be used in newly-written code.
235 * Changes the value of the first ncolors in a private colormap
236 * to match the values in the colors
237 * array in the colormap. This function is obsolete and
238 * should not be used. See gdk_color_change().
242 * the number of colors to change.
244 public void change(int ncolors
)
246 // void gdk_colormap_change (GdkColormap *colormap, gint ncolors);
247 gdk_colormap_change(gdkColormap
, ncolors
);
251 * Allocates colors from a colormap.
255 * The color values to allocate. On return, the pixel
256 * values for allocated colors will be filled in.
258 * The number of colors in colors.
260 * If TRUE, the colors are allocated writeable
261 * (their values can later be changed using gdk_color_change()).
262 * Writeable colors cannot be shared between applications.
264 * If TRUE, GDK will attempt to do matching against
265 * existing colors if the colors cannot be allocated as requested.
267 * An array of length ncolors. On return, this
268 * indicates whether the corresponding color in colors was
269 * successfully allocated or not.
271 * The number of colors that were not successfully
274 public int allocColors(Color colors
, int ncolors
, int writeable
, int bestMatch
, int* success
)
276 // gint gdk_colormap_alloc_colors (GdkColormap *colormap, GdkColor *colors, gint ncolors, gboolean writeable, gboolean best_match, gboolean *success);
277 return gdk_colormap_alloc_colors(gdkColormap
, (colors
is null) ?
null : colors
.getColorStruct(), ncolors
, writeable
, bestMatch
, success
);
281 * Allocates a single color from a colormap.
285 * the color to allocate. On return the
286 * pixel field will be
287 * filled in if allocation succeeds.
289 * If TRUE, the color is allocated writeable
290 * (their values can later be changed using gdk_color_change()).
291 * Writeable colors cannot be shared between applications.
293 * If TRUE, GDK will attempt to do matching against
294 * existing colors if the color cannot be allocated as requested.
296 * TRUE if the allocation succeeded.
298 public int allocColor(Color color
, int writeable
, int bestMatch
)
300 // gboolean gdk_colormap_alloc_color (GdkColormap *colormap, GdkColor *color, gboolean writeable, gboolean best_match);
301 return gdk_colormap_alloc_color(gdkColormap
, (color
is null) ?
null : color
.getColorStruct(), writeable
, bestMatch
);
305 * Frees previously allocated colors.
309 * the colors to free.
311 * the number of colors in colors.
313 public void freeColors(Color colors
, int ncolors
)
315 // void gdk_colormap_free_colors (GdkColormap *colormap, GdkColor *colors, gint ncolors);
316 gdk_colormap_free_colors(gdkColormap
, (colors
is null) ?
null : colors
.getColorStruct(), ncolors
);
320 * Locates the RGB color in colormap corresponding to the given
321 * hardware pixel pixel. pixel must be a valid pixel in the
322 * colormap; it's a programmer error to call this function with a
323 * pixel which is not in the colormap. Hardware pixels are normally
324 * obtained from gdk_colormap_alloc_colors(), or from a GdkImage. (A
325 * GdkImage contains image data in hardware format, a GdkPixbuf
326 * contains image data in a canonical 24-bit RGB format.)
327 * This function is rarely useful; it's used for example to
328 * implement the eyedropper feature in GtkColorSelection.
332 * pixel value in hardware display format
334 * GdkColor with red, green, blue fields initialized
336 public void queryColor(uint pixel
, Color result
)
338 // void gdk_colormap_query_color (GdkColormap *colormap, gulong pixel, GdkColor *result);
339 gdk_colormap_query_color(gdkColormap
, pixel
, (result
is null) ?
null : result
.getColorStruct());
343 * Returns the visual for which a given colormap was created.
347 * the visual of the colormap.
349 public Visual
getVisual()
351 // GdkVisual* gdk_colormap_get_visual (GdkColormap *colormap);
352 return new Visual( gdk_colormap_get_visual(gdkColormap
) );
356 * Gets the screen for which this colormap was created.
360 * the screen for which this colormap was created.
363 public Screen
getScreen()
365 // GdkScreen* gdk_colormap_get_screen (GdkColormap *cmap);
366 return new Screen( gdk_colormap_get_screen(gdkColormap
) );
371 * gdk_colors_store is deprecated and should not be used in newly-written code.
372 * Changes the value of the first ncolors colors in
373 * a private colormap. This function is obsolete and
374 * should not be used. See gdk_color_change().
378 * the new color values.
380 * the number of colors to change.
382 public void gdkColorsStore(Color colors
, int ncolors
)
384 // void gdk_colors_store (GdkColormap *colormap, GdkColor *colors, gint ncolors);
385 gdk_colors_store(gdkColormap
, (colors
is null) ?
null : colors
.getColorStruct(), ncolors
);
392 * gdk_colors_alloc is deprecated and should not be used in newly-written code.
393 * Allocates colors from a colormap. This function
394 * is obsolete. See gdk_colormap_alloc_colors().
395 * For full documentation of the fields, see
396 * the Xlib documentation for XAllocColorCells().
400 * if TRUE, the colors should be allocated
401 * in contiguous color cells.
403 * an array in which to store the plane masks.
405 * the number of planes to allocate. (Or zero,
406 * to indicate that the color allocation should not be planar.)
408 * an array into which to store allocated pixel values.
410 * the number of pixels in each plane to allocate.
412 * TRUE if the allocation was successful
414 public int gdkColorsAlloc(int contiguous
, uint* planes
, int nplanes
, uint* pixels
, int npixels
)
416 // gint gdk_colors_alloc (GdkColormap *colormap, gboolean contiguous, gulong *planes, gint nplanes, gulong *pixels, gint npixels);
417 return gdk_colors_alloc(gdkColormap
, contiguous
, planes
, nplanes
, pixels
, npixels
);
422 * gdk_colors_free is deprecated and should not be used in newly-written code.
423 * Frees colors allocated with gdk_colors_alloc(). This
424 * function is obsolete. See gdk_colormap_free_colors().
428 * the pixel values of the colors to free.
430 * the number of values in pixels.
432 * the plane masks for all planes to free, OR'd together.
434 public void gdkColorsFree(uint* pixels
, int npixels
, uint planes
)
436 // void gdk_colors_free (GdkColormap *colormap, gulong *pixels, gint npixels, gulong planes);
437 gdk_colors_free(gdkColormap
, pixels
, npixels
, planes
);