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