
Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
101 lines
2.3 KiB
Plaintext
101 lines
2.3 KiB
Plaintext
<!-- ##### SECTION Title ##### -->
|
|
Image Data in Memory
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
|
Creating a pixbuf from image data that is already in memory.
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
<para>
|
|
The most basic way to create a pixbuf is to wrap an existing pixel
|
|
buffer with a #GdkPixbuf structure. You can use the
|
|
gdk_pixbuf_new_from_data() 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 #GdkPixbuf
|
|
is finalized by the reference counting functions If you have a
|
|
chunk of static data compiled into your application, you can pass
|
|
in #NULL as the destroy notification function so that the data
|
|
will not be freed.
|
|
</para>
|
|
|
|
<para>
|
|
The 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 using malloc() and then wrapping it with
|
|
gdk_pixbuf_new_from_data(). The gdk_pixbuf_new() function will
|
|
compute an optimal rowstride so that rendering can be performed
|
|
with an efficient algorithm.
|
|
</para>
|
|
|
|
<para>
|
|
As a special case, you can use the gdk_pixbuf_new_from_xpm_data()
|
|
function to create a pixbuf from inline XPM image data.
|
|
</para>
|
|
|
|
<para>
|
|
You can also copy an existing pixbuf with the gdk_pixbuf_copy()
|
|
function. This is not the same as just doing a gdk_pixbuf_ref()
|
|
on the old pixbuf; the copy function will actually duplicate the
|
|
pixel data in memory and create a new #GdkPixbuf structure for it.
|
|
</para>
|
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
<para>
|
|
gdk_pixbuf_finalize().
|
|
</para>
|
|
|
|
<!-- ##### FUNCTION gdk_pixbuf_new ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@colorspace:
|
|
@has_alpha:
|
|
@bits_per_sample:
|
|
@width:
|
|
@height:
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_pixbuf_new_from_data ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@data:
|
|
@colorspace:
|
|
@has_alpha:
|
|
@bits_per_sample:
|
|
@width:
|
|
@height:
|
|
@rowstride:
|
|
@destroy_fn:
|
|
@destroy_fn_data:
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_pixbuf_new_from_xpm_data ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@data:
|
|
@Returns:
|
|
|
|
|
|
<!-- ##### FUNCTION gdk_pixbuf_copy ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@pixbuf:
|
|
@Returns:
|
|
|
|
<!--
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
|
|
End:
|
|
-->
|
|
|
|
|