Regenerate, restoring full UpCast functionality.
[girtod.git] / gtk2 / gdkpixbuf2.d
blobba6ed3f9efeef15eb7eb6035e66df009b472cc11
1 // *** DO NOT EDIT ***
2 // Automatically generated from "/usr/share/gir-1.0/GdkPixbuf-2.0.gir"
4 module GdkPixbuf2;
5 public import gtk2.glib2;
6 alias gtk2.glib2 GLib2;
7 public import gtk2.gmodule2;
8 alias gtk2.gmodule2 GModule2;
9 public import gtk2.gobject2;
10 alias gtk2.gobject2 GObject2;
11 public import gtk2.gio2;
12 alias gtk2.gio2 Gio2;
14 // package: "gdk-pixbuf-2.0";
15 // C header: "gdk-pixbuf/gdk-pixbuf.h";
17 // c:symbol-prefixes: ["gdk"]
18 // c:identifier-prefixes: ["Gdk"]
20 // module GdkPixbuf2;
23 // This enumeration defines the color spaces that are supported by
24 // the &gdk-pixbuf; library. Currently only RGB is supported.
25 enum Colorspace {
26 RGB = 0
29 // This enumeration describes the different interpolation modes that
30 // can be used with the scaling functions. @GDK_INTERP_NEAREST is
31 // the fastest scaling method, but has horrible quality when
32 // scaling down. @GDK_INTERP_BILINEAR is the best choice if you
33 // aren't sure what to choose, it has a good speed/quality balance.
34 // <note>
35 // Cubic filtering is missing from the list; hyperbolic
36 // interpolation is just as fast and results in higher quality.
37 // </note>
38 enum InterpType {
39 NEAREST = 0,
40 TILES = 1,
41 BILINEAR = 2,
42 HYPER = 3
44 enum int PIXBUF_FEATURES_H = 1;
45 enum int PIXBUF_MAGIC_NUMBER = 1197763408;
46 enum int PIXBUF_MAJOR = 2;
47 enum int PIXBUF_MICRO = 1;
48 enum int PIXBUF_MINOR = 24;
49 enum PIXBUF_VERSION = "2.24.1";
50 enum int PIXDATA_HEADER_LENGTH = 24;
52 // This is the main structure in the &gdk-pixbuf; library. It is
53 // used to represent images. It contains information about the
54 // image's pixel data, its color space, bits per sample, width and
55 // height, and the rowstride (the number of bytes between the start of
56 // one row and the start of the next).
57 struct Pixbuf /* : GObject.Object */ {
58 mixin Gio2.Icon.__interface__;
59 alias method_parent this;
60 alias method_parent super_;
61 alias method_parent object;
62 GObject2.Object method_parent;
65 // Creates a new #GdkPixbuf structure and allocates a buffer for it. The
66 // buffer has an optimal rowstride. Note that the buffer is not cleared;
67 // you will have to fill it completely yourself.
68 // %NULL if not enough memory could be allocated for the image buffer.
69 // RETURNS: A newly-created #GdkPixbuf with a reference count of 1, or
70 // <colorspace>: Color space for image
71 // <has_alpha>: Whether the image should have transparency information
72 // <bits_per_sample>: Number of bits per color sample
73 // <width>: Width of image in pixels, must be > 0
74 // <height>: Height of image in pixels, must be > 0
75 static Pixbuf* /*new*/ new_()(Colorspace colorspace, int has_alpha, int bits_per_sample, int width, int height) nothrow {
76 return gdk_pixbuf_new(colorspace, has_alpha, bits_per_sample, width, height);
78 static auto opCall()(Colorspace colorspace, int has_alpha, int bits_per_sample, int width, int height) {
79 return gdk_pixbuf_new(colorspace, has_alpha, bits_per_sample, width, height);
82 // Creates a new #GdkPixbuf out of in-memory image data. Currently only RGB
83 // images with 8 bits per sample are supported.
84 // RETURNS: A newly-created #GdkPixbuf structure with a reference count of 1.
85 // <data>: Image data in 8-bit/sample packed format
86 // <colorspace>: Colorspace for the image data
87 // <has_alpha>: Whether the data has an opacity channel
88 // <bits_per_sample>: Number of bits per sample
89 // <width>: Width of the image in pixels, must be > 0
90 // <height>: Height of the image in pixels, must be > 0
91 // <rowstride>: Distance in bytes between row starts
92 // <destroy_fn>: Function used to free the data when the pixbuf's reference count drops to zero, or %NULL if the data should not be freed
93 // <destroy_fn_data>: Closure data to pass to the destroy notification function
94 static Pixbuf* /*new*/ new_from_data(AT0, AT1)(AT0 /*ubyte*/ data, Colorspace colorspace, int has_alpha, int bits_per_sample, int width, int height, int rowstride, PixbufDestroyNotify destroy_fn, AT1 /*void*/ destroy_fn_data) nothrow {
95 return gdk_pixbuf_new_from_data(UpCast!(ubyte*)(data), colorspace, has_alpha, bits_per_sample, width, height, rowstride, destroy_fn, UpCast!(void*)(destroy_fn_data));
97 static auto opCall(AT0, AT1)(AT0 /*ubyte*/ data, Colorspace colorspace, int has_alpha, int bits_per_sample, int width, int height, int rowstride, PixbufDestroyNotify destroy_fn, AT1 /*void*/ destroy_fn_data) {
98 return gdk_pixbuf_new_from_data(UpCast!(ubyte*)(data), colorspace, has_alpha, bits_per_sample, width, height, rowstride, destroy_fn, UpCast!(void*)(destroy_fn_data));
101 // Creates a new pixbuf by loading an image from a file. The file format is
102 // detected automatically. If %NULL is returned, then @error will be set.
103 // Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
104 // there was no loader for the file's format, there was not enough memory to
105 // allocate the image buffer, or the image file contained invalid data.
106 // RETURNS: A newly-created pixbuf with a reference count of 1, or %NULL if
107 // <filename>: Name of file to load, in the GLib file name encoding
108 static Pixbuf* /*new*/ new_from_file(AT0, AT1)(AT0 /*char*/ filename, AT1 /*GLib2.Error**/ error=null) nothrow {
109 return gdk_pixbuf_new_from_file(toCString!(char*)(filename), UpCast!(GLib2.Error**)(error));
111 static auto opCall(AT0, AT1)(AT0 /*char*/ filename, AT1 /*GLib2.Error**/ error=null) {
112 return gdk_pixbuf_new_from_file(toCString!(char*)(filename), UpCast!(GLib2.Error**)(error));
115 // VERSION: 2.6
116 // Creates a new pixbuf by loading an image from a file. The file format is
117 // detected automatically. If %NULL is returned, then @error will be set.
118 // Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
119 // The image will be scaled to fit in the requested size, optionally preserving
120 // the image's aspect ratio.
121 // When preserving the aspect ratio, a @width of -1 will cause the image
122 // to be scaled to the exact given height, and a @height of -1 will cause
123 // the image to be scaled to the exact given width. When not preserving
124 // aspect ratio, a @width or @height of -1 means to not scale the image
125 // at all in that dimension. Negative values for @width and @height are
126 // allowed since 2.8.
127 // there was no loader for the file's format, there was not enough memory to
128 // allocate the image buffer, or the image file contained invalid data.
129 // RETURNS: A newly-created pixbuf with a reference count of 1, or %NULL
130 // <filename>: Name of file to load, in the GLib file name encoding
131 // <width>: The width the image should have or -1 to not constrain the width
132 // <height>: The height the image should have or -1 to not constrain the height
133 // <preserve_aspect_ratio>: %TRUE to preserve the image's aspect ratio
134 static Pixbuf* /*new*/ new_from_file_at_scale(AT0, AT1)(AT0 /*char*/ filename, int width, int height, int preserve_aspect_ratio, AT1 /*GLib2.Error**/ error=null) nothrow {
135 return gdk_pixbuf_new_from_file_at_scale(toCString!(char*)(filename), width, height, preserve_aspect_ratio, UpCast!(GLib2.Error**)(error));
137 static auto opCall(AT0, AT1)(AT0 /*char*/ filename, int width, int height, int preserve_aspect_ratio, AT1 /*GLib2.Error**/ error=null) {
138 return gdk_pixbuf_new_from_file_at_scale(toCString!(char*)(filename), width, height, preserve_aspect_ratio, UpCast!(GLib2.Error**)(error));
141 // VERSION: 2.4
142 // Creates a new pixbuf by loading an image from a file.
143 // The file format is detected automatically. If %NULL is returned, then
144 // #G_FILE_ERROR domains.
145 // The image will be scaled to fit in the requested size, preserving
146 // the image's aspect ratio. Note that the returned pixbuf may be smaller
147 // than @width x @height, if the aspect ratio requires it. To load
148 // and image at the requested size, regardless of aspect ratio, use
149 // gdk_pixbuf_new_from_file_at_scale().
150 // %NULL if any of several error conditions occurred: the file could not
151 // be opened, there was no loader for the file's format, there was not
152 // enough memory to allocate the image buffer, or the image file contained
153 // invalid data.
154 // RETURNS: A newly-created pixbuf with a reference count of 1, or
155 // <filename>: Name of file to load, in the GLib file name encoding
156 // <width>: The width the image should have or -1 to not constrain the width
157 // <height>: The height the image should have or -1 to not constrain the height
158 static Pixbuf* /*new*/ new_from_file_at_size(AT0, AT1)(AT0 /*char*/ filename, int width, int height, AT1 /*GLib2.Error**/ error=null) nothrow {
159 return gdk_pixbuf_new_from_file_at_size(toCString!(char*)(filename), width, height, UpCast!(GLib2.Error**)(error));
161 static auto opCall(AT0, AT1)(AT0 /*char*/ filename, int width, int height, AT1 /*GLib2.Error**/ error=null) {
162 return gdk_pixbuf_new_from_file_at_size(toCString!(char*)(filename), width, height, UpCast!(GLib2.Error**)(error));
165 // Create a #GdkPixbuf from a flat representation that is suitable for
166 // storing as inline data in a program. This is useful if you want to
167 // ship a program with images, but don't want to depend on any
168 // external files.
169 // gdk-pixbuf ships with a program called <command>gdk-pixbuf-csource</command>
170 // which allows for conversion of #GdkPixbufs into such a inline representation.
171 // In almost all cases, you should pass the <option>--raw</option> flag to
172 // <command>gdk-pixbuf-csource</command>. A sample invocation would be:
173 // <informalexample><programlisting>
174 // gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
175 // </programlisting></informalexample>
176 // For the typical case where the inline pixbuf is read-only static data,
177 // you don't need to copy the pixel data unless you intend to write to
178 // it, so you can pass %FALSE for @copy_pixels. (If you pass
179 // <option>--rle</option> to <command>gdk-pixbuf-csource</command>, a copy
180 // will be made even if @copy_pixels is %FALSE, so using this option is
181 // generally a bad idea.)
182 // If you create a pixbuf from const inline data compiled into your
183 // program, it's probably safe to ignore errors and disable length checks,
184 // since things will always succeed:
185 // <informalexample><programlisting>
186 // pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL);
187 // </programlisting></informalexample>
188 // For non-const inline data, you could get out of memory. For untrusted
189 // inline data located at runtime, you could have corrupt inline data in
190 // addition.
191 // count of 1, or %NULL if an error occurred.
192 // RETURNS: A newly-created #GdkPixbuf structure with a reference,
193 // <data_length>: Length in bytes of the @data argument or -1 to disable length checks
194 // <data>: Byte data containing a serialized #GdkPixdata structure
195 // <copy_pixels>: Whether to copy the pixel data, or use direct pointers
196 static Pixbuf* /*new*/ new_from_inline(AT0, AT1)(int data_length, AT0 /*ubyte*/ data, int copy_pixels, AT1 /*GLib2.Error**/ error=null) nothrow {
197 return gdk_pixbuf_new_from_inline(data_length, UpCast!(ubyte*)(data), copy_pixels, UpCast!(GLib2.Error**)(error));
199 static auto opCall(AT0, AT1)(int data_length, AT0 /*ubyte*/ data, int copy_pixels, AT1 /*GLib2.Error**/ error=null) {
200 return gdk_pixbuf_new_from_inline(data_length, UpCast!(ubyte*)(data), copy_pixels, UpCast!(GLib2.Error**)(error));
203 // VERSION: 2.14
204 // Creates a new pixbuf by loading an image from an input stream.
205 // The file format is detected automatically. If %NULL is returned, then
206 // from another thread. If the operation was cancelled, the error
207 // %GIO_ERROR_CANCELLED will be returned. Other possible errors are in
208 // the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains.
209 // The stream is not closed.
210 // not supported, there was not enough memory to allocate the image buffer,
211 // the stream contained invalid data, or the operation was cancelled.
212 // RETURNS: A newly-created pixbuf, or %NULL if any of several error
213 // <stream>: a #GInputStream to load the pixbuf from
214 // <cancellable>: optional #GCancellable object, %NULL to ignore
215 static Pixbuf* /*new*/ new_from_stream(AT0, AT1, AT2)(AT0 /*Gio2.InputStream*/ stream, AT1 /*Gio2.Cancellable*/ cancellable, AT2 /*GLib2.Error**/ error=null) nothrow {
216 return gdk_pixbuf_new_from_stream(UpCast!(Gio2.InputStream*)(stream), UpCast!(Gio2.Cancellable*)(cancellable), UpCast!(GLib2.Error**)(error));
218 static auto opCall(AT0, AT1, AT2)(AT0 /*Gio2.InputStream*/ stream, AT1 /*Gio2.Cancellable*/ cancellable, AT2 /*GLib2.Error**/ error=null) {
219 return gdk_pixbuf_new_from_stream(UpCast!(Gio2.InputStream*)(stream), UpCast!(Gio2.Cancellable*)(cancellable), UpCast!(GLib2.Error**)(error));
222 // VERSION: 2.14
223 // Creates a new pixbuf by loading an image from an input stream.
224 // The file format is detected automatically. If %NULL is returned, then
225 // from another thread. If the operation was cancelled, the error
226 // %GIO_ERROR_CANCELLED will be returned. Other possible errors are in
227 // the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains.
228 // The image will be scaled to fit in the requested size, optionally
229 // preserving the image's aspect ratio. When preserving the aspect ratio,
230 // a @width of -1 will cause the image to be scaled to the exact given
231 // height, and a @height of -1 will cause the image to be scaled to the
232 // exact given width. When not preserving aspect ratio, a @width or
233 // The stream is not closed.
234 // not supported, there was not enough memory to allocate the image buffer,
235 // the stream contained invalid data, or the operation was cancelled.
236 // RETURNS: A newly-created pixbuf, or %NULL if any of several error
237 // <stream>: a #GInputStream to load the pixbuf from
238 // <width>: The width the image should have or -1 to not constrain the width
239 // <height>: The height the image should have or -1 to not constrain the height
240 // <preserve_aspect_ratio>: %TRUE to preserve the image's aspect ratio
241 // <cancellable>: optional #GCancellable object, %NULL to ignore
242 static Pixbuf* /*new*/ new_from_stream_at_scale(AT0, AT1, AT2)(AT0 /*Gio2.InputStream*/ stream, int width, int height, int preserve_aspect_ratio, AT1 /*Gio2.Cancellable*/ cancellable, AT2 /*GLib2.Error**/ error=null) nothrow {
243 return gdk_pixbuf_new_from_stream_at_scale(UpCast!(Gio2.InputStream*)(stream), width, height, preserve_aspect_ratio, UpCast!(Gio2.Cancellable*)(cancellable), UpCast!(GLib2.Error**)(error));
245 static auto opCall(AT0, AT1, AT2)(AT0 /*Gio2.InputStream*/ stream, int width, int height, int preserve_aspect_ratio, AT1 /*Gio2.Cancellable*/ cancellable, AT2 /*GLib2.Error**/ error=null) {
246 return gdk_pixbuf_new_from_stream_at_scale(UpCast!(Gio2.InputStream*)(stream), width, height, preserve_aspect_ratio, UpCast!(Gio2.Cancellable*)(cancellable), UpCast!(GLib2.Error**)(error));
249 // VERSION: 2.24
250 // Finishes an asynchronous pixbuf creation operation started with
251 // gdk_pixbuf_new_from_stream_async().
252 // object with g_object_unref().
253 // RETURNS: a #GdkPixbuf or %NULL on error. Free the returned
254 // <async_result>: a #GAsyncResult
255 static Pixbuf* /*new*/ new_from_stream_finish(AT0, AT1)(AT0 /*Gio2.AsyncResult*/ async_result, AT1 /*GLib2.Error**/ error=null) nothrow {
256 return gdk_pixbuf_new_from_stream_finish(UpCast!(Gio2.AsyncResult*)(async_result), UpCast!(GLib2.Error**)(error));
258 static auto opCall(AT0, AT1)(AT0 /*Gio2.AsyncResult*/ async_result, AT1 /*GLib2.Error**/ error=null) {
259 return gdk_pixbuf_new_from_stream_finish(UpCast!(Gio2.AsyncResult*)(async_result), UpCast!(GLib2.Error**)(error));
262 // Creates a new pixbuf by parsing XPM data in memory. This data is commonly
263 // the result of including an XPM file into a program's C source.
264 // RETURNS: A newly-created pixbuf with a reference count of 1.
265 // <data>: Pointer to inline XPM data.
266 static Pixbuf* /*new*/ new_from_xpm_data(AT0)(AT0 /*char**/ data) nothrow {
267 return gdk_pixbuf_new_from_xpm_data(toCString!(char**)(data));
269 static auto opCall(AT0)(AT0 /*char**/ data) {
270 return gdk_pixbuf_new_from_xpm_data(toCString!(char**)(data));
273 // Unintrospectable function: from_pixdata() / gdk_pixbuf_from_pixdata()
274 // Converts a #GdkPixdata to a #GdkPixbuf. If @copy_pixels is %TRUE or
275 // if the pixel data is run-length-encoded, the pixel data is copied into
276 // newly-allocated memory; otherwise it is reused.
277 // RETURNS: a new #GdkPixbuf.
278 // <pixdata>: a #GdkPixdata to convert into a #GdkPixbuf.
279 // <copy_pixels>: whether to copy raw pixel data; run-length encoded pixel data is always copied.
280 static Pixbuf* from_pixdata(AT0, AT1)(AT0 /*Pixdata*/ pixdata, int copy_pixels, AT1 /*GLib2.Error**/ error=null) nothrow {
281 return gdk_pixbuf_from_pixdata(UpCast!(Pixdata*)(pixdata), copy_pixels, UpCast!(GLib2.Error**)(error));
284 // VERSION: 2.4
285 // Parses an image file far enough to determine its format and size.
286 // or %NULL if the image format wasn't recognized. The return value
287 // is owned by GdkPixbuf and should not be freed.
288 // RETURNS: A #GdkPixbufFormat describing the image format of the file
289 // <filename>: The name of the file to identify.
290 // <width>: Return location for the width of the image, or %NULL
291 // <height>: Return location for the height of the image, or %NULL
292 static PixbufFormat* /*new*/ get_file_info(AT0)(AT0 /*char*/ filename, int* width, int* height) nothrow {
293 return gdk_pixbuf_get_file_info(toCString!(char*)(filename), width, height);
296 // VERSION: 2.2
297 // Obtains the available information about the image formats supported
298 // by GdkPixbuf.
299 // #GdkPixbufFormat<!-- -->s describing the supported
300 // image formats. The list should be freed when it is no longer needed,
301 // but the structures themselves are owned by #GdkPixbuf and should not be
302 // freed.
303 // RETURNS: A list of
304 static GLib2.SList* /*new container*/ get_formats()() nothrow {
305 return gdk_pixbuf_get_formats();
307 static char* gettext(AT0)(AT0 /*char*/ msgid) nothrow {
308 return gdk_pixbuf_gettext(toCString!(char*)(msgid));
311 // VERSION: 2.24
312 // Creates a new pixbuf by asynchronously loading an image from an input stream.
313 // For more details see gdk_pixbuf_new_from_stream(), which is the synchronous
314 // version of this function.
315 // When the operation is finished, @callback will be called in the main thread.
316 // You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation.
317 // <stream>: a #GInputStream from which to load the pixbuf
318 // <cancellable>: optional #GCancellable object, %NULL to ignore
319 // <callback>: a #GAsyncReadyCallback to call when the the pixbuf is loaded
320 // <user_data>: the data to pass to the callback function
321 static void new_from_stream_async(AT0, AT1, AT2)(AT0 /*Gio2.InputStream*/ stream, AT1 /*Gio2.Cancellable*/ cancellable, Gio2.AsyncReadyCallback callback, AT2 /*void*/ user_data) nothrow {
322 gdk_pixbuf_new_from_stream_async(UpCast!(Gio2.InputStream*)(stream), UpCast!(Gio2.Cancellable*)(cancellable), callback, UpCast!(void*)(user_data));
325 // VERSION: 2.24
326 // Creates a new pixbuf by asynchronously loading an image from an input stream.
327 // For more details see gdk_pixbuf_new_from_stream_at_scale(), which is the synchronous
328 // version of this function.
329 // When the operation is finished, @callback will be called in the main thread.
330 // You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation.
331 // <stream>: a #GInputStream from which to load the pixbuf
332 // <width>: the width the image should have or -1 to not constrain the width
333 // <height>: the height the image should have or -1 to not constrain the height
334 // <preserve_aspect_ratio>: %TRUE to preserve the image's aspect ratio
335 // <cancellable>: optional #GCancellable object, %NULL to ignore
336 // <callback>: a #GAsyncReadyCallback to call when the the pixbuf is loaded
337 // <user_data>: the data to pass to the callback function
338 static void new_from_stream_at_scale_async(AT0, AT1, AT2)(AT0 /*Gio2.InputStream*/ stream, int width, int height, int preserve_aspect_ratio, AT1 /*Gio2.Cancellable*/ cancellable, Gio2.AsyncReadyCallback callback, AT2 /*void*/ user_data) nothrow {
339 gdk_pixbuf_new_from_stream_at_scale_async(UpCast!(Gio2.InputStream*)(stream), width, height, preserve_aspect_ratio, UpCast!(Gio2.Cancellable*)(cancellable), callback, UpCast!(void*)(user_data));
342 // VERSION: 2.24
343 // Finishes an asynchronous pixbuf save operation started with
344 // gdk_pixbuf_save_to_stream_async().
345 // RETURNS: %TRUE if the pixbuf was saved successfully, %FALSE if an error was set.
346 // <async_result>: a #GAsyncResult
347 static int save_to_stream_finish(AT0, AT1)(AT0 /*Gio2.AsyncResult*/ async_result, AT1 /*GLib2.Error**/ error=null) nothrow {
348 return gdk_pixbuf_save_to_stream_finish(UpCast!(Gio2.AsyncResult*)(async_result), UpCast!(GLib2.Error**)(error));
351 // Takes an existing pixbuf and adds an alpha channel to it.
352 // If the existing pixbuf already had an alpha channel, the channel
353 // values are copied from the original; otherwise, the alpha channel
354 // is initialized to 255 (full opacity).
355 // If @substitute_color is %TRUE, then the color specified by (@r, @g, @b) will be
356 // assigned zero opacity. That is, if you pass (255, 255, 255) for the
357 // substitute color, all white pixels will become fully transparent.
358 // RETURNS: A newly-created pixbuf with a reference count of 1.
359 // <substitute_color>: Whether to set a color to zero opacity. If this is %FALSE, then the (@r, @g, @b) arguments will be ignored.
360 // <r>: Red value to substitute.
361 // <g>: Green value to substitute.
362 // <b>: Blue value to substitute.
363 Pixbuf* /*new*/ add_alpha()(int substitute_color, ubyte r, ubyte g, ubyte b) nothrow {
364 return gdk_pixbuf_add_alpha(&this, substitute_color, r, g, b);
367 // VERSION: 2.12
368 // Takes an existing pixbuf and checks for the presence of an
369 // associated "orientation" option, which may be provided by the
370 // jpeg loader (which reads the exif orientation tag) or the
371 // tiff loader (which reads the tiff orientation tag, and
372 // compensates it for the partial transforms performed by
373 // libtiff). If an orientation option/tag is present, the
374 // appropriate transform will be performed so that the pixbuf
375 // is oriented correctly.
376 // input pixbuf (with an increased reference count).
377 // RETURNS: A newly-created pixbuf, or a reference to the
378 Pixbuf* /*new*/ apply_embedded_orientation()() nothrow {
379 return gdk_pixbuf_apply_embedded_orientation(&this);
382 // Creates a transformation of the source image @src by scaling by
383 // This gives an image in the coordinates of the destination pixbuf.
384 // The rectangle (@dest_x, @dest_y, @dest_width, @dest_height)
385 // is then composited onto the corresponding rectangle of the
386 // original destination image.
387 // When the destination rectangle contains parts not in the source
388 // image, the data at the edges of the source image is replicated
389 // to infinity.
390 // <figure id="pixbuf-composite-diagram">
391 // <title>Compositing of pixbufs</title>
392 // <graphic fileref="composite.png" format="PNG"/>
393 // </figure>
394 // <dest>: the #GdkPixbuf into which to render the results
395 // <dest_x>: the left coordinate for region to render
396 // <dest_y>: the top coordinate for region to render
397 // <dest_width>: the width of the region to render
398 // <dest_height>: the height of the region to render
399 // <offset_x>: the offset in the X direction (currently rounded to an integer)
400 // <offset_y>: the offset in the Y direction (currently rounded to an integer)
401 // <scale_x>: the scale factor in the X direction
402 // <scale_y>: the scale factor in the Y direction
403 // <interp_type>: the interpolation type for the transformation.
404 // <overall_alpha>: overall alpha for source image (0..255)
405 void composite(AT0)(AT0 /*Pixbuf*/ dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha) nothrow {
406 gdk_pixbuf_composite(&this, UpCast!(Pixbuf*)(dest), dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, interp_type, overall_alpha);
409 // Creates a transformation of the source image @src by scaling by
410 // then composites the rectangle (@dest_x ,@dest_y, @dest_width,
411 // colors @color1 and @color2 and renders it onto the destination
412 // image.
413 // See gdk_pixbuf_composite_color_simple() for a simpler variant of this
414 // function suitable for many tasks.
415 // <dest>: the #GdkPixbuf into which to render the results
416 // <dest_x>: the left coordinate for region to render
417 // <dest_y>: the top coordinate for region to render
418 // <dest_width>: the width of the region to render
419 // <dest_height>: the height of the region to render
420 // <offset_x>: the offset in the X direction (currently rounded to an integer)
421 // <offset_y>: the offset in the Y direction (currently rounded to an integer)
422 // <scale_x>: the scale factor in the X direction
423 // <scale_y>: the scale factor in the Y direction
424 // <interp_type>: the interpolation type for the transformation.
425 // <overall_alpha>: overall alpha for source image (0..255)
426 // <check_x>: the X offset for the checkboard (origin of checkboard is at -@check_x, -@check_y)
427 // <check_y>: the Y offset for the checkboard
428 // <check_size>: the size of checks in the checkboard (must be a power of two)
429 // <color1>: the color of check at upper left
430 // <color2>: the color of the other check
431 void composite_color(AT0)(AT0 /*Pixbuf*/ dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha, int check_x, int check_y, int check_size, uint color1, uint color2) nothrow {
432 gdk_pixbuf_composite_color(&this, UpCast!(Pixbuf*)(dest), dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, interp_type, overall_alpha, check_x, check_y, check_size, color1, color2);
435 // Creates a new #GdkPixbuf by scaling @src to @dest_width x
436 // allocated for it.
437 // RETURNS: the new #GdkPixbuf, or %NULL if not enough memory could be
438 // <dest_width>: the width of destination image
439 // <dest_height>: the height of destination image
440 // <interp_type>: the interpolation type for the transformation.
441 // <overall_alpha>: overall alpha for source image (0..255)
442 // <check_size>: the size of checks in the checkboard (must be a power of two)
443 // <color1>: the color of check at upper left
444 // <color2>: the color of the other check
445 Pixbuf* /*new*/ composite_color_simple()(int dest_width, int dest_height, InterpType interp_type, int overall_alpha, int check_size, uint color1, uint color2) nothrow {
446 return gdk_pixbuf_composite_color_simple(&this, dest_width, dest_height, interp_type, overall_alpha, check_size, color1, color2);
449 // Creates a new #GdkPixbuf with a copy of the information in the specified
450 // not enough memory could be allocated.
451 // RETURNS: A newly-created pixbuf with a reference count of 1, or %NULL if
452 Pixbuf* /*new*/ copy()() nothrow {
453 return gdk_pixbuf_copy(&this);
456 // Copies a rectangular area from @src_pixbuf to @dest_pixbuf. Conversion of
457 // pixbuf formats is done automatically.
458 // If the source rectangle overlaps the destination rectangle on the
459 // same pixbuf, it will be overwritten during the copy operation.
460 // Therefore, you can not use this function to scroll a pixbuf.
461 // <src_x>: Source X coordinate within @src_pixbuf.
462 // <src_y>: Source Y coordinate within @src_pixbuf.
463 // <width>: Width of the area to copy.
464 // <height>: Height of the area to copy.
465 // <dest_pixbuf>: Destination pixbuf.
466 // <dest_x>: X coordinate within @dest_pixbuf.
467 // <dest_y>: Y coordinate within @dest_pixbuf.
468 void copy_area(AT0)(int src_x, int src_y, int width, int height, AT0 /*Pixbuf*/ dest_pixbuf, int dest_x, int dest_y) nothrow {
469 gdk_pixbuf_copy_area(&this, src_x, src_y, width, height, UpCast!(Pixbuf*)(dest_pixbuf), dest_x, dest_y);
472 // Clears a pixbuf to the given RGBA value, converting the RGBA value into
473 // the pixbuf's pixel format. The alpha will be ignored if the pixbuf
474 // doesn't have an alpha channel.
475 // <pixel>: RGBA pixel to clear to (0xffffffff is opaque white, 0x00000000 transparent black)
476 void fill()(uint pixel) nothrow {
477 gdk_pixbuf_fill(&this, pixel);
480 // VERSION: 2.6
481 // Flips a pixbuf horizontally or vertically and returns the
482 // result in a new pixbuf.
483 // allocated for it.
484 // RETURNS: the new #GdkPixbuf, or %NULL if not enough memory could be
485 // <horizontal>: %TRUE to flip horizontally, %FALSE to flip vertically
486 Pixbuf* /*new*/ flip()(int horizontal) nothrow {
487 return gdk_pixbuf_flip(&this, horizontal);
490 // Queries the number of bits per color sample in a pixbuf.
491 // RETURNS: Number of bits per color sample.
492 int get_bits_per_sample()() nothrow {
493 return gdk_pixbuf_get_bits_per_sample(&this);
496 // Queries the color space of a pixbuf.
497 // RETURNS: Color space.
498 Colorspace get_colorspace()() nothrow {
499 return gdk_pixbuf_get_colorspace(&this);
502 // Queries whether a pixbuf has an alpha channel (opacity information).
503 // RETURNS: %TRUE if it has an alpha channel, %FALSE otherwise.
504 int get_has_alpha()() nothrow {
505 return gdk_pixbuf_get_has_alpha(&this);
508 // Queries the height of a pixbuf.
509 // RETURNS: Height in pixels.
510 int get_height()() nothrow {
511 return gdk_pixbuf_get_height(&this);
514 // Queries the number of channels of a pixbuf.
515 // RETURNS: Number of channels.
516 int get_n_channels()() nothrow {
517 return gdk_pixbuf_get_n_channels(&this);
520 // Looks up @key in the list of options that may have been attached to the
521 // function using gdk_pixbuf_set_option().
522 // For instance, the ANI loader provides "Title" and "Artist" options.
523 // The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot
524 // options for cursor definitions. The PNG loader provides the tEXt ancillary
525 // chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
526 // return an "orientation" option string that corresponds to the embedded
527 // TIFF/Exif orientation tag (if present).
528 // string that should not be freed or %NULL if @key was not found.
529 // RETURNS: the value associated with @key. This is a nul-terminated
530 // <key>: a nul-terminated string.
531 char* get_option(AT0)(AT0 /*char*/ key) nothrow {
532 return gdk_pixbuf_get_option(&this, toCString!(char*)(key));
535 // Queries a pointer to the pixel data of a pixbuf.
536 // for information about how the pixel data is stored in
537 // memory.
538 // RETURNS: A pointer to the pixbuf's pixel data. Please see <xref linkend="image-data"/>
539 ubyte* get_pixels()() nothrow {
540 return gdk_pixbuf_get_pixels(&this);
543 // Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row
544 // and the start of the next row.
545 // RETURNS: Distance between row starts.
546 int get_rowstride()() nothrow {
547 return gdk_pixbuf_get_rowstride(&this);
550 // Queries the width of a pixbuf.
551 // RETURNS: Width in pixels.
552 int get_width()() nothrow {
553 return gdk_pixbuf_get_width(&this);
556 // Creates a new pixbuf which represents a sub-region of
557 // original pixbuf, so writing to one affects both.
558 // The new pixbuf holds a reference to @src_pixbuf, so
559 // is finalized.
560 // RETURNS: a new pixbuf
561 // <src_x>: X coord in @src_pixbuf
562 // <src_y>: Y coord in @src_pixbuf
563 // <width>: width of region in @src_pixbuf
564 // <height>: height of region in @src_pixbuf
565 Pixbuf* /*new*/ new_subpixbuf()(int src_x, int src_y, int width, int height) nothrow {
566 return gdk_pixbuf_new_subpixbuf(&this, src_x, src_y, width, height);
569 // Unintrospectable method: ref() / gdk_pixbuf_ref()
570 // DEPRECATED (v2.0) method: ref - Use g_object_ref().
571 // Adds a reference to a pixbuf.
572 // RETURNS: The same as the @pixbuf argument.
573 Pixbuf* ref_()() nothrow {
574 return gdk_pixbuf_ref(&this);
577 // VERSION: 2.6
578 // Rotates a pixbuf by a multiple of 90 degrees, and returns the
579 // result in a new pixbuf.
580 // allocated for it.
581 // RETURNS: the new #GdkPixbuf, or %NULL if not enough memory could be
582 // <angle>: the angle to rotate by
583 Pixbuf* /*new*/ rotate_simple()(PixbufRotation angle) nothrow {
584 return gdk_pixbuf_rotate_simple(&this, angle);
587 // Modifies saturation and optionally pixelates @src, placing the result in
588 // saturation is reduced (the image turns toward grayscale); if greater than
589 // 1.0, saturation is increased (the image gets more vivid colors). If @pixelate
590 // is %TRUE, then pixels are faded in a checkerboard pattern to create a
591 // pixelated image. @src and @dest must have the same image format, size, and
592 // rowstride.
593 // <dest>: place to write modified version of @src
594 // <saturation>: saturation factor
595 // <pixelate>: whether to pixelate
596 void saturate_and_pixelate(AT0)(AT0 /*Pixbuf*/ dest, float saturation, int pixelate) nothrow {
597 gdk_pixbuf_saturate_and_pixelate(&this, UpCast!(Pixbuf*)(dest), saturation, pixelate);
600 // Unintrospectable method: save() / gdk_pixbuf_save()
601 // Saves pixbuf to a file in format @type. By default, "jpeg", "png", "ico"
602 // and "bmp" are possible file formats to save in, but more formats may be
603 // installed. The list of all writable formats can be determined in the
604 // following way:
605 // |[
606 // void add_if_writable (GdkPixbufFormat *data, GSList **list)
607 // {
608 // if (gdk_pixbuf_format_is_writable (data))
609 // *list = g_slist_prepend (*list, data);
610 // }
611 // GSList *formats = gdk_pixbuf_get_formats ();
612 // GSList *writable_formats = NULL;
613 // g_slist_foreach (formats, add_if_writable, &writable_formats);
614 // g_slist_free (formats);
615 // ]|
616 // If @error is set, %FALSE will be returned. Possible errors include
617 // those in the #GDK_PIXBUF_ERROR domain and those in the #G_FILE_ERROR domain.
618 // The variable argument list should be %NULL-terminated; if not empty,
619 // it should contain pairs of strings that modify the save
620 // parameters. For example:
621 // <informalexample><programlisting>
622 // gdk_pixbuf_save (pixbuf, handle, "jpeg", &amp;error,
623 // "quality", "100", NULL);
624 // </programlisting></informalexample>
625 // Currently only few parameters exist. JPEG images can be saved with a
626 // "quality" parameter; its value should be in the range [0,100].
627 // Text chunks can be attached to PNG images by specifying parameters of
628 // the form "tEXt::key", where key is an ASCII string of length 1-79.
629 // The values are UTF-8 encoded strings. The PNG compression level can
630 // be specified using the "compression" parameter; it's value is in an
631 // integer in the range of [0,9].
632 // ICC color profiles can also be embedded into PNG and TIFF images.
633 // The "icc-profile" value should be the complete ICC profile encoded
634 // into base64.
635 // <informalexample><programlisting>
636 // gchar *contents;
637 // gchar *contents_encode;
638 // gsize length;
639 // g_file_get_contents ("/home/hughsie/.color/icc/L225W.icm", &contents, &length, NULL);
640 // contents_encode = g_base64_encode ((const guchar *) contents, length);
641 // gdk_pixbuf_save (pixbuf, handle, "png", &amp;error,
642 // "icc-profile", contents_encode,
643 // NULL);
644 // </programlisting></informalexample>
645 // TIFF images recognize a "compression" option which acceps an integer value.
646 // Among the codecs are 1 None, 2 Huffman, 5 LZW, 7 JPEG and 8 Deflate, see
647 // the libtiff documentation and tiff.h for all supported codec values.
648 // ICO images can be saved in depth 16, 24, or 32, by using the "depth"
649 // parameter. When the ICO saver is given "x_hot" and "y_hot" parameters,
650 // it produces a CUR instead of an ICO.
651 // RETURNS: whether an error was set
652 // <filename>: name of file to save.
653 // <type>: name of file format.
654 // <error>: return location for error, or %NULL
655 /+ Not available -- variadic methods unsupported - use the C function directly.
656 alias gdk_pixbuf_save save; // Variadic
659 // Unintrospectable method: save_to_buffer() / gdk_pixbuf_save_to_buffer()
660 // VERSION: 2.4
661 // Saves pixbuf to a new buffer in format @type, which is currently "jpeg",
662 // "png", "tiff", "ico" or "bmp". This is a convenience function that uses
663 // gdk_pixbuf_save_to_callback() to do the real work. Note that the buffer
664 // is not nul-terminated and may contain embedded nuls.
665 // If @error is set, %FALSE will be returned and @buffer will be set to
666 // %NULL. Possible errors include those in the #GDK_PIXBUF_ERROR
667 // domain.
668 // See gdk_pixbuf_save() for more details.
669 // RETURNS: whether an error was set
670 // <buffer>: location to receive a pointer to the new buffer.
671 // <buffer_size>: location to receive the size of the new buffer.
672 // <type>: name of file format.
673 // <error>: return location for error, or %NULL
674 /+ Not available -- variadic methods unsupported - use the C function directly.
675 alias gdk_pixbuf_save_to_buffer save_to_buffer; // Variadic
678 // VERSION: 2.4
679 // Saves pixbuf to a new buffer in format @type, which is currently "jpeg",
680 // "tiff", "png", "ico" or "bmp". See gdk_pixbuf_save_to_buffer()
681 // for more details.
682 // RETURNS: whether an error was set
683 // <buffer>: location to receive a pointer to the new buffer.
684 // <buffer_size>: location to receive the size of the new buffer.
685 // <type>: name of file format.
686 // <option_keys>: name of options to set, %NULL-terminated
687 // <option_values>: values for named options
688 int save_to_bufferv(AT0, AT1, AT2, AT3, AT4, AT5)(AT0 /*char**/ buffer, AT1 /*size_t*/ buffer_size, AT2 /*char*/ type, AT3 /*char**/ option_keys, AT4 /*char**/ option_values, AT5 /*GLib2.Error**/ error=null) nothrow {
689 return gdk_pixbuf_save_to_bufferv(&this, toCString!(char**)(buffer), UpCast!(size_t*)(buffer_size), toCString!(char*)(type), toCString!(char**)(option_keys), toCString!(char**)(option_values), UpCast!(GLib2.Error**)(error));
692 // Unintrospectable method: save_to_callback() / gdk_pixbuf_save_to_callback()
693 // VERSION: 2.4
694 // Saves pixbuf in format @type by feeding the produced data to a
695 // callback. Can be used when you want to store the image to something
696 // other than a file, such as an in-memory buffer or a socket.
697 // If @error is set, %FALSE will be returned. Possible errors
698 // include those in the #GDK_PIXBUF_ERROR domain and whatever the save
699 // function generates.
700 // See gdk_pixbuf_save() for more details.
701 // RETURNS: whether an error was set
702 // <save_func>: a function that is called to save each block of data that the save routine generates.
703 // <user_data>: user data to pass to the save function.
704 // <type>: name of file format.
705 // <error>: return location for error, or %NULL
706 /+ Not available -- variadic methods unsupported - use the C function directly.
707 alias gdk_pixbuf_save_to_callback save_to_callback; // Variadic
710 // VERSION: 2.4
711 // Saves pixbuf to a callback in format @type, which is currently "jpeg",
712 // "png", "tiff", "ico" or "bmp". If @error is set, %FALSE will be returned. See
713 // gdk_pixbuf_save_to_callback () for more details.
714 // RETURNS: whether an error was set
715 // <save_func>: a function that is called to save each block of data that the save routine generates.
716 // <user_data>: user data to pass to the save function.
717 // <type>: name of file format.
718 // <option_keys>: name of options to set, %NULL-terminated
719 // <option_values>: values for named options
720 int save_to_callbackv(AT0, AT1, AT2, AT3, AT4)(PixbufSaveFunc save_func, AT0 /*void*/ user_data, AT1 /*char*/ type, AT2 /*char**/ option_keys, AT3 /*char**/ option_values, AT4 /*GLib2.Error**/ error=null) nothrow {
721 return gdk_pixbuf_save_to_callbackv(&this, save_func, UpCast!(void*)(user_data), toCString!(char*)(type), toCString!(char**)(option_keys), toCString!(char**)(option_values), UpCast!(GLib2.Error**)(error));
724 // Unintrospectable method: save_to_stream() / gdk_pixbuf_save_to_stream()
725 // VERSION: 2.14
726 // Saves @pixbuf to an output stream.
727 // Supported file formats are currently "jpeg", "tiff", "png", "ico" or
728 // "bmp". See gdk_pixbuf_save_to_buffer() for more details.
729 // The @cancellable can be used to abort the operation from another
730 // thread. If the operation was cancelled, the error %GIO_ERROR_CANCELLED
731 // will be returned. Other possible errors are in the #GDK_PIXBUF_ERROR
732 // and %G_IO_ERROR domains.
733 // The stream is not closed.
734 // error was set.
735 // RETURNS: %TRUE if the pixbuf was saved successfully, %FALSE if an
736 // <stream>: a #GOutputStream to save the pixbuf to
737 // <type>: name of file format
738 // <cancellable>: optional #GCancellable object, %NULL to ignore
739 // <error>: return location for error, or %NULL
740 /+ Not available -- variadic methods unsupported - use the C function directly.
741 alias gdk_pixbuf_save_to_stream save_to_stream; // Variadic
744 // Unintrospectable method: save_to_stream_async() / gdk_pixbuf_save_to_stream_async()
745 // VERSION: 2.24
746 // Saves @pixbuf to an output stream asynchronously.
747 // For more details see gdk_pixbuf_save_to_stream(), which is the synchronous
748 // version of this function.
749 // When the operation is finished, @callback will be called in the main thread.
750 // You can then call gdk_pixbuf_save_to_stream_finish() to get the result of the operation.
751 // <stream>: a #GOutputStream to which to save the pixbuf
752 // <type>: name of file format
753 // <cancellable>: optional #GCancellable object, %NULL to ignore
754 // <callback>: a #GAsyncReadyCallback to call when the the pixbuf is loaded
755 // <user_data>: the data to pass to the callback function
756 /+ Not available -- variadic methods unsupported - use the C function directly.
757 alias gdk_pixbuf_save_to_stream_async save_to_stream_async; // Variadic
760 // Saves pixbuf to a file in @type, which is currently "jpeg", "png", "tiff", "ico" or "bmp".
761 // If @error is set, %FALSE will be returned.
762 // See gdk_pixbuf_save () for more details.
763 // RETURNS: whether an error was set
764 // <filename>: name of file to save.
765 // <type>: name of file format.
766 // <option_keys>: name of options to set, %NULL-terminated
767 // <option_values>: values for named options
768 int savev(AT0, AT1, AT2, AT3, AT4)(AT0 /*char*/ filename, AT1 /*char*/ type, AT2 /*char**/ option_keys, AT3 /*char**/ option_values, AT4 /*GLib2.Error**/ error=null) nothrow {
769 return gdk_pixbuf_savev(&this, toCString!(char*)(filename), toCString!(char*)(type), toCString!(char**)(option_keys), toCString!(char**)(option_values), UpCast!(GLib2.Error**)(error));
772 // Creates a transformation of the source image @src by scaling by
773 // then renders the rectangle (@dest_x, @dest_y, @dest_width,
774 // replacing the previous contents.
775 // Try to use gdk_pixbuf_scale_simple() first, this function is
776 // the industrial-strength power tool you can fall back to if
777 // gdk_pixbuf_scale_simple() isn't powerful enough.
778 // If the source rectangle overlaps the destination rectangle on the
779 // same pixbuf, it will be overwritten during the scaling which
780 // results in rendering artifacts.
781 // <dest>: the #GdkPixbuf into which to render the results
782 // <dest_x>: the left coordinate for region to render
783 // <dest_y>: the top coordinate for region to render
784 // <dest_width>: the width of the region to render
785 // <dest_height>: the height of the region to render
786 // <offset_x>: the offset in the X direction (currently rounded to an integer)
787 // <offset_y>: the offset in the Y direction (currently rounded to an integer)
788 // <scale_x>: the scale factor in the X direction
789 // <scale_y>: the scale factor in the Y direction
790 // <interp_type>: the interpolation type for the transformation.
791 void scale(AT0)(AT0 /*Pixbuf*/ dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type) nothrow {
792 gdk_pixbuf_scale(&this, UpCast!(Pixbuf*)(dest), dest_x, dest_y, dest_width, dest_height, offset_x, offset_y, scale_x, scale_y, interp_type);
795 // Create a new #GdkPixbuf containing a copy of @src scaled to
796 // should be #GDK_INTERP_NEAREST if you want maximum speed (but when
797 // scaling down #GDK_INTERP_NEAREST is usually unusably ugly). The
798 // default @interp_type should be #GDK_INTERP_BILINEAR which offers
799 // reasonable quality and speed.
800 // You can scale a sub-portion of @src by creating a sub-pixbuf
801 // pointing into @src; see gdk_pixbuf_new_subpixbuf().
802 // For more complicated scaling/compositing see gdk_pixbuf_scale()
803 // and gdk_pixbuf_composite().
804 // allocated for it.
805 // RETURNS: the new #GdkPixbuf, or %NULL if not enough memory could be
806 // <dest_width>: the width of destination image
807 // <dest_height>: the height of destination image
808 // <interp_type>: the interpolation type for the transformation.
809 Pixbuf* /*new*/ scale_simple()(int dest_width, int dest_height, InterpType interp_type) nothrow {
810 return gdk_pixbuf_scale_simple(&this, dest_width, dest_height, interp_type);
813 // Unintrospectable method: unref() / gdk_pixbuf_unref()
814 // DEPRECATED (v2.0) method: unref - Use g_object_unref().
815 // Removes a reference from a pixbuf.
816 void unref()() nothrow {
817 gdk_pixbuf_unref(&this);
822 // These values can be passed to
823 // gdk_pixbuf_render_to_drawable_alpha() to control how the alpha
824 // channel of an image should be handled. This function can create a
825 // bilevel clipping mask (black and white) and use it while painting
826 // the image. In the future, when the X Window System gets an alpha
827 // channel extension, it will be possible to do full alpha
828 // compositing onto arbitrary drawables. For now both cases fall
829 // back to a bilevel clipping mask.
830 enum PixbufAlphaMode {
831 BILEVEL = 0,
832 FULL = 1
834 // An opaque struct representing an animation.
835 struct PixbufAnimation /* : GObject.Object */ {
836 alias method_parent this;
837 alias method_parent super_;
838 alias method_parent object;
839 GObject2.Object method_parent;
842 // Creates a new animation by loading it from a file. The file format is
843 // detected automatically. If the file's format does not support multi-frame
844 // images, then an animation with a single frame will be created. Possible errors
845 // are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
846 // there was no loader for the file's format, there was not enough memory to
847 // allocate the image buffer, or the image file contained invalid data.
848 // RETURNS: A newly-created animation with a reference count of 1, or %NULL
849 // <filename>: Name of file to load, in the GLib file name encoding
850 static PixbufAnimation* /*new*/ new_from_file(AT0, AT1)(AT0 /*char*/ filename, AT1 /*GLib2.Error**/ error=null) nothrow {
851 return gdk_pixbuf_animation_new_from_file(toCString!(char*)(filename), UpCast!(GLib2.Error**)(error));
853 static auto opCall(AT0, AT1)(AT0 /*char*/ filename, AT1 /*GLib2.Error**/ error=null) {
854 return gdk_pixbuf_animation_new_from_file(toCString!(char*)(filename), UpCast!(GLib2.Error**)(error));
857 // Queries the height of the bounding box of a pixbuf animation.
858 // RETURNS: Height of the bounding box of the animation.
859 int get_height()() nothrow {
860 return gdk_pixbuf_animation_get_height(&this);
863 // Get an iterator for displaying an animation. The iterator provides
864 // the frames that should be displayed at a given time.
865 // It should be freed after use with g_object_unref().
866 // marks the beginning of animation playback. After creating an
867 // iterator, you should immediately display the pixbuf returned by
868 // gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a
869 // timeout (with g_timeout_add()) or by some other mechanism ensure
870 // that you'll update the image after
871 // gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each time
872 // the image is updated, you should reinstall the timeout with the new,
873 // possibly-changed delay time.
874 // As a shortcut, if @start_time is %NULL, the result of
875 // g_get_current_time() will be used automatically.
876 // To update the image (i.e. possibly change the result of
877 // gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation),
878 // call gdk_pixbuf_animation_iter_advance().
879 // If you're using #GdkPixbufLoader, in addition to updating the image
880 // after the delay time, you should also update it whenever you
881 // receive the area_updated signal and
882 // gdk_pixbuf_animation_iter_on_currently_loading_frame() returns
883 // %TRUE. In this case, the frame currently being fed into the loader
884 // has received new data, so needs to be refreshed. The delay time for
885 // a frame may also be modified after an area_updated signal, for
886 // example if the delay time for a frame is encoded in the data after
887 // the frame itself. So your timeout should be reinstalled after any
888 // area_updated signal.
889 // A delay time of -1 is possible, indicating "infinite."
890 // RETURNS: an iterator to move over the animation
891 // <start_time>: time when the animation starts playing
892 PixbufAnimationIter* /*new*/ get_iter(AT0)(AT0 /*GLib2.TimeVal*/ start_time) nothrow {
893 return gdk_pixbuf_animation_get_iter(&this, UpCast!(GLib2.TimeVal*)(start_time));
896 // If an animation is really just a plain image (has only one frame),
897 // this function returns that image. If the animation is an animation,
898 // this function returns a reasonable thing to display as a static
899 // unanimated image, which might be the first frame, or something more
900 // sophisticated. If an animation hasn't loaded any frames yet, this
901 // function will return %NULL.
902 // RETURNS: unanimated image representing the animation
903 Pixbuf* get_static_image()() nothrow {
904 return gdk_pixbuf_animation_get_static_image(&this);
907 // Queries the width of the bounding box of a pixbuf animation.
908 // RETURNS: Width of the bounding box of the animation.
909 int get_width()() nothrow {
910 return gdk_pixbuf_animation_get_width(&this);
913 // If you load a file with gdk_pixbuf_animation_new_from_file() and it turns
914 // out to be a plain, unanimated image, then this function will return
915 // %TRUE. Use gdk_pixbuf_animation_get_static_image() to retrieve
916 // the image.
917 // RETURNS: %TRUE if the "animation" was really just an image
918 int is_static_image()() nothrow {
919 return gdk_pixbuf_animation_is_static_image(&this);
922 // Unintrospectable method: ref() / gdk_pixbuf_animation_ref()
923 // DEPRECATED (v2.0) method: ref - Use g_object_ref().
924 // Adds a reference to an animation.
925 // RETURNS: The same as the @animation argument.
926 PixbufAnimation* ref_()() nothrow {
927 return gdk_pixbuf_animation_ref(&this);
930 // Unintrospectable method: unref() / gdk_pixbuf_animation_unref()
931 // DEPRECATED (v2.0) method: unref - Use g_object_unref().
932 // Removes a reference from an animation.
933 void unref()() nothrow {
934 gdk_pixbuf_animation_unref(&this);
939 // An opaque struct representing an iterator which points to a
940 // certain position in an animation.
941 struct PixbufAnimationIter /* : GObject.Object */ {
942 alias method_parent this;
943 alias method_parent super_;
944 alias method_parent object;
945 GObject2.Object method_parent;
948 // Possibly advances an animation to a new frame. Chooses the frame based
949 // on the start time passed to gdk_pixbuf_animation_get_iter().
950 // must be greater than or equal to the time passed to
951 // gdk_pixbuf_animation_get_iter(), and must increase or remain
952 // unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is
953 // called. That is, you can't go backward in time; animations only
954 // play forward.
955 // As a shortcut, pass %NULL for the current time and g_get_current_time()
956 // will be invoked on your behalf. So you only need to explicitly pass
957 // at double speed.
958 // If this function returns %FALSE, there's no need to update the animation
959 // display, assuming the display had been rendered prior to advancing;
960 // if %TRUE, you need to call gdk_animation_iter_get_pixbuf() and update the
961 // display with the new pixbuf.
962 // RETURNS: %TRUE if the image may need updating
963 // <current_time>: current time
964 int advance(AT0)(AT0 /*GLib2.TimeVal*/ current_time) nothrow {
965 return gdk_pixbuf_animation_iter_advance(&this, UpCast!(GLib2.TimeVal*)(current_time));
968 // Gets the number of milliseconds the current pixbuf should be displayed,
969 // or -1 if the current pixbuf should be displayed forever. g_timeout_add()
970 // conveniently takes a timeout in milliseconds, so you can use a timeout
971 // to schedule the next update.
972 // RETURNS: delay time in milliseconds (thousandths of a second)
973 int get_delay_time()() nothrow {
974 return gdk_pixbuf_animation_iter_get_delay_time(&this);
977 // Gets the current pixbuf which should be displayed; the pixbuf will
978 // be the same size as the animation itself
979 // (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
980 // This pixbuf should be displayed for
981 // gdk_pixbuf_animation_iter_get_delay_time() milliseconds. The caller
982 // of this function does not own a reference to the returned pixbuf;
983 // the returned pixbuf will become invalid when the iterator advances
984 // to the next frame, which may happen anytime you call
985 // gdk_pixbuf_animation_iter_advance(). Copy the pixbuf to keep it
986 // (don't just add a reference), as it may get recycled as you advance
987 // the iterator.
988 // RETURNS: the pixbuf to be displayed
989 Pixbuf* get_pixbuf()() nothrow {
990 return gdk_pixbuf_animation_iter_get_pixbuf(&this);
993 // Used to determine how to respond to the area_updated signal on
994 // #GdkPixbufLoader when loading an animation. area_updated is emitted
995 // for an area of the frame currently streaming in to the loader. So if
996 // you're on the currently loading frame, you need to redraw the screen for
997 // the updated area.
998 // RETURNS: %TRUE if the frame we're on is partially loaded, or the last frame
999 int on_currently_loading_frame()() nothrow {
1000 return gdk_pixbuf_animation_iter_on_currently_loading_frame(&this);
1005 // A function of this type is responsible for freeing the pixel array
1006 // of a pixbuf. The gdk_pixbuf_new_from_data() function lets you
1007 // pass in a pre-allocated pixel array so that a pixbuf can be
1008 // created from it; in this case you will need to pass in a function
1009 // of #GdkPixbufDestroyNotify so that the pixel data can be freed
1010 // when the pixbuf is finalized.
1011 // <pixels>: The pixel array of the pixbuf that is being finalized.
1012 // <data>: User closure data.
1013 extern (C) alias void function (ubyte* pixels, void* data) nothrow PixbufDestroyNotify;
1016 // An error code in the #GDK_PIXBUF_ERROR domain. Many &gdk-pixbuf;
1017 // operations can cause errors in this domain, or in the #G_FILE_ERROR
1018 // domain.
1019 enum PixbufError {
1020 CORRUPT_IMAGE = 0,
1021 INSUFFICIENT_MEMORY = 1,
1022 BAD_OPTION = 2,
1023 UNKNOWN_TYPE = 3,
1024 UNSUPPORTED_OPERATION = 4,
1025 FAILED = 5
1027 struct PixbufFormat {
1029 // VERSION: 2.22
1030 // Creates a copy of @format
1031 // gdk_pixbuf_format_free() to free the resources when done
1032 // RETURNS: the newly allocated copy of a #GdkPixbufFormat. Use
1033 PixbufFormat* /*new*/ copy()() nothrow {
1034 return gdk_pixbuf_format_copy(&this);
1037 // VERSION: 2.22
1038 // Frees the resources allocated when copying a #GdkPixbufFormat
1039 // using gdk_pixbuf_format_copy()
1040 void free()() nothrow {
1041 gdk_pixbuf_format_free(&this);
1044 // VERSION: 2.2
1045 // Returns a description of the format.
1046 // RETURNS: a description of the format.
1047 char* /*new*/ get_description()() nothrow {
1048 return gdk_pixbuf_format_get_description(&this);
1051 // VERSION: 2.2
1052 // Returns the filename extensions typically used for files in the
1053 // given format.
1054 // freed with g_strfreev() when it is no longer needed.
1055 // RETURNS: a %NULL-terminated array of filename extensions which must be
1056 char** /*new*/ get_extensions()() nothrow {
1057 return gdk_pixbuf_format_get_extensions(&this);
1060 // VERSION: 2.6
1061 // Returns information about the license of the image loader for the format. The
1062 // returned string should be a shorthand for a wellknown license, e.g. "LGPL",
1063 // "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license. This
1064 // string should be freed with g_free() when it's no longer needed.
1065 // RETURNS: a string describing the license of @format.
1066 char* /*new*/ get_license()() nothrow {
1067 return gdk_pixbuf_format_get_license(&this);
1070 // VERSION: 2.2
1071 // Returns the mime types supported by the format.
1072 // g_strfreev() when it is no longer needed.
1073 // RETURNS: a %NULL-terminated array of mime types which must be freed with
1074 char** /*new*/ get_mime_types()() nothrow {
1075 return gdk_pixbuf_format_get_mime_types(&this);
1078 // VERSION: 2.2
1079 // Returns the name of the format.
1080 // RETURNS: the name of the format.
1081 char* /*new*/ get_name()() nothrow {
1082 return gdk_pixbuf_format_get_name(&this);
1085 // VERSION: 2.6
1086 // Returns whether this image format is disabled. See
1087 // gdk_pixbuf_format_set_disabled().
1088 // RETURNS: whether this image format is disabled.
1089 int is_disabled()() nothrow {
1090 return gdk_pixbuf_format_is_disabled(&this);
1093 // VERSION: 2.6
1094 // Returns whether this image format is scalable. If a file is in a
1095 // scalable format, it is preferable to load it at the desired size,
1096 // rather than loading it at the default size and scaling the
1097 // resulting pixbuf to the desired size.
1098 // RETURNS: whether this image format is scalable.
1099 int is_scalable()() nothrow {
1100 return gdk_pixbuf_format_is_scalable(&this);
1103 // VERSION: 2.2
1104 // Returns whether pixbufs can be saved in the given format.
1105 // RETURNS: whether pixbufs can be saved in the given format.
1106 int is_writable()() nothrow {
1107 return gdk_pixbuf_format_is_writable(&this);
1110 // VERSION: 2.6
1111 // Disables or enables an image format. If a format is disabled,
1112 // gdk-pixbuf won't use the image loader for this format to load
1113 // images. Applications can use this to avoid using image loaders
1114 // with an inappropriate license, see gdk_pixbuf_format_get_license().
1115 // <disabled>: %TRUE to disable the format @format
1116 void set_disabled()(int disabled) nothrow {
1117 gdk_pixbuf_format_set_disabled(&this, disabled);
1122 // The <structname>GdkPixbufLoader</structname> struct contains only private
1123 // fields.
1124 struct PixbufLoader /* : GObject.Object */ {
1125 alias parent_instance this;
1126 alias parent_instance super_;
1127 alias parent_instance object;
1128 GObject2.Object parent_instance;
1129 private void* priv;
1132 // Creates a new pixbuf loader object.
1133 // RETURNS: A newly-created pixbuf loader.
1134 static PixbufLoader* /*new*/ new_()() nothrow {
1135 return gdk_pixbuf_loader_new();
1137 static auto opCall()() {
1138 return gdk_pixbuf_loader_new();
1141 // VERSION: 2.4
1142 // Creates a new pixbuf loader object that always attempts to parse
1143 // image data as if it were an image of mime type @mime_type, instead of
1144 // identifying the type automatically. Useful if you want an error if
1145 // the image isn't the expected mime type, for loading image formats
1146 // that can't be reliably identified by looking at the data, or if
1147 // the user manually forces a specific mime type.
1148 // The list of supported mime types depends on what image loaders
1149 // are installed, but typically "image/png", "image/jpeg", "image/gif",
1150 // "image/tiff" and "image/x-xpixmap" are among the supported mime types.
1151 // To obtain the full list of supported mime types, call
1152 // gdk_pixbuf_format_get_mime_types() on each of the #GdkPixbufFormat
1153 // structs returned by gdk_pixbuf_get_formats().
1154 // RETURNS: A newly-created pixbuf loader.
1155 // <mime_type>: the mime type to be loaded
1156 static PixbufLoader* /*new*/ new_with_mime_type(AT0, AT1)(AT0 /*char*/ mime_type, AT1 /*GLib2.Error**/ error=null) nothrow {
1157 return gdk_pixbuf_loader_new_with_mime_type(toCString!(char*)(mime_type), UpCast!(GLib2.Error**)(error));
1159 static auto opCall(AT0, AT1)(AT0 /*char*/ mime_type, AT1 /*GLib2.Error**/ error=null) {
1160 return gdk_pixbuf_loader_new_with_mime_type(toCString!(char*)(mime_type), UpCast!(GLib2.Error**)(error));
1163 // Creates a new pixbuf loader object that always attempts to parse
1164 // image data as if it were an image of type @image_type, instead of
1165 // identifying the type automatically. Useful if you want an error if
1166 // the image isn't the expected type, for loading image formats
1167 // that can't be reliably identified by looking at the data, or if
1168 // the user manually forces a specific type.
1169 // The list of supported image formats depends on what image loaders
1170 // are installed, but typically "png", "jpeg", "gif", "tiff" and
1171 // "xpm" are among the supported formats. To obtain the full list of
1172 // supported image formats, call gdk_pixbuf_format_get_name() on each
1173 // of the #GdkPixbufFormat structs returned by gdk_pixbuf_get_formats().
1174 // RETURNS: A newly-created pixbuf loader.
1175 // <image_type>: name of the image format to be loaded with the image
1176 static PixbufLoader* /*new*/ new_with_type(AT0, AT1)(AT0 /*char*/ image_type, AT1 /*GLib2.Error**/ error=null) nothrow {
1177 return gdk_pixbuf_loader_new_with_type(toCString!(char*)(image_type), UpCast!(GLib2.Error**)(error));
1179 static auto opCall(AT0, AT1)(AT0 /*char*/ image_type, AT1 /*GLib2.Error**/ error=null) {
1180 return gdk_pixbuf_loader_new_with_type(toCString!(char*)(image_type), UpCast!(GLib2.Error**)(error));
1183 // Informs a pixbuf loader that no further writes with
1184 // gdk_pixbuf_loader_write() will occur, so that it can free its
1185 // internal loading structures. Also, tries to parse any data that
1186 // hasn't yet been parsed; if the remaining data is partial or
1187 // corrupt, an error will be returned. If %FALSE is returned, @error
1188 // will be set to an error from the #GDK_PIXBUF_ERROR or #G_FILE_ERROR
1189 // domains. If you're just cancelling a load rather than expecting it
1190 // to be finished, passing %NULL for @error to ignore it is
1191 // reasonable.
1192 // Remember that this does not unref the loader, so if you plan not to
1193 // use it anymore, please g_object_unref() it.
1194 // RETURNS: %TRUE if all image data written so far was successfully
1195 int close(AT0)(AT0 /*GLib2.Error**/ error=null) nothrow {
1196 return gdk_pixbuf_loader_close(&this, UpCast!(GLib2.Error**)(error));
1199 // Queries the #GdkPixbufAnimation that a pixbuf loader is currently creating.
1200 // In general it only makes sense to call this function after the "area-prepared"
1201 // signal has been emitted by the loader. If the loader doesn't have enough
1202 // bytes yet (hasn't emitted the "area-prepared" signal) this function will
1203 // return %NULL.
1204 // RETURNS: The #GdkPixbufAnimation that the loader is loading, or %NULL if
1205 PixbufAnimation* get_animation()() nothrow {
1206 return gdk_pixbuf_loader_get_animation(&this);
1209 // VERSION: 2.2
1210 // Obtains the available information about the format of the
1211 // currently loading image file.
1212 // by GdkPixbuf and should not be freed.
1213 // RETURNS: A #GdkPixbufFormat or %NULL. The return value is owned
1214 PixbufFormat* /*new*/ get_format()() nothrow {
1215 return gdk_pixbuf_loader_get_format(&this);
1218 // Queries the #GdkPixbuf that a pixbuf loader is currently creating.
1219 // In general it only makes sense to call this function after the
1220 // "area-prepared" signal has been emitted by the loader; this means
1221 // that enough data has been read to know the size of the image that
1222 // will be allocated. If the loader has not received enough data via
1223 // gdk_pixbuf_loader_write(), then this function returns %NULL. The
1224 // returned pixbuf will be the same in all future calls to the loader,
1225 // so simply calling g_object_ref() should be sufficient to continue
1226 // using it. Additionally, if the loader is an animation, it will
1227 // return the "static image" of the animation
1228 // (see gdk_pixbuf_animation_get_static_image()).
1229 // enough data has been read to determine how to create the image buffer.
1230 // RETURNS: The #GdkPixbuf that the loader is creating, or %NULL if not
1231 Pixbuf* get_pixbuf()() nothrow {
1232 return gdk_pixbuf_loader_get_pixbuf(&this);
1235 // VERSION: 2.2
1236 // Causes the image to be scaled while it is loaded. The desired
1237 // image size can be determined relative to the original size of
1238 // the image by calling gdk_pixbuf_loader_set_size() from a
1239 // signal handler for the ::size-prepared signal.
1240 // Attempts to set the desired image size are ignored after the
1241 // emission of the ::size-prepared signal.
1242 // <width>: The desired width of the image being loaded.
1243 // <height>: The desired height of the image being loaded.
1244 void set_size()(int width, int height) nothrow {
1245 gdk_pixbuf_loader_set_size(&this, width, height);
1248 // This will cause a pixbuf loader to parse the next @count bytes of
1249 // an image. It will return %TRUE if the data was loaded successfully,
1250 // and %FALSE if an error occurred. In the latter case, the loader
1251 // will be closed, and will not accept further writes. If %FALSE is
1252 // returned, @error will be set to an error from the #GDK_PIXBUF_ERROR
1253 // or #G_FILE_ERROR domains.
1254 // cannot parse the buffer.
1255 // RETURNS: %TRUE if the write was successful, or %FALSE if the loader
1256 // <buf>: Pointer to image data.
1257 // <count>: Length of the @buf buffer in bytes.
1258 int write(AT0, AT1)(AT0 /*ubyte*/ buf, size_t count, AT1 /*GLib2.Error**/ error=null) nothrow {
1259 return gdk_pixbuf_loader_write(&this, UpCast!(ubyte*)(buf), count, UpCast!(GLib2.Error**)(error));
1262 // This signal is emitted when the pixbuf loader has allocated the
1263 // pixbuf in the desired size. After this signal is emitted,
1264 // applications can call gdk_pixbuf_loader_get_pixbuf() to fetch
1265 // the partially-loaded pixbuf.
1266 extern (C) alias static void function (PixbufLoader* this_, void* user_data=null) nothrow signal_area_prepared;
1268 ulong signal_connect(string name, CB)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {
1269 return super_.signal_connect!name(cb, data, cf);
1272 ulong signal_connect(string name:"area-prepared", CB/*:signal_area_prepared*/)
1273 (CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0)
1274 if (is(typeof(cb)==signal_area_prepared)||_ttmm!(CB, signal_area_prepared)()) {
1275 return signal_connect_data!()(&this, cast(char*)"area-prepared",
1276 cast(GObject2.Callback)cb, data, null, cf);
1279 // This signal is emitted when a significant area of the image being
1280 // loaded has been updated. Normally it means that a complete
1281 // scanline has been read in, but it could be a different area as
1282 // well. Applications can use this signal to know when to repaint
1283 // areas of an image that is being loaded.
1284 // <x>: X offset of upper-left corner of the updated area.
1285 // <y>: Y offset of upper-left corner of the updated area.
1286 // <width>: Width of updated area.
1287 // <height>: Height of updated area.
1288 extern (C) alias static void function (PixbufLoader* this_, int x, int y, int width, int height, void* user_data=null) nothrow signal_area_updated;
1289 ulong signal_connect(string name:"area-updated", CB/*:signal_area_updated*/)
1290 (CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0)
1291 if (is(typeof(cb)==signal_area_updated)||_ttmm!(CB, signal_area_updated)()) {
1292 return signal_connect_data!()(&this, cast(char*)"area-updated",
1293 cast(GObject2.Callback)cb, data, null, cf);
1296 // This signal is emitted when gdk_pixbuf_loader_close() is called.
1297 // It can be used by different parts of an application to receive
1298 // notification when an image loader is closed by the code that
1299 // drives it.
1300 extern (C) alias static void function (PixbufLoader* this_, void* user_data=null) nothrow signal_closed;
1301 ulong signal_connect(string name:"closed", CB/*:signal_closed*/)
1302 (CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0)
1303 if (is(typeof(cb)==signal_closed)||_ttmm!(CB, signal_closed)()) {
1304 return signal_connect_data!()(&this, cast(char*)"closed",
1305 cast(GObject2.Callback)cb, data, null, cf);
1308 // This signal is emitted when the pixbuf loader has been fed the
1309 // initial amount of data that is required to figure out the size
1310 // of the image that it will create. Applications can call
1311 // gdk_pixbuf_loader_set_size() in response to this signal to set
1312 // the desired size to which the image should be scaled.
1313 // <width>: the original width of the image
1314 // <height>: the original height of the image
1315 extern (C) alias static void function (PixbufLoader* this_, int width, int height, void* user_data=null) nothrow signal_size_prepared;
1316 ulong signal_connect(string name:"size-prepared", CB/*:signal_size_prepared*/)
1317 (CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0)
1318 if (is(typeof(cb)==signal_size_prepared)||_ttmm!(CB, signal_size_prepared)()) {
1319 return signal_connect_data!()(&this, cast(char*)"size-prepared",
1320 cast(GObject2.Callback)cb, data, null, cf);
1324 struct PixbufLoaderClass {
1325 GObject2.ObjectClass parent_class;
1326 extern (C) void function (PixbufLoader* loader, int width, int height) nothrow size_prepared;
1327 extern (C) void function (PixbufLoader* loader) nothrow area_prepared;
1328 extern (C) void function (PixbufLoader* loader, int x, int y, int width, int height) nothrow area_updated;
1329 extern (C) void function (PixbufLoader* loader) nothrow closed;
1333 // The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
1334 // To make them easier to use, their numerical values are the actual degrees.
1335 enum PixbufRotation {
1336 NONE = 0,
1337 COUNTERCLOCKWISE = 90,
1338 UPSIDEDOWN = 180,
1339 CLOCKWISE = 270
1342 // VERSION: 2.4
1343 // Specifies the type of the function passed to
1344 // gdk_pixbuf_save_to_callback(). It is called once for each block of
1345 // bytes that is "written" by gdk_pixbuf_save_to_callback(). If
1346 // successful it should return %TRUE. If an error occurs it should set
1347 // will fail with the same error.
1348 // RETURNS: %TRUE if successful, %FALSE (with @error set) if failed.
1349 // <buf>: bytes to be written.
1350 // <count>: number of bytes in @buf.
1351 // <error>: A location to return an error.
1352 // <data>: user data passed to gdk_pixbuf_save_to_callback().
1353 extern (C) alias int function (char* buf, size_t count, /*out*/ GLib2.Error** error, void* data) nothrow PixbufSaveFunc;
1355 // An opaque struct representing a simple animation.
1356 struct PixbufSimpleAnim /* : PixbufAnimation */ {
1357 alias method_parent this;
1358 alias method_parent super_;
1359 alias method_parent pixbufanimation;
1360 PixbufAnimation method_parent;
1363 // VERSION: 2.8
1364 // Creates a new, empty animation.
1365 // RETURNS: a newly allocated #GdkPixbufSimpleAnim
1366 // <width>: the width of the animation
1367 // <height>: the height of the animation
1368 // <rate>: the speed of the animation, in frames per second
1369 static PixbufSimpleAnim* /*new*/ new_()(int width, int height, float rate) nothrow {
1370 return gdk_pixbuf_simple_anim_new(width, height, rate);
1372 static auto opCall()(int width, int height, float rate) {
1373 return gdk_pixbuf_simple_anim_new(width, height, rate);
1376 // VERSION: 2.8
1377 // Adds a new frame to @animation. The @pixbuf must
1378 // have the dimensions specified when the animation
1379 // was constructed.
1380 // <pixbuf>: the pixbuf to add
1381 void add_frame(AT0)(AT0 /*Pixbuf*/ pixbuf) nothrow {
1382 gdk_pixbuf_simple_anim_add_frame(&this, UpCast!(Pixbuf*)(pixbuf));
1385 // VERSION: 2.18
1386 // Gets whether @animation should loop indefinitely when it reaches the end.
1387 // RETURNS: %TRUE if the animation loops forever, %FALSE otherwise
1388 int get_loop()() nothrow {
1389 return gdk_pixbuf_simple_anim_get_loop(&this);
1392 // VERSION: 2.18
1393 // Sets whether @animation should loop indefinitely when it reaches the end.
1394 // <loop>: whether to loop the animation
1395 void set_loop()(int loop) nothrow {
1396 gdk_pixbuf_simple_anim_set_loop(&this, loop);
1400 struct PixbufSimpleAnimClass {
1403 struct PixbufSimpleAnimIter /* : PixbufAnimationIter */ {
1404 alias method_parent this;
1405 alias method_parent super_;
1406 alias method_parent pixbufanimationiter;
1407 PixbufAnimationIter method_parent;
1411 // A #GdkPixdata contains pixbuf information in a form suitable for
1412 // serialization and streaming.
1413 struct Pixdata {
1414 uint magic;
1415 int length;
1416 uint pixdata_type, rowstride, width, height;
1417 ubyte* pixel_data;
1420 // Deserializes (reconstruct) a #GdkPixdata structure from a byte stream.
1421 // The byte stream consists of a straightforward writeout of the
1422 // #GdkPixdata fields in network byte order, plus the @pixel_data
1423 // bytes the structure points to.
1424 // The @pixdata contents are reconstructed byte by byte and are checked
1425 // for validity. This function may fail with %GDK_PIXBUF_CORRUPT_IMAGE
1426 // or %GDK_PIXBUF_ERROR_UNKNOWN_TYPE.
1427 // %FALSE otherwise.
1428 // RETURNS: Upon successful deserialization %TRUE is returned,
1429 // <stream_length>: length of the stream used for deserialization.
1430 // <stream>: stream of bytes containing a serialized #GdkPixdata structure.
1431 int deserialize(AT0, AT1)(uint stream_length, AT0 /*ubyte*/ stream, AT1 /*GLib2.Error**/ error=null) nothrow {
1432 return gdk_pixdata_deserialize(&this, stream_length, UpCast!(ubyte*)(stream), UpCast!(GLib2.Error**)(error));
1435 // Unintrospectable method: from_pixbuf() / gdk_pixdata_from_pixbuf()
1436 // Converts a #GdkPixbuf to a #GdkPixdata. If @use_rle is %TRUE, the
1437 // pixel data is run-length encoded into newly-allocated memory and a
1438 // pointer to that memory is returned.
1439 // for the run-length encoded pixel data, otherwise %NULL.
1440 // RETURNS: If @ure_rle is %TRUE, a pointer to the newly-allocated memory
1441 // <pixbuf>: the data to fill @pixdata with.
1442 // <use_rle>: whether to use run-length encoding for the pixel data.
1443 void* from_pixbuf(AT0)(AT0 /*Pixbuf*/ pixbuf, int use_rle) nothrow {
1444 return gdk_pixdata_from_pixbuf(&this, UpCast!(Pixbuf*)(pixbuf), use_rle);
1447 // Serializes a #GdkPixdata structure into a byte stream.
1448 // The byte stream consists of a straightforward writeout of the
1449 // #GdkPixdata fields in network byte order, plus the @pixel_data
1450 // bytes the structure points to.
1451 // #GdkPixdata structure.
1452 // RETURNS: A newly-allocated string containing the serialized
1453 // <stream_length_p>: location to store the resulting stream length in.
1454 ubyte* serialize(AT0)(AT0 /*uint*/ stream_length_p) nothrow {
1455 return gdk_pixdata_serialize(&this, UpCast!(uint*)(stream_length_p));
1458 // Unintrospectable method: to_csource() / gdk_pixdata_to_csource()
1459 // Generates C source code suitable for compiling images directly
1460 // into programs.
1461 // gdk-pixbuf ships with a program called <command>gdk-pixbuf-csource</command>
1462 // which offers a command line interface to this function.
1463 // of @pixdata.
1464 // RETURNS: a newly-allocated string containing the C source form
1465 // <name>: used for naming generated data structures or macros.
1466 // <dump_type>: a #GdkPixdataDumpType determining the kind of C source to be generated.
1467 GLib2.String* to_csource(AT0)(AT0 /*char*/ name, PixdataDumpType dump_type) nothrow {
1468 return gdk_pixdata_to_csource(&this, toCString!(char*)(name), dump_type);
1473 // An enumeration which is used by gdk_pixdata_to_csource() to
1474 // determine the form of C source to be generated. The three values
1475 // and @GDK_PIXDATA_DUMP_MACROS are mutually exclusive, as are
1476 // elements are optional flags that can be freely added.
1477 enum PixdataDumpType {
1478 PIXDATA_STREAM = 0,
1479 PIXDATA_STRUCT = 1,
1480 MACROS = 2,
1481 GTYPES = 0,
1482 CTYPES = 256,
1483 STATIC = 512,
1484 CONST = 1024,
1485 RLE_DECODER = 65536
1488 // one for the used colorspace, one for the width of the samples and one
1489 // for the encoding of the pixel data.
1490 enum PixdataType {
1491 COLOR_TYPE_RGB = 1,
1492 COLOR_TYPE_RGBA = 2,
1493 COLOR_TYPE_MASK = 255,
1494 SAMPLE_WIDTH_8 = 65536,
1495 SAMPLE_WIDTH_MASK = 983040,
1496 ENCODING_RAW = 16777216,
1497 ENCODING_RLE = 33554432,
1498 ENCODING_MASK = 251658240
1500 static GLib2.Quark pixbuf_error_quark()() nothrow {
1501 return gdk_pixbuf_error_quark();
1505 // C prototypes:
1507 extern (C) {
1508 Pixbuf* /*new*/ gdk_pixbuf_new(Colorspace colorspace, int has_alpha, int bits_per_sample, int width, int height) nothrow;
1509 Pixbuf* /*new*/ gdk_pixbuf_new_from_data(ubyte* data, Colorspace colorspace, int has_alpha, int bits_per_sample, int width, int height, int rowstride, PixbufDestroyNotify destroy_fn, void* destroy_fn_data) nothrow;
1510 Pixbuf* /*new*/ gdk_pixbuf_new_from_file(char* filename, GLib2.Error** error) nothrow;
1511 Pixbuf* /*new*/ gdk_pixbuf_new_from_file_at_scale(char* filename, int width, int height, int preserve_aspect_ratio, GLib2.Error** error) nothrow;
1512 Pixbuf* /*new*/ gdk_pixbuf_new_from_file_at_size(char* filename, int width, int height, GLib2.Error** error) nothrow;
1513 Pixbuf* /*new*/ gdk_pixbuf_new_from_inline(int data_length, ubyte* data, int copy_pixels, GLib2.Error** error) nothrow;
1514 Pixbuf* /*new*/ gdk_pixbuf_new_from_stream(Gio2.InputStream* stream, Gio2.Cancellable* cancellable, GLib2.Error** error) nothrow;
1515 Pixbuf* /*new*/ gdk_pixbuf_new_from_stream_at_scale(Gio2.InputStream* stream, int width, int height, int preserve_aspect_ratio, Gio2.Cancellable* cancellable, GLib2.Error** error) nothrow;
1516 Pixbuf* /*new*/ gdk_pixbuf_new_from_stream_finish(Gio2.AsyncResult* async_result, GLib2.Error** error) nothrow;
1517 Pixbuf* /*new*/ gdk_pixbuf_new_from_xpm_data(char** data) nothrow;
1518 Pixbuf* gdk_pixbuf_from_pixdata(Pixdata* pixdata, int copy_pixels, GLib2.Error** error) nothrow;
1519 PixbufFormat* /*new*/ gdk_pixbuf_get_file_info(char* filename, int* width, int* height) nothrow;
1520 GLib2.SList* /*new container*/ gdk_pixbuf_get_formats() nothrow;
1521 char* gdk_pixbuf_gettext(char* msgid) nothrow;
1522 void gdk_pixbuf_new_from_stream_async(Gio2.InputStream* stream, Gio2.Cancellable* cancellable, Gio2.AsyncReadyCallback callback, void* user_data) nothrow;
1523 void gdk_pixbuf_new_from_stream_at_scale_async(Gio2.InputStream* stream, int width, int height, int preserve_aspect_ratio, Gio2.Cancellable* cancellable, Gio2.AsyncReadyCallback callback, void* user_data) nothrow;
1524 int gdk_pixbuf_save_to_stream_finish(Gio2.AsyncResult* async_result, GLib2.Error** error) nothrow;
1525 Pixbuf* /*new*/ gdk_pixbuf_add_alpha(Pixbuf* this_, int substitute_color, ubyte r, ubyte g, ubyte b) nothrow;
1526 Pixbuf* /*new*/ gdk_pixbuf_apply_embedded_orientation(Pixbuf* this_) nothrow;
1527 void gdk_pixbuf_composite(Pixbuf* this_, Pixbuf* dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha) nothrow;
1528 void gdk_pixbuf_composite_color(Pixbuf* this_, Pixbuf* dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type, int overall_alpha, int check_x, int check_y, int check_size, uint color1, uint color2) nothrow;
1529 Pixbuf* /*new*/ gdk_pixbuf_composite_color_simple(Pixbuf* this_, int dest_width, int dest_height, InterpType interp_type, int overall_alpha, int check_size, uint color1, uint color2) nothrow;
1530 Pixbuf* /*new*/ gdk_pixbuf_copy(Pixbuf* this_) nothrow;
1531 void gdk_pixbuf_copy_area(Pixbuf* this_, int src_x, int src_y, int width, int height, Pixbuf* dest_pixbuf, int dest_x, int dest_y) nothrow;
1532 void gdk_pixbuf_fill(Pixbuf* this_, uint pixel) nothrow;
1533 Pixbuf* /*new*/ gdk_pixbuf_flip(Pixbuf* this_, int horizontal) nothrow;
1534 int gdk_pixbuf_get_bits_per_sample(Pixbuf* this_) nothrow;
1535 Colorspace gdk_pixbuf_get_colorspace(Pixbuf* this_) nothrow;
1536 int gdk_pixbuf_get_has_alpha(Pixbuf* this_) nothrow;
1537 int gdk_pixbuf_get_height(Pixbuf* this_) nothrow;
1538 int gdk_pixbuf_get_n_channels(Pixbuf* this_) nothrow;
1539 char* gdk_pixbuf_get_option(Pixbuf* this_, char* key) nothrow;
1540 ubyte* gdk_pixbuf_get_pixels(Pixbuf* this_) nothrow;
1541 int gdk_pixbuf_get_rowstride(Pixbuf* this_) nothrow;
1542 int gdk_pixbuf_get_width(Pixbuf* this_) nothrow;
1543 Pixbuf* /*new*/ gdk_pixbuf_new_subpixbuf(Pixbuf* this_, int src_x, int src_y, int width, int height) nothrow;
1544 Pixbuf* gdk_pixbuf_ref(Pixbuf* this_) nothrow;
1545 Pixbuf* /*new*/ gdk_pixbuf_rotate_simple(Pixbuf* this_, PixbufRotation angle) nothrow;
1546 void gdk_pixbuf_saturate_and_pixelate(Pixbuf* this_, Pixbuf* dest, float saturation, int pixelate) nothrow;
1547 int gdk_pixbuf_save(Pixbuf* this_, char* filename, char* type, GLib2.Error** error=null, ...) nothrow;
1548 int gdk_pixbuf_save_to_buffer(Pixbuf* this_, char** buffer, size_t* buffer_size, char* type, GLib2.Error** error=null, ...) nothrow;
1549 int gdk_pixbuf_save_to_bufferv(Pixbuf* this_, char** buffer, size_t* buffer_size, char* type, char** option_keys, char** option_values, GLib2.Error** error) nothrow;
1550 int gdk_pixbuf_save_to_callback(Pixbuf* this_, PixbufSaveFunc save_func, void* user_data, char* type, GLib2.Error** error=null, ...) nothrow;
1551 int gdk_pixbuf_save_to_callbackv(Pixbuf* this_, PixbufSaveFunc save_func, void* user_data, char* type, char** option_keys, char** option_values, GLib2.Error** error) nothrow;
1552 int gdk_pixbuf_save_to_stream(Pixbuf* this_, Gio2.OutputStream* stream, char* type, Gio2.Cancellable* cancellable=null, GLib2.Error** error=null, ...) nothrow;
1553 void gdk_pixbuf_save_to_stream_async(Pixbuf* this_, Gio2.OutputStream* stream, char* type, Gio2.Cancellable* cancellable, Gio2.AsyncReadyCallback callback, void* user_data, ...) nothrow;
1554 int gdk_pixbuf_savev(Pixbuf* this_, char* filename, char* type, char** option_keys, char** option_values, GLib2.Error** error) nothrow;
1555 void gdk_pixbuf_scale(Pixbuf* this_, Pixbuf* dest, int dest_x, int dest_y, int dest_width, int dest_height, double offset_x, double offset_y, double scale_x, double scale_y, InterpType interp_type) nothrow;
1556 Pixbuf* /*new*/ gdk_pixbuf_scale_simple(Pixbuf* this_, int dest_width, int dest_height, InterpType interp_type) nothrow;
1557 void gdk_pixbuf_unref(Pixbuf* this_) nothrow;
1558 PixbufAnimation* /*new*/ gdk_pixbuf_animation_new_from_file(char* filename, GLib2.Error** error) nothrow;
1559 int gdk_pixbuf_animation_get_height(PixbufAnimation* this_) nothrow;
1560 PixbufAnimationIter* /*new*/ gdk_pixbuf_animation_get_iter(PixbufAnimation* this_, GLib2.TimeVal* start_time) nothrow;
1561 Pixbuf* gdk_pixbuf_animation_get_static_image(PixbufAnimation* this_) nothrow;
1562 int gdk_pixbuf_animation_get_width(PixbufAnimation* this_) nothrow;
1563 int gdk_pixbuf_animation_is_static_image(PixbufAnimation* this_) nothrow;
1564 PixbufAnimation* gdk_pixbuf_animation_ref(PixbufAnimation* this_) nothrow;
1565 void gdk_pixbuf_animation_unref(PixbufAnimation* this_) nothrow;
1566 int gdk_pixbuf_animation_iter_advance(PixbufAnimationIter* this_, GLib2.TimeVal* current_time) nothrow;
1567 int gdk_pixbuf_animation_iter_get_delay_time(PixbufAnimationIter* this_) nothrow;
1568 Pixbuf* gdk_pixbuf_animation_iter_get_pixbuf(PixbufAnimationIter* this_) nothrow;
1569 int gdk_pixbuf_animation_iter_on_currently_loading_frame(PixbufAnimationIter* this_) nothrow;
1570 PixbufFormat* /*new*/ gdk_pixbuf_format_copy(PixbufFormat* this_) nothrow;
1571 void gdk_pixbuf_format_free(PixbufFormat* this_) nothrow;
1572 char* /*new*/ gdk_pixbuf_format_get_description(PixbufFormat* this_) nothrow;
1573 char** /*new*/ gdk_pixbuf_format_get_extensions(PixbufFormat* this_) nothrow;
1574 char* /*new*/ gdk_pixbuf_format_get_license(PixbufFormat* this_) nothrow;
1575 char** /*new*/ gdk_pixbuf_format_get_mime_types(PixbufFormat* this_) nothrow;
1576 char* /*new*/ gdk_pixbuf_format_get_name(PixbufFormat* this_) nothrow;
1577 int gdk_pixbuf_format_is_disabled(PixbufFormat* this_) nothrow;
1578 int gdk_pixbuf_format_is_scalable(PixbufFormat* this_) nothrow;
1579 int gdk_pixbuf_format_is_writable(PixbufFormat* this_) nothrow;
1580 void gdk_pixbuf_format_set_disabled(PixbufFormat* this_, int disabled) nothrow;
1581 PixbufLoader* /*new*/ gdk_pixbuf_loader_new() nothrow;
1582 PixbufLoader* /*new*/ gdk_pixbuf_loader_new_with_mime_type(char* mime_type, GLib2.Error** error) nothrow;
1583 PixbufLoader* /*new*/ gdk_pixbuf_loader_new_with_type(char* image_type, GLib2.Error** error) nothrow;
1584 int gdk_pixbuf_loader_close(PixbufLoader* this_, GLib2.Error** error) nothrow;
1585 PixbufAnimation* gdk_pixbuf_loader_get_animation(PixbufLoader* this_) nothrow;
1586 PixbufFormat* /*new*/ gdk_pixbuf_loader_get_format(PixbufLoader* this_) nothrow;
1587 Pixbuf* gdk_pixbuf_loader_get_pixbuf(PixbufLoader* this_) nothrow;
1588 void gdk_pixbuf_loader_set_size(PixbufLoader* this_, int width, int height) nothrow;
1589 int gdk_pixbuf_loader_write(PixbufLoader* this_, ubyte* buf, size_t count, GLib2.Error** error) nothrow;
1590 PixbufSimpleAnim* /*new*/ gdk_pixbuf_simple_anim_new(int width, int height, float rate) nothrow;
1591 void gdk_pixbuf_simple_anim_add_frame(PixbufSimpleAnim* this_, Pixbuf* pixbuf) nothrow;
1592 int gdk_pixbuf_simple_anim_get_loop(PixbufSimpleAnim* this_) nothrow;
1593 void gdk_pixbuf_simple_anim_set_loop(PixbufSimpleAnim* this_, int loop) nothrow;
1594 int gdk_pixdata_deserialize(Pixdata* this_, uint stream_length, ubyte* stream, GLib2.Error** error) nothrow;
1595 void* gdk_pixdata_from_pixbuf(Pixdata* this_, Pixbuf* pixbuf, int use_rle) nothrow;
1596 ubyte* gdk_pixdata_serialize(Pixdata* this_, uint* stream_length_p) nothrow;
1597 GLib2.String* gdk_pixdata_to_csource(Pixdata* this_, char* name, PixdataDumpType dump_type) nothrow;
1598 GLib2.Quark gdk_pixbuf_error_quark() nothrow;