2 * This file is part of gtkD.
4 * gtkD 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 * gtkD 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 gtkD; 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-inline.html
48 * - GString* -> StringG
49 * - GdkPixbuf* -> Pixbuf
54 module gdkpixbuf
.Pixdata
;
60 import tango
.io
.Stdout
; // use the tango loging?
64 private import gtkc
.gdkpixbuftypes
;
66 private import gtkc
.gdkpixbuf
;
69 private import gdk
.Pixbuf
;
70 private import glib
.StringG
;
71 private import glib
.Str
;
78 * Using GdkPixdata, images can be compiled into an application,
79 * making it unnecessary to refer to external image files at runtime.
80 * gdk-pixbuf includes a utility named gdk-pixbuf-csource, which
81 * can be used to convert image files into GdkPixdata structures suitable
82 * for inclusion in C sources. To convert the GdkPixdata structures back
83 * into GdkPixbufs, use gdk_pixbuf_from_pixdata.
88 /** the main Gtk struct */
89 protected GdkPixdata
* gdkPixdata
;
92 public GdkPixdata
* getPixdataStruct()
98 /** the main Gtk struct as a void* */
99 protected void* getStruct()
101 return cast(void*)gdkPixdata
;
105 * Sets our main struct and passes it to the parent class
107 public this (GdkPixdata
* gdkPixdata
)
111 if ( gdkPixdata
is null )
116 Stdout("struct gdkPixdata is null on constructor").newline
;
120 printf("struct gdkPixdata is null on constructor");
127 assert(gdkPixdata
!is null, "struct gdkPixdata is null on constructor");
129 this.gdkPixdata
= gdkPixdata
;
141 * Converts a GdkPixbuf to a GdkPixdata. If use_rle is TRUE, the
142 * pixel data is run-length encoded into newly-allocated memory and a
143 * pointer to that memory is returned.
145 * a GdkPixdata to fill.
147 * the data to fill pixdata with.
149 * whether to use run-length encoding for the pixel data.
151 * If ure_rle is TRUE, a pointer to the newly-allocated memory
152 * for the run-length encoded pixel data, otherwise NULL.
154 public void* fromPixbuf(Pixbuf pixbuf
, int useRle
)
156 // gpointer gdk_pixdata_from_pixbuf (GdkPixdata *pixdata, const GdkPixbuf *pixbuf, gboolean use_rle);
157 return gdk_pixdata_from_pixbuf(gdkPixdata
, (pixbuf
is null) ?
null : pixbuf
.getPixbufStruct(), useRle
);
161 * Converts a GdkPixdata to a GdkPixbuf. If copy_pixels is TRUE or
162 * if the pixel data is run-length-encoded, the pixel data is copied into
163 * newly-allocated memory; otherwise it is reused.
165 * a GdkPixdata to convert into a GdkPixbuf.
167 * whether to copy raw pixel data; run-length encoded
168 * pixel data is always copied.
170 * location to store possible errors.
174 public Pixbuf
gdkPixbufFromPixdata(int copyPixels
, GError
** error
)
176 // GdkPixbuf* gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata, gboolean copy_pixels, GError **error);
177 return new Pixbuf( gdk_pixbuf_from_pixdata(gdkPixdata
, copyPixels
, error
) );
181 * Serializes a GdkPixdata structure into a byte stream.
182 * The byte stream consists of a straightforward writeout of the
183 * GdkPixdata fields in network byte order, plus the pixel_data
184 * bytes the structure points to.
186 * a valid GdkPixdata structure to serialize.
188 * location to store the resulting stream length in.
190 * A newly-allocated string containing the serialized
191 * GdkPixdata structure.
193 public byte* serialize(uint* streamLengthP
)
195 // guint8* gdk_pixdata_serialize (const GdkPixdata *pixdata, guint *stream_length_p);
196 return gdk_pixdata_serialize(gdkPixdata
, streamLengthP
);
200 * Deserializes (reconstruct) a GdkPixdata structure from a byte stream.
201 * The byte stream consists of a straightforward writeout of the
202 * GdkPixdata fields in network byte order, plus the pixel_data
203 * bytes the structure points to.
204 * The pixdata contents are reconstructed byte by byte and are checked
205 * for validity. This function may fail with GDK_PIXBUF_CORRUPT_IMAGE
206 * or GDK_PIXBUF_ERROR_UNKNOWN_TYPE.
208 * a GdkPixdata structure to be filled in.
210 * length of the stream used for deserialization.
212 * stream of bytes containing a serialized GdkPixdata structure.
214 * GError location to indicate failures (maybe NULL to ignore errors).
216 * Upon successful deserialization TRUE is returned,
219 public int deserialize(uint streamLength
, byte* stream
, GError
** error
)
221 // gboolean gdk_pixdata_deserialize (GdkPixdata *pixdata, guint stream_length, const guint8 *stream, GError **error);
222 return gdk_pixdata_deserialize(gdkPixdata
, streamLength
, stream
, error
);
226 * Generates C source code suitable for compiling images directly
228 * GTK+ ships with a program called gdk-pixbuf-csource
229 * which offers a command line interface to this function.
231 * a GdkPixdata to convert to C source.
233 * used for naming generated data structures or macros.
235 * a GdkPixdataDumpType determining the kind of C
236 * source to be generated.
238 * a newly-allocated string containing the C source form
241 public StringG
toCsource(char[] name
, GdkPixdataDumpType dumpType
)
243 // GString* gdk_pixdata_to_csource (GdkPixdata *pixdata, const gchar *name, GdkPixdataDumpType dump_type);
244 return new StringG( gdk_pixdata_to_csource(gdkPixdata
, Str
.toStringz(name
), dumpType
) );