1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = 
27  * outPack = gdk
28  * outFile = RgbCmap
29  * strct   = GdkRgbCmap
30  * realStrct=
31  * ctorStrct=
32  * clss    = RgbCmap
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gdk_rgb_cmap_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * module aliases:
48  * local aliases:
49  * overrides:
50  */
51 
52 module gdk.RgbCmap;
53 
54 public  import gtkc.gdktypes;
55 
56 private import gtkc.gdk;
57 private import glib.ConstructionException;
58 private import gobject.ObjectG;
59 
60 
61 
62 
63 
64 
65 /**
66  * Description
67  * GdkRGB is a low-level module which renders RGB, grayscale, and indexed
68  * colormap images to a GdkDrawable. It does this as efficiently as
69  * possible, handling issues such as colormaps, visuals, dithering,
70  * temporary buffers, and so on. Most code should use the higher-level
71  * GdkPixbuf features in place of this module; for example,
72  * gdk_draw_pixbuf() uses GdkRGB in its implementation.
73  * GdkRGB allocates a color cube to use when rendering images. You can
74  * set the threshold for installing colormaps with
75  * gdk_rgb_set_min_colors(). The default is 5x5x5 (125). If a colorcube
76  * of this size or larger can be allocated in the default colormap, then
77  * that's done. Otherwise, GdkRGB creates its own private colormap.
78  * Setting it to 0 means that it always tries to use the default
79  * colormap, and setting it to 216 means that it always creates a private
80  * one if it cannot allocate the 6x6x6 colormap in the default. If you
81  * always want a private colormap (to avoid consuming too many colormap
82  * entries for other apps, say), you can use
83  * gdk_rgb_set_install(TRUE).
84  * Setting the value greater than 216 exercises a bug in older versions
85  * of GdkRGB. Note, however, that setting it to 0 doesn't let you get
86  * away with ignoring the colormap and visual - a colormap is always
87  * created in grayscale and direct color modes, and the visual is changed
88  * in cases where a "better" visual than the default is available.
89  * If GDK is built with the Sun mediaLib library, the GdkRGB functions are
90  * accelerated using mediaLib, which provides hardware acceleration on Intel,
91  * AMD, and Sparc chipsets. If desired, mediaLib support can be turned off
92  * by setting the GDK_DISABLE_MEDIALIB environment variable.
93  * $(DDOC_COMMENT example)
94  */
95 public class RgbCmap
96 {
97 	
98 	/** the main Gtk struct */
99 	protected GdkRgbCmap* gdkRgbCmap;
100 	
101 	
102 	public GdkRgbCmap* getRgbCmapStruct()
103 	{
104 		return gdkRgbCmap;
105 	}
106 	
107 	
108 	/** the main Gtk struct as a void* */
109 	protected void* getStruct()
110 	{
111 		return cast(void*)gdkRgbCmap;
112 	}
113 	
114 	/**
115 	 * Sets our main struct and passes it to the parent class
116 	 */
117 	public this (GdkRgbCmap* gdkRgbCmap)
118 	{
119 		this.gdkRgbCmap = gdkRgbCmap;
120 	}
121 	
122 	/**
123 	 */
124 	
125 	/**
126 	 * Warning
127 	 * gdk_rgb_cmap_new is deprecated and should not be used in newly-written code.
128 	 * Creates a new GdkRgbCmap structure. The cmap maps color indexes to
129 	 * RGB colors. If n_colors is less than 256, then images containing
130 	 * color values greater than or equal to n_colors will produce undefined
131 	 * results, including possibly segfaults.
132 	 * Params:
133 	 * colors = The colors, represented as 0xRRGGBB integer values.
134 	 * Throws: ConstructionException GTK+ fails to create the object.
135 	 */
136 	public this (uint[] colors)
137 	{
138 		// GdkRgbCmap * gdk_rgb_cmap_new (guint32 *colors,  gint n_colors);
139 		auto p = gdk_rgb_cmap_new(colors.ptr, cast(int) colors.length);
140 		if(p is null)
141 		{
142 			throw new ConstructionException("null returned by gdk_rgb_cmap_new(colors.ptr, cast(int) colors.length)");
143 		}
144 		this(cast(GdkRgbCmap*) p);
145 	}
146 	
147 	/**
148 	 * Warning
149 	 * gdk_rgb_cmap_free is deprecated and should not be used in newly-written code.
150 	 * Frees the memory associated with a GdkRgbCmap created by gdk_rgb_cmap_new().
151 	 */
152 	public void free()
153 	{
154 		// void gdk_rgb_cmap_free (GdkRgbCmap *cmap);
155 		gdk_rgb_cmap_free(gdkRgbCmap);
156 	}
157 }