Creating a pixbuf from image data that is already in memory.
The most basic way to create a pixbuf is to wrap an existing pixel buffer with a
<gdk-pixbuf> structure. You can use the
function to do this You need to specify the destroy notification function that
will be called when the data buffer needs to be freed; this will happen when a
<gdk-pixbuf> is finalized by the reference counting functions If you have
a chunk of static data compiled into your application, you can pass in
#f’ as the destroy notification function so that the data will not
gdk-pixbuf-new function can be used as a convenience to create a
pixbuf with an empty buffer. This is equivalent to allocating a data buffer
malloc and then wrapping it with
gdk-pixbuf-new function will compute
an optimal rowstride so that rendering can be performed with an efficient
As a special case, you can use the
to create a pixbuf from inline XPM image data.
You can also copy an existing pixbuf with the
This is not the same as just doing a
g-object-ref on the old pixbuf; the
copy function will actually duplicate the pixel data in memory and create a new
<gdk-pixbuf> structure for it.
int) ⇒ (ret
Creates a new
<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.
- Color space for image
- Whether the image should have transparency information
- Number of bits per color sample
- Width of image in pixels, must be > 0
- Height of image in pixels, must be > 0
- A newly-created
<gdk-pixbuf>with a reference count of 1, or ‘
#f’ if not enough memory could be allocated for the image buffer.
int) ⇒ (ret
Creates a new pixbuf which represents a sub-region of 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 src-pixbuf, so src-pixbuf will not be finalized until the new pixbuf is finalized.
- X coord in src-pixbuf
- Y coord in src-pixbuf
- width of region in src-pixbuf
- height of region in src-pixbuf
- a new pixbuf