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  = gdk-pixbuf-Module-Interface.html
27  * outPack = gdkpixbuf
28  * outFile = PixbufFormat
29  * strct   = GdkPixbufFormat
30  * realStrct=
31  * ctorStrct=
32  * clss    = PixbufFormat
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gdk_pixbuf_format_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- gdk.Pixbuf
47  * 	- glib.ListSG
48  * 	- glib.Str
49  * structWrap:
50  * 	- GSList* -> ListSG
51  * 	- GdkPixbuf* -> Pixbuf
52  * 	- GdkPixbufFormat* -> PixbufFormat
53  * module aliases:
54  * local aliases:
55  * overrides:
56  */
57 
58 module gdkpixbuf.PixbufFormat;
59 
60 public  import gtkc.gdkpixbuftypes;
61 
62 private import gtkc.gdkpixbuf;
63 private import glib.ConstructionException;
64 private import gobject.ObjectG;
65 
66 
67 private import gdk.Pixbuf;
68 private import glib.ListSG;
69 private import glib.Str;
70 
71 
72 
73 
74 /**
75  * If GdkPixBuf has been compiled with GModule support, it can be extended by
76  * modules which can load (and perhaps also save) new image and animation
77  * formats. Each loadable module must export a
78  * GdkPixbufModuleFillInfoFunc function named fill_info and
79  * a GdkPixbufModuleFillVtableFunc function named
80  * fill_vtable.
81  *
82  * In order to make format-checking work before actually loading the modules
83  * (which may require dlopening image libraries), modules export their
84  * signatures (and other information) via the fill_info
85  * function. An external utility, gdk-pixbuf-query-loaders,
86  * uses this to create a text file containing a list of all available loaders and
87  * their signatures. This file is then read at runtime by GdkPixBuf to obtain
88  * the list of available loaders and their signatures.
89  *
90  * Modules may only implement a subset of the functionality available via
91  * GdkPixbufModule. If a particular functionality is not implemented, the
92  * fill_vtable function will simply not set the corresponding
93  * function pointers of the GdkPixbufModule structure. If a module supports
94  * incremental loading (i.e. provides begin_load, stop_load and
95  * load_increment), it doesn't have to implement load, since GdkPixBuf can
96  * supply a generic load implementation wrapping the incremental loading.
97  *
98  * Installing a module is a two-step process:
99  *
100  * copy the module file(s) to the loader directory (normally
101  * libdir/gtk-2.0/version/loaders,
102  * unless overridden by the environment variable
103  * GDK_PIXBUF_MODULEDIR)
104  *
105  * call gdk-pixbuf-query-loaders to update the
106  * module file (normally
107  * sysconfdir/gtk-2.0/gdk-pixbuf.loaders,
108  * unless overridden by the environment variable
109  * GDK_PIXBUF_MODULE_FILE)
110  *
111  * The GdkPixBuf interfaces needed for implementing modules are contained in
112  * gdk-pixbuf-io.h (and
113  * gdk-pixbuf-animation.h if the module supports animations).
114  * They are not covered by the same stability guarantees as the regular
115  * GdkPixBuf API. To underline this fact, they are protected by
116  * #ifdef GDK_PIXBUF_ENABLE_BACKEND.
117  */
118 public class PixbufFormat
119 {
120 	
121 	/** the main Gtk struct */
122 	protected GdkPixbufFormat* gdkPixbufFormat;
123 	
124 	
125 	public GdkPixbufFormat* getPixbufFormatStruct()
126 	{
127 		return gdkPixbufFormat;
128 	}
129 	
130 	
131 	/** the main Gtk struct as a void* */
132 	protected void* getStruct()
133 	{
134 		return cast(void*)gdkPixbufFormat;
135 	}
136 	
137 	/**
138 	 * Sets our main struct and passes it to the parent class
139 	 */
140 	public this (GdkPixbufFormat* gdkPixbufFormat)
141 	{
142 		this.gdkPixbufFormat = gdkPixbufFormat;
143 	}
144 	
145 	/**
146 	 */
147 	
148 	/**
149 	 * Attaches a key/value pair as an option to a GdkPixbuf. If key already
150 	 * exists in the list of options attached to pixbuf, the new value is
151 	 * ignored and FALSE is returned.
152 	 * Since 2.2
153 	 * Params:
154 	 * pixbuf = a GdkPixbuf
155 	 * key = a nul-terminated string.
156 	 * value = a nul-terminated string.
157 	 * Returns: TRUE on success.
158 	 */
159 	public static int gdkPixbufSetOption(Pixbuf pixbuf, string key, string value)
160 	{
161 		// gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf,  const gchar *key,  const gchar *value);
162 		return gdk_pixbuf_set_option((pixbuf is null) ? null : pixbuf.getPixbufStruct(), Str.toStringz(key), Str.toStringz(value));
163 	}
164 	
165 	/**
166 	 * Obtains the available information about the image formats supported
167 	 * by GdkPixbuf.
168 	 * Since 2.2
169 	 * Returns: A list of GdkPixbufFormats describing the supported image formats. The list should be freed when it is no longer needed, but the structures themselves are owned by GdkPixbuf and should not be freed. [transfer container][element-type GdkPixbufFormat]
170 	 */
171 	public static ListSG gdkPixbufGetFormats()
172 	{
173 		// GSList * gdk_pixbuf_get_formats (void);
174 		auto p = gdk_pixbuf_get_formats();
175 		
176 		if(p is null)
177 		{
178 			return null;
179 		}
180 		
181 		return ObjectG.getDObject!(ListSG)(cast(GSList*) p);
182 	}
183 	
184 	/**
185 	 * Creates a copy of format
186 	 * Since 2.22
187 	 * Returns: the newly allocated copy of a GdkPixbufFormat. Use gdk_pixbuf_format_free() to free the resources when done
188 	 */
189 	public PixbufFormat copy()
190 	{
191 		// GdkPixbufFormat * gdk_pixbuf_format_copy (const GdkPixbufFormat *format);
192 		auto p = gdk_pixbuf_format_copy(gdkPixbufFormat);
193 		
194 		if(p is null)
195 		{
196 			return null;
197 		}
198 		
199 		return ObjectG.getDObject!(PixbufFormat)(cast(GdkPixbufFormat*) p);
200 	}
201 	
202 	/**
203 	 * Frees the resources allocated when copying a GdkPixbufFormat
204 	 * using gdk_pixbuf_format_copy()
205 	 * Since 2.22
206 	 */
207 	public void free()
208 	{
209 		// void gdk_pixbuf_format_free (GdkPixbufFormat *format);
210 		gdk_pixbuf_format_free(gdkPixbufFormat);
211 	}
212 	
213 	/**
214 	 * Returns the name of the format.
215 	 * Since 2.2
216 	 * Returns: the name of the format.
217 	 */
218 	public string getName()
219 	{
220 		// gchar * gdk_pixbuf_format_get_name (GdkPixbufFormat *format);
221 		return Str.toString(gdk_pixbuf_format_get_name(gdkPixbufFormat));
222 	}
223 	
224 	/**
225 	 * Returns a description of the format.
226 	 * Since 2.2
227 	 * Returns: a description of the format.
228 	 */
229 	public string getDescription()
230 	{
231 		// gchar * gdk_pixbuf_format_get_description (GdkPixbufFormat *format);
232 		return Str.toString(gdk_pixbuf_format_get_description(gdkPixbufFormat));
233 	}
234 	
235 	/**
236 	 * Returns the mime types supported by the format.
237 	 * Since 2.2
238 	 * Returns: a NULL-terminated array of mime types which must be freed with g_strfreev() when it is no longer needed. [transfer full]
239 	 */
240 	public string[] getMimeTypes()
241 	{
242 		// gchar ** gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format);
243 		return Str.toStringArray(gdk_pixbuf_format_get_mime_types(gdkPixbufFormat));
244 	}
245 	
246 	/**
247 	 * Returns the filename extensions typically used for files in the
248 	 * given format.
249 	 * Since 2.2
250 	 * Returns: a NULL-terminated array of filename extensions which must be freed with g_strfreev() when it is no longer needed. [transfer full]
251 	 */
252 	public string[] getExtensions()
253 	{
254 		// gchar ** gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format);
255 		return Str.toStringArray(gdk_pixbuf_format_get_extensions(gdkPixbufFormat));
256 	}
257 	
258 	/**
259 	 * Returns whether pixbufs can be saved in the given format.
260 	 * Since 2.2
261 	 * Returns: whether pixbufs can be saved in the given format.
262 	 */
263 	public int isWritable()
264 	{
265 		// gboolean gdk_pixbuf_format_is_writable (GdkPixbufFormat *format);
266 		return gdk_pixbuf_format_is_writable(gdkPixbufFormat);
267 	}
268 	
269 	/**
270 	 * Returns whether this image format is scalable. If a file is in a
271 	 * scalable format, it is preferable to load it at the desired size,
272 	 * rather than loading it at the default size and scaling the
273 	 * resulting pixbuf to the desired size.
274 	 * Since 2.6
275 	 * Returns: whether this image format is scalable.
276 	 */
277 	public int isScalable()
278 	{
279 		// gboolean gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format);
280 		return gdk_pixbuf_format_is_scalable(gdkPixbufFormat);
281 	}
282 	
283 	/**
284 	 * Returns whether this image format is disabled. See
285 	 * gdk_pixbuf_format_set_disabled().
286 	 * Since 2.6
287 	 * Returns: whether this image format is disabled.
288 	 */
289 	public int isDisabled()
290 	{
291 		// gboolean gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format);
292 		return gdk_pixbuf_format_is_disabled(gdkPixbufFormat);
293 	}
294 	
295 	/**
296 	 * Disables or enables an image format. If a format is disabled,
297 	 * gdk-pixbuf won't use the image loader for this format to load
298 	 * images. Applications can use this to avoid using image loaders
299 	 * with an inappropriate license, see gdk_pixbuf_format_get_license().
300 	 * Since 2.6
301 	 * Params:
302 	 * disabled = TRUE to disable the format format
303 	 */
304 	public void setDisabled(int disabled)
305 	{
306 		// void gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format,  gboolean disabled);
307 		gdk_pixbuf_format_set_disabled(gdkPixbufFormat, disabled);
308 	}
309 	
310 	/**
311 	 * Returns information about the license of the image loader for the format. The
312 	 * returned string should be a shorthand for a wellknown license, e.g. "LGPL",
313 	 * "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license. This
314 	 * string should be freed with g_free() when it's no longer needed.
315 	 * Since 2.6
316 	 * Returns: a string describing the license of format.
317 	 */
318 	public string getLicense()
319 	{
320 		// gchar * gdk_pixbuf_format_get_license (GdkPixbufFormat *format);
321 		return Str.toString(gdk_pixbuf_format_get_license(gdkPixbufFormat));
322 	}
323 }