
@c %start of fragment

@deffn Function gdk-pixbuf-new  (colorspace@tie{}@code{<gdk-colorspace>}) (has_alpha@tie{}@code{bool}) (bits_per_sample@tie{}@code{int}) (width@tie{}@code{int}) (height@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>})
Creates a new @code{<gdk-pixbuf>} structure and allocates a buffer for it. The
buffer has an optimal rowstride. Note that the buffer is not cleared; you will
have to fill it completely yourself.

@table @var
@item colorspace
Color space for image

@item has-alpha
Whether the image should have transparency information

@item bits-per-sample
Number of bits per color sample

@item width
Width of image in pixels, must be > 0

@item height
Height of image in pixels, must be > 0

@item ret
A newly-created @code{<gdk-pixbuf>} with a reference count of 1, or
@samp{@code{#f}} if not enough memory could be allocated for the image buffer.

@end table

@end deffn

@deffn Function gdk-pixbuf-new-from-data  (data@tie{}@code{<guchar*>}) (colorspace@tie{}@code{<gdk-colorspace>}) (has_alpha@tie{}@code{bool}) (bits_per_sample@tie{}@code{int}) (width@tie{}@code{int}) (height@tie{}@code{int}) (rowstride@tie{}@code{int}) (destroy_fn@tie{}@code{<gdk-pixbuf-destroy-notify>}) (destroy_fn_data@tie{}@code{<gpointer>}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>})
Creates a new @code{<gdk-pixbuf>} out of in-memory image data. Currently only
RGB images with 8 bits per sample are supported.

@table @var
@item data
Image data in 8-bit/sample packed format

@item colorspace
Colorspace for the image data

@item has-alpha
Whether the data has an opacity channel

@item bits-per-sample
Number of bits per sample

@item width
Width of the image in pixels, must be > 0

@item height
Height of the image in pixels, must be > 0

@item rowstride
Distance in bytes between row starts

@item destroy-fn
Function used to free the data when the pixbuf's reference count drops to zero,
or @samp{@code{#f}} if the data should not be freed

@item destroy-fn-data
Closure data to pass to the destroy notification function

@item ret
A newly-created @code{<gdk-pixbuf>} structure with a reference count of 1.

@end table

@end deffn

@deffn Function gdk-pixbuf-new-from-xpm-data  (data@tie{}@code{<char**>}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>})
Creates a new pixbuf by parsing XPM data in memory. This data is commonly the
result of including an XPM file into a program's C source.

@table @var
@item data
Pointer to inline XPM data.

@item ret
A newly-created pixbuf with a reference count of 1.

@end table

@end deffn

@deffn Function gdk-pixbuf-new-from-inline  (data_length@tie{}@code{int}) (data@tie{}@code{<guint8*>}) (copy_pixels@tie{}@code{bool}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>})
Create a @code{<gdk-pixbuf>} from a flat representation that is suitable for
storing as inline data in a program. This is useful if you want to ship a
program with images, but don't want to depend on any external files.

GTK+ ships with a program called which allows for conversion of
@code{<gdk-pixbufs>} into such a inline representation. In almost all cases, you
should pass the flag to . A sample invocation would be:

@example 

 gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
@end example

For the typical case where the inline pixbuf is read-only static data, you don't
need to copy the pixel data unless you intend to write to it, so you can pass
@samp{@code{#f}} for @var{copy-pixels}. (If you pass to , a copy will be made
even if @var{copy-pixels} is @samp{@code{#f}}, so using this option is generally
a bad idea.)

If you create a pixbuf from const inline data compiled into your program, it's
probably safe to ignore errors and disable length checks, since things will
always succeed:

@example 

pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL);
@end example

For non-const inline data, you could get out of memory. For untrusted inline
data located at runtime, you could have corrupt inline data in addition.

@table @var
@item data-length
Length in bytes of the @var{data} argument or -1 to disable length checks

@item data
Byte data containing a serialized @code{<gdk-pixdata>} structure

@item copy-pixels
Whether to copy the pixel data, or use direct pointers @var{data} for the
resulting pixbuf

@item error
@code{<g-error>} return location, may be @samp{@code{#f}} to ignore errors

@item ret
A newly-created @code{<gdk-pixbuf>} structure with a reference, count of 1, or
@samp{@code{#f}} if an error occurred.

@end table

@end deffn

@deffn Function gdk-pixbuf-new-subpixbuf  (self@tie{}@code{<gdk-pixbuf>}) (src_x@tie{}@code{int}) (src_y@tie{}@code{int}) (width@tie{}@code{int}) (height@tie{}@code{int}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>})
@deffnx Method new-subpixbuf
Creates a new pixbuf which represents a sub-region of @var{src-pixbuf}. The new
pixbuf shares its pixels with the original pixbuf, so writing to one affects
both. The new pixbuf holds a reference to @var{src-pixbuf}, so @var{src-pixbuf}
will not be finalized until the new pixbuf is finalized.

@table @var
@item src-pixbuf
a @code{<gdk-pixbuf>}

@item src-x
X coord in @var{src-pixbuf}

@item src-y
Y coord in @var{src-pixbuf}

@item width
width of region in @var{src-pixbuf}

@item height
height of region in @var{src-pixbuf}

@item ret
a new pixbuf

@end table

@end deffn


@c %end of fragment
