alternative to assert
[gtkD.git] / src / gdkpixbuf / PixbufFormat.d
blob1e56ff1501a94d54fb827502466ecf0bd96dfb03
1 /*
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-pixbuf-Module-Interface.html
26 * outPack = gdkpixbuf
27 * outFile = PixbufFormat
28 * strct = GdkPixbufFormat
29 * realStrct=
30 * ctorStrct=
31 * clss = PixbufFormat
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gdk_pixbuf_format_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - gdk.Pixbuf
45 * - glib.ListSG
46 * - glib.Str
47 * structWrap:
48 * - GSList* -> ListSG
49 * - GdkPixbuf* -> Pixbuf
50 * local aliases:
53 module gdkpixbuf.PixbufFormat;
55 private import gdkpixbuf.gdkpixbuftypes;
57 private import lib.gdkpixbuf;
59 private import gdk.Pixbuf;
60 private import glib.ListSG;
61 private import glib.Str;
63 /**
64 * Description
65 * If gdk-pixbuf has been compiled with GModule support, it can be extended by
66 * modules which can load (and perhaps also save) new image and animation
67 * formats. Each loadable module must export a
68 * GdkPixbufModuleFillInfoFunc function named fill_info and
69 * a GdkPixbufModuleFillVtableFunc function named
70 * fill_vtable.
71 * In order to make format-checking work before actually loading the modules
72 * (which may require dlopening image libraries), modules export their
73 * signatures (and other information) via the fill_info
74 * function. An external utility, gdk-pixbuf-query-loaders,
75 * uses this to create a text file containing a list of all available loaders and
76 * their signatures. This file is then read at runtime by gdk-pixbuf to obtain
77 * the list of available loaders and their signatures.
78 * Modules may only implement a subset of the functionality available via
79 * GdkPixbufModule. If a particular functionality is not implemented, the
80 * fill_vtable function will simply not set the corresponding
81 * function pointers of the GdkPixbufModule structure. If a module supports
82 * incremental loading (i.e. provides begin_load, stop_load and
83 * load_increment), it doesn't have to implement load, since gdk-pixbuf can
84 * supply a generic load implementation wrapping the incremental loading.
85 * Installing a module is a two-step process:
86 * copy the module file(s) to the loader directory (normally
87 * libdir/gtk-2.0/version/loaders,
88 * unless overridden by the environment variable
89 * GDK_PIXBUF_MODULEDIR)
90 * call gdk-pixbuf-query-loaders to update the
91 * module file (normally
92 * sysconfdir/gtk-2.0/gdk-pixbuf.loaders,
93 * unless overridden by the environment variable
94 * GDK_PIXBUF_MODULE_FILE)
95 * The gdk-pixbuf interfaces needed for implementing modules are contained in
96 * gdk-pixbuf-io.h (and
97 * gdk-pixbuf-animation.h if the module supports animations).
98 * They are not covered by the same stability guarantees as the regular
99 * gdk-pixbuf API. To underline this fact, they are protected by
100 * ifdef GDK_PIXBUF_ENABLE_BACKEND.
102 public class PixbufFormat
105 /** the main Gtk struct */
106 protected GdkPixbufFormat* gdkPixbufFormat;
109 public GdkPixbufFormat* getPixbufFormatStruct()
111 return gdkPixbufFormat;
115 /** the main Gtk struct as a void* */
116 protected void* getStruct()
118 return cast(void*)gdkPixbufFormat;
122 * Sets our main struct and passes it to the parent class
124 public this (GdkPixbufFormat* gdkPixbufFormat)
126 this.gdkPixbufFormat = gdkPixbufFormat;
130 * Description
131 * The gdk-pixbuf library provides a simple mechanism for loading
132 * an image from a file in synchronous fashion. This means that the
133 * library takes control of the application while the file is being
134 * loaded; from the user's point of view, the application will block
135 * until the image is done loading.
136 * This interface can be used by applications in which blocking is
137 * acceptable while an image is being loaded. It can also be used to
138 * load small images in general. Applications that need progressive
139 * loading can use the GdkPixbufLoader functionality instead.
143 * Attaches a key/value pair as an option to a GdkPixbuf. If key already
144 * exists in the list of options attached to pixbuf, the new value is
145 * ignored and FALSE is returned.
146 * pixbuf:
147 * a GdkPixbuf
148 * key:
149 * a nul-terminated string.
150 * value:
151 * a nul-terminated string.
152 * Returns:
153 * TRUE on success.
154 * Since 2.2
156 public static int gdkPixbufSetOption(Pixbuf pixbuf, char[] key, char[] value)
158 // gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf, const gchar *key, const gchar *value);
159 return gdk_pixbuf_set_option((pixbuf is null) ? null : pixbuf.getPixbufStruct(), Str.toStringz(key), Str.toStringz(value));
163 * Obtains the available information about the image formats supported
164 * by GdkPixbuf.
165 * Returns:
166 * A list of GdkPixbufFormats describing the supported
167 * image formats. The list should be freed when it is no longer needed,
168 * but the structures themselves are owned by GdkPixbuf and should not be
169 * freed.
170 * Since 2.2
172 public static ListSG gdkPixbufGetFormats()
174 // GSList* gdk_pixbuf_get_formats (void);
175 return new ListSG( gdk_pixbuf_get_formats() );
179 * Returns the name of the format.
180 * format:
181 * a GdkPixbufFormat
182 * Returns:
183 * the name of the format.
184 * Since 2.2
186 public char[] getName()
188 // gchar* gdk_pixbuf_format_get_name (GdkPixbufFormat *format);
189 return Str.toString(gdk_pixbuf_format_get_name(gdkPixbufFormat) );
193 * Returns a description of the format.
194 * format:
195 * a GdkPixbufFormat
196 * Returns:
197 * a description of the format.
198 * Since 2.2
200 public char[] getDescription()
202 // gchar* gdk_pixbuf_format_get_description (GdkPixbufFormat *format);
203 return Str.toString(gdk_pixbuf_format_get_description(gdkPixbufFormat) );
207 * Returns the mime types supported by the format.
208 * format:
209 * a GdkPixbufFormat
210 * Returns:
211 * a NULL-terminated array of mime types which must be freed with
212 * g_strfreev() when it is no longer needed.
213 * Since 2.2
215 public char** getMimeTypes()
217 // gchar** gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format);
218 return gdk_pixbuf_format_get_mime_types(gdkPixbufFormat);
222 * Returns the filename extensions typically used for files in the
223 * given format.
224 * format:
225 * a GdkPixbufFormat
226 * Returns:
227 * a NULL-terminated array of filename extensions which must be
228 * freed with g_strfreev() when it is no longer needed.
229 * Since 2.2
231 public char** getExtensions()
233 // gchar** gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format);
234 return gdk_pixbuf_format_get_extensions(gdkPixbufFormat);
238 * Returns whether pixbufs can be saved in the given format.
239 * format:
240 * a GdkPixbufFormat
241 * Returns:
242 * whether pixbufs can be saved in the given format.
243 * Since 2.2
245 public int isWritable()
247 // gboolean gdk_pixbuf_format_is_writable (GdkPixbufFormat *format);
248 return gdk_pixbuf_format_is_writable(gdkPixbufFormat);
252 * Returns whether this image format is scalable. If a file is in a
253 * scalable format, it is preferable to load it at the desired size,
254 * rather than loading it at the default size and scaling the
255 * resulting pixbuf to the desired size.
256 * format:
257 * a GdkPixbufFormat
258 * Returns:
259 * whether this image format is scalable.
260 * Since 2.6
262 public int isScalable()
264 // gboolean gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format);
265 return gdk_pixbuf_format_is_scalable(gdkPixbufFormat);
269 * Returns whether this image format is disabled. See
270 * gdk_pixbuf_format_set_disabled().
271 * format:
272 * a GdkPixbufFormat
273 * Returns:
274 * whether this image format is disabled.
275 * Since 2.6
277 public int isDisabled()
279 // gboolean gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format);
280 return gdk_pixbuf_format_is_disabled(gdkPixbufFormat);
284 * Disables or enables an image format. If a format is disabled,
285 * gdk-pixbuf won't use the image loader for this format to load
286 * images. Applications can use this to avoid using image loaders
287 * with an inappropriate license, see gdk_pixbuf_format_get_license().
288 * format:
289 * a GdkPixbufFormat
290 * disabled:
291 * TRUE to disable the format format
292 * Since 2.6
294 public void setDisabled(int disabled)
296 // void gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format, gboolean disabled);
297 gdk_pixbuf_format_set_disabled(gdkPixbufFormat, disabled);
301 * Returns information about the license of the image loader for the format. The
302 * returned string should be a shorthand for a wellknown license, e.g. "LGPL",
303 * "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license. This
304 * string should be freed with g_free() when it's no longer needed.
305 * format:
306 * a GdkPixbufFormat
307 * Returns:
308 * a string describing the license of format.
309 * Since 2.6
311 public char[] getLicense()
313 // gchar* gdk_pixbuf_format_get_license (GdkPixbufFormat *format);
314 return Str.toString(gdk_pixbuf_format_get_license(gdkPixbufFormat) );
332 * Parses an image file far enough to determine its format and size.
333 * filename:
334 * The name of the file to identify.
335 * width:
336 * Return location for the width of the image, or NULL
337 * height:
338 * Return location for the height of the image, or NULL
339 * Returns:
340 * A GdkPixbufFormat describing the image format of the file
341 * or NULL if the image format wasn't recognized. The return value
342 * is owned by GdkPixbuf and should not be freed.
343 * Since 2.4
344 * See Also
345 * GdkPixbufLoader.
347 public static GdkPixbufFormat* getFileInfo(char[] filename, int* width, int* height)
349 // GdkPixbufFormat* gdk_pixbuf_get_file_info (const gchar *filename, gint *width, gint *height);
350 return gdk_pixbuf_get_file_info(Str.toStringz(filename), width, height);