gdk_rgb_init() doesn't need to be called anymore. Use g_object_(un)_ref

2001-11-03  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* gdk-pixbuf/tmpl/refcounting.sgml,
	gdk-pixbuf/porting-from-imlib.sgml, tmpl/creating.sgml:
	gdk_rgb_init() doesn't need to be called anymore. Use
	g_object_(un)_ref instead of gdk_pixbuf_(un)ref.

	* tmpl/module_interface.sgml: Typo fix.

	* gdk-pixbuf/gdk-pixbuf.sgml: Fixed jade complaining about '_' by
	replacing it with '-'. Now builds again.

	* gdk-pixbuf-loader.c, gdk-pixbuf-scale.c: Documentation fixes.
This commit is contained in:
Sebastian Wilhelmi
2001-11-03 18:49:43 +00:00
committed by Sebastian Wilhelmi
parent bee6f66b5e
commit 9d8e5e0ba8
9 changed files with 66 additions and 46 deletions

View File

@ -1,3 +1,15 @@
2001-11-03 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk-pixbuf/tmpl/refcounting.sgml,
gdk-pixbuf/porting-from-imlib.sgml, tmpl/creating.sgml:
gdk_rgb_init() doesn't need to be called anymore. Use
g_object_(un)_ref instead of gdk_pixbuf_(un)ref.
* tmpl/module_interface.sgml: Typo fix.
* gdk-pixbuf/gdk-pixbuf.sgml: Fixed jade complaining about '_' by
replacing it with '-'. Now builds again.
2001-10-31 Matthias Clasen <matthiasc@poet.de> 2001-10-31 Matthias Clasen <matthiasc@poet.de>
* gdk-pixbuf/gdk-pixbuf.sgml: include initialization_versions.sgml, * gdk-pixbuf/gdk-pixbuf.sgml: include initialization_versions.sgml,

View File

@ -10,8 +10,8 @@
<!entity gdk-pixbuf-util SYSTEM "sgml/util.sgml"> <!entity gdk-pixbuf-util SYSTEM "sgml/util.sgml">
<!entity gdk-pixbuf-animation SYSTEM "sgml/animation.sgml"> <!entity gdk-pixbuf-animation SYSTEM "sgml/animation.sgml">
<!entity GdkPixbufLoader SYSTEM "sgml/gdk-pixbuf-loader.sgml"> <!entity GdkPixbufLoader SYSTEM "sgml/gdk-pixbuf-loader.sgml">
<!entity module_interface SYSTEM "sgml/module_interface.sgml"> <!entity module-interface SYSTEM "sgml/module_interface.sgml">
<!entity initialization_versions SYSTEM "sgml/initialization_versions.sgml"> <!entity initialization-versions SYSTEM "sgml/initialization_versions.sgml">
<!entity gdk-pixbuf-gdk-pixbuf-xlib-init SYSTEM "sgml/gdk-pixbuf-xlib-init.sgml"> <!entity gdk-pixbuf-gdk-pixbuf-xlib-init SYSTEM "sgml/gdk-pixbuf-xlib-init.sgml">
<!entity gdk-pixbuf-gdk-pixbuf-xlib-rendering SYSTEM "sgml/gdk-pixbuf-xlib-rendering.sgml"> <!entity gdk-pixbuf-gdk-pixbuf-xlib-rendering SYSTEM "sgml/gdk-pixbuf-xlib-rendering.sgml">
<!entity gdk-pixbuf-gdk-pixbuf-xlib-from-drawables SYSTEM "sgml/gdk-pixbuf-xlib-from-drawables.sgml"> <!entity gdk-pixbuf-gdk-pixbuf-xlib-from-drawables SYSTEM "sgml/gdk-pixbuf-xlib-from-drawables.sgml">
@ -87,7 +87,7 @@
</para> </para>
</partintro> </partintro>
&initialization_versions; &initialization-versions;
&gdk-pixbuf-gdk-pixbuf; &gdk-pixbuf-gdk-pixbuf;
&gdk-pixbuf-refcounting; &gdk-pixbuf-refcounting;
@ -100,7 +100,7 @@
&gdk-pixbuf-animation; &gdk-pixbuf-animation;
&GdkPixbufLoader; &GdkPixbufLoader;
&module_interface; &module-interface;
&gdk-pixbuf-gdk-pixbuf-xlib-init; &gdk-pixbuf-gdk-pixbuf-xlib-init;
&gdk-pixbuf-gdk-pixbuf-xlib-rendering; &gdk-pixbuf-gdk-pixbuf-xlib-rendering;

View File

@ -62,11 +62,6 @@
<para> <para>
The &gdk-pixbuf; library does not need to be initialized. The &gdk-pixbuf; library does not need to be initialized.
However, if you intend to use the rendering functions or
anything else from the <application>GdkRGB</application>
library, you should call <function>gdk_rgb_init()</function>
after calling <function>gtk_init()</function> or
<function>gnome_init()</function> in your program.
</para> </para>
<note> <note>
@ -101,14 +96,13 @@
a new <link linkend="GdkPixbuf">GdkPixbuf</link> structure, a new <link linkend="GdkPixbuf">GdkPixbuf</link> structure,
it is created with an initial reference count of 1. When it is created with an initial reference count of 1. When
another part of the program wants to keep a reference to the another part of the program wants to keep a reference to the
pixbuf, it should call <link pixbuf, it should call <function>g_object_ref()</function>;
linkend="gdk-pixbuf-ref">gdk_pixbuf_ref()</link>; this will this will increase the reference count by 1. When some part
increase the reference count by 1. When some part of the of the program does not need to keep a reference to a pixbuf
program does not need to keep a reference to a pixbuf
anymore and wants to release the pixbuf, it should call anymore and wants to release the pixbuf, it should call
<link linkend="gdk-pixbuf-unref">gdk_pixbuf_unref()</link>; <function>g_object_unref()</function>; this will decrease
this will decrease the reference count by 1. When the the reference count by 1. When the reference count drops to
reference count drops to zero, the pixbuf gets destroyed or zero, the pixbuf gets destroyed or
<emphasis>finalized</emphasis> and its memory is freed. <emphasis>finalized</emphasis> and its memory is freed.
</para> </para>
@ -131,9 +125,9 @@
<para> <para>
Most applications will simply need to call Most applications will simply need to call
<function>gdk_pixbuf_ref()</function> when they want to keep <function>g_object_ref()</function> when they want to keep
an extra reference to a pixbuf, and then an extra reference to a pixbuf, and then
<function>gdk_pixbuf_unref()</function> when they are done <function>g_object_unref()</function> when they are done
with it. with it.
</para> </para>
</sect2> </sect2>
@ -232,7 +226,7 @@
<para> <para>
After you have created a pixbuf, you can manipulate it in After you have created a pixbuf, you can manipulate it in
any way you please and then finally call any way you please and then finally call
<function>gdk_pixbuf_unref()</function> when you are done <function>g_object_unref()</function> when you are done
with it. This can be thought of as a replacement for with it. This can be thought of as a replacement for
<function>gdk_imlib_destroy_image()</function> but with much <function>gdk_imlib_destroy_image()</function> but with much
cleaner semantics. cleaner semantics.

View File

@ -33,7 +33,7 @@ Creating a pixbuf from image data that is already in memory.
<para> <para>
You can also copy an existing pixbuf with the gdk_pixbuf_copy() 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() function. This is not the same as just doing a g_object_ref()
on the old pixbuf; the copy function will actually duplicate the on the old pixbuf; the copy function will actually duplicate the
pixel data in memory and create a new #GdkPixbuf structure for it. pixel data in memory and create a new #GdkPixbuf structure for it.
</para> </para>

View File

@ -66,7 +66,7 @@ images in a certain file format.
<para> <para>
A #GdkPixbufModule can be loaded dynamically from a #GModule. A #GdkPixbufModule can be loaded dynamically from a #GModule.
Each loadable module must contain a #ModuleFillVtableFunc function named Each loadable module must contain a #ModuleFillVtableFunc function named
<funcion>gdk_pixbuf__<replaceable>module_name</replaceable>_fill_vtable</function>. <function>gdk_pixbuf__<replaceable>module_name</replaceable>_fill_vtable</function>.
It will get called when the module is loaded and must set the function It will get called when the module is loaded and must set the function
pointers of the #GdkPixbufModule. pointers of the #GdkPixbufModule.
</para> </para>

View File

@ -8,15 +8,24 @@ Functions to perform reference counting and memory management on a
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <para>
#GdkPixbuf structures are reference counted. This means that #GdkPixbuf structures are reference counted. This means that an
an application can share a single pixbuf among many parts of the application can share a single pixbuf among many parts of the
code. When a piece of the program needs to keep a pointer to a code. When a piece of the program needs to keep a pointer to a
pixbuf, it should add a reference to it. When it no longer needs pixbuf, it should add a reference to it by calling g_object_ref().
the pixbuf, it should subtract a reference. The pixbuf will be When it no longer needs the pixbuf, it should subtract a reference
destroyed when its reference count drops to zero. Newly-created by calling g_object_unref(). The pixbuf will be destroyed when
#GdkPixbuf structures start with a reference count of one. its reference count drops to zero. Newly-created #GdkPixbuf
structures start with a reference count of one.
</para> </para>
<note>
<para>
As #GdkPixbuf is derived from #GObject now, gdk_pixbuf_ref() and
gdk_pixbuf_unref() are deprecated in favour of g_object_ref()
and g_object_unref () resp.
</para>
</note>
<para> <para>
<emphasis>Finalizing</emphasis> a pixbuf means to free its pixel <emphasis>Finalizing</emphasis> a pixbuf means to free its pixel
data and to free the #GdkPixbuf structure itself. Most of the data and to free the #GdkPixbuf structure itself. Most of the
@ -35,7 +44,7 @@ Functions to perform reference counting and memory management on a
<para> <para>
As an extension to traditional reference counting, #GdkPixbuf As an extension to traditional reference counting, #GdkPixbuf
structures support defining a handler for the last unref structures support defining a handler for the last unref
operation. If gdk_pixbuf_unref() is called on a #GdkPixbuf operation. If g_object_unref() is called on a #GdkPixbuf
structure that has a reference count of 1, i.e. its last structure that has a reference count of 1, i.e. its last
reference, then the pixbuf's last unref handler function will be reference, then the pixbuf's last unref handler function will be
called. It is up to this function to determine whether to called. It is up to this function to determine whether to

View File

@ -1,3 +1,7 @@
2001-11-03 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk-pixbuf-loader.c, gdk-pixbuf-scale.c: Documentation fixes.
2001-10-29 Tor Lillqvist <tml@iki.fi> 2001-10-29 Tor Lillqvist <tml@iki.fi>
* Makefile.am: Use -no-undefined on Win32. Make * Makefile.am: Use -no-undefined on Win32. Make

View File

@ -438,13 +438,13 @@ gdk_pixbuf_loader_new_with_type (const char *image_type,
* @loader: A pixbuf loader. * @loader: A pixbuf loader.
* *
* Queries the GdkPixbuf that a pixbuf loader is currently creating. * Queries the GdkPixbuf that a pixbuf loader is currently creating.
* In general it only makes sense to call this function afer the * In general it only makes sense to call this function after the
* "area_prepared" signal has been emitted by the loader; this means * "area_prepared" signal has been emitted by the loader; this means
* that enough data has been read to know the size of the image that * that enough data has been read to know the size of the image that
* will be allocated. If the loader has not received enough data via * will be allocated. If the loader has not received enough data via
* gdk_pixbuf_loader_write(), then this function returns %NULL. The * gdk_pixbuf_loader_write(), then this function returns %NULL. The
* returned pixbuf will be the same in all future calls to the loader, * returned pixbuf will be the same in all future calls to the loader,
* so simply calling gdk_pixbuf_ref() should be sufficient to continue * so simply calling g_object_ref() should be sufficient to continue
* using it. Additionally, if the loader is an animation, it will * using it. Additionally, if the loader is an animation, it will
* return the "static image" of the animation * return the "static image" of the animation
* (see gdk_pixbuf_animation_get_static_image()). * (see gdk_pixbuf_animation_get_static_image()).

View File

@ -41,10 +41,11 @@
* @scale_y: the scale factor in the Y direction * @scale_y: the scale factor in the Y direction
* @interp_type: the interpolation type for the transformation. * @interp_type: the interpolation type for the transformation.
* *
* Transforms the image by source image by scaling by @scale_x and @scale_y then * Transforms the source image @src by scaling by @scale_x and
* translating by @offset_x and @offset_y, then renders the rectangle * @scale_y then translating by @offset_x and @offset_y, then renders
* (@dest,@dest_y,@dest_width,@dest_height) of the resulting image onto the * the rectangle (@dest_x, @dest_y, @dest_width, @dest_height) of the
* destination drawable replacing the previous contents. * resulting image onto the destination image replacing the
* previous contents.
**/ **/
void void
gdk_pixbuf_scale (const GdkPixbuf *src, gdk_pixbuf_scale (const GdkPixbuf *src,
@ -91,10 +92,10 @@ gdk_pixbuf_scale (const GdkPixbuf *src,
* @interp_type: the interpolation type for the transformation. * @interp_type: the interpolation type for the transformation.
* @overall_alpha: overall alpha for source image (0..255) * @overall_alpha: overall alpha for source image (0..255)
* *
* Transforms the image by source image by scaling by @scale_x and @scale_y then * Transforms the source image @src by scaling by @scale_x and
* translating by @offset_x and @offset_y, then composites the rectangle * @scale_y then translating by @offset_x and @offset_y, then
* (@dest,@dest_y,@dest_width,@dest_height) of the resulting image onto the * composites the rectangle (@dest_x, @dest_y, @dest_width,
* destination drawable. * @dest_height) of the resulting image onto the destination image.
**/ **/
void void
gdk_pixbuf_composite (const GdkPixbuf *src, gdk_pixbuf_composite (const GdkPixbuf *src,
@ -147,11 +148,11 @@ gdk_pixbuf_composite (const GdkPixbuf *src,
* @color1: the color of check at upper left * @color1: the color of check at upper left
* @color2: the color of the other check * @color2: the color of the other check
* *
* Transforms the image by source image by scaling by @scale_x and @scale_y then * Transforms the source image @src by scaling by @scale_x and @scale_y then
* translating by @offset_x and @offset_y, then composites the rectangle * translating by @offset_x and @offset_y, then composites the rectangle
* (@dest,@dest_y,@dest_width,@dest_height) of the resulting image with * (@dest_x ,@dest_y, @dest_width, @dest_height) of the resulting image with
* a checkboard of the colors @color1 and @color2 and renders it onto the * a checkboard of the colors @color1 and @color2 and renders it onto the
* destination drawable. * destination image.
**/ **/
void void
gdk_pixbuf_composite_color (const GdkPixbuf *src, gdk_pixbuf_composite_color (const GdkPixbuf *src,
@ -198,8 +199,8 @@ gdk_pixbuf_composite_color (const GdkPixbuf *src,
* @dest_height: the height of destination image * @dest_height: the height of destination image
* @interp_type: the interpolation type for the transformation. * @interp_type: the interpolation type for the transformation.
* *
* Scale the #GdkPixbuf @src to @dest_width x @dest_height and render the result into * Scale the #GdkPixbuf @src to @dest_width x @dest_height and render
* a new #GdkPixbuf. * the result into a new #GdkPixbuf.
* *
* Return value: the new #GdkPixbuf, or NULL if not enough memory could be * Return value: the new #GdkPixbuf, or NULL if not enough memory could be
* allocated for it. * allocated for it.
@ -239,9 +240,9 @@ gdk_pixbuf_scale_simple (const GdkPixbuf *src,
* @color1: the color of check at upper left * @color1: the color of check at upper left
* @color2: the color of the other check * @color2: the color of the other check
* *
* Scale the #GdkPixbuf @src to @dest_width x @dest_height composite the result with * Scale the #GdkPixbuf @src to @dest_width x @dest_height composite
* a checkboard of colors @color1 and @color2 and render the result into * the result with a checkboard of colors @color1 and @color2 and
* a new #GdkPixbuf. * render the result into a new #GdkPixbuf.
* *
* Return value: the new #GdkPixbuf, or NULL if not enough memory could be * Return value: the new #GdkPixbuf, or NULL if not enough memory could be
* allocated for it. * allocated for it.