Blame docs/reference/gdk-pixbuf/html/gdk-pixbuf-Reference-Counting-and-Memory-Mangement.html

Packit a4058c
Packit a4058c
<html>
Packit a4058c
<head>
Packit a4058c
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit a4058c
<title>Reference Counting and Memory Mangement: GDK-PixBuf Reference Manual</title>
Packit a4058c
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit a4058c
<link rel="home" href="index.html" title="GDK-PixBuf Reference Manual">
Packit a4058c
<link rel="up" href="rn01.html" title="API Reference">
Packit a4058c
<link rel="prev" href="gdk-pixbuf-The-GdkPixbuf-Structure.html" title="The GdkPixbuf Structure">
Packit a4058c
<link rel="next" href="gdk-pixbuf-File-Loading.html" title="File Loading">
Packit a4058c
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
Packit a4058c
<link rel="stylesheet" href="style.css" type="text/css">
Packit a4058c
</head>
Packit a4058c
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit a4058c
Packit a4058c
Packit a4058c
Top  | 
Packit a4058c
                  Description
Packit a4058c
Packit a4058c
Home
Packit a4058c
Up
Packit a4058c
Prev
Packit a4058c
Next
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

Reference Counting and Memory Mangement

Packit a4058c

Reference Counting and Memory Mangement — Functions for reference counting and memory management on pixbufs.

Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

Functions

Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
GdkPixbuf *
Packit a4058c
Packit a4058c
Packit a4058c
gdk_pixbuf_ref ()
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
void
Packit a4058c
Packit a4058c
Packit a4058c
gdk_pixbuf_unref ()
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
void
Packit a4058c
Packit a4058c
Packit a4058c
(*GdkPixbufDestroyNotify) ()
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

Includes

Packit a4058c
#include <gdk-pixbuf/gdk-pixbuf.h>
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

Description

Packit a4058c

GdkPixbuf structures are reference counted. This means that an

Packit a4058c
application can share a single pixbuf among many parts of the
Packit a4058c
code.  When a piece of the program needs to keep a pointer to a
Packit a4058c
pixbuf, it should add a reference to it by calling g_object_ref().
Packit a4058c
When it no longer needs the pixbuf, it should subtract a reference
Packit a4058c
by calling g_object_unref().  The pixbuf will be destroyed when
Packit a4058c
its reference count drops to zero.  Newly-created GdkPixbuf
Packit a4058c
structures start with a reference count of one.

Packit a4058c

As GdkPixbuf is derived from GObject now, gdk_pixbuf_ref() and

Packit a4058c
gdk_pixbuf_unref() are deprecated in favour of g_object_ref()
Packit a4058c
and g_object_unref() resp.

Packit a4058c

Finalizing a pixbuf means to free its pixel data and to free the

Packit a4058c
GdkPixbuf structure itself.  Most of the library functions that
Packit a4058c
create GdkPixbuf structures create the pixel data by themselves
Packit a4058c
and define the way it should be freed; you do not need to worry
Packit a4058c
about those.

Packit a4058c

To provide preallocated pixel data, use

Packit a4058c
gdk_pixbuf_new_from_bytes().  The gdk_pixbuf_new_from_data() API is
Packit a4058c
an older variant that predates the existence of GBytes.

Packit a4058c
Packit a4058c
Packit a4058c

Functions

Packit a4058c
Packit a4058c

gdk_pixbuf_ref ()

Packit a4058c
GdkPixbuf *
Packit a4058c
gdk_pixbuf_ref (GdkPixbuf *pixbuf);
Packit a4058c
Packit a4058c

gdk_pixbuf_ref has been deprecated since version 2.0 and should not be used in newly-written code.

Packit a4058c

Use g_object_ref().

Packit a4058c
Packit a4058c

Adds a reference to a pixbuf.

Packit a4058c

[skip]

Packit a4058c
Packit a4058c

Parameters

Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

pixbuf

Packit a4058c

A pixbuf.

Packit a4058c
 
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

Returns

Packit a4058c

The same as the pixbuf

Packit a4058c
argument.

Packit a4058c
Packit a4058c
Packit a4058c

Packit a4058c
Packit a4058c

gdk_pixbuf_unref ()

Packit a4058c
void
Packit a4058c
gdk_pixbuf_unref (GdkPixbuf *pixbuf);
Packit a4058c
Packit a4058c

gdk_pixbuf_unref has been deprecated since version 2.0 and should not be used in newly-written code.

Packit a4058c

Use g_object_unref().

Packit a4058c
Packit a4058c

Removes a reference from a pixbuf.

Packit a4058c

[skip]

Packit a4058c
Packit a4058c

Parameters

Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

pixbuf

Packit a4058c

A pixbuf.

Packit a4058c
 
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

Packit a4058c
Packit a4058c

GdkPixbufDestroyNotify ()

Packit a4058c
void
Packit a4058c
(*GdkPixbufDestroyNotify) (guchar *pixels,
Packit a4058c
                           gpointer data);
Packit a4058c

A function of this type is responsible for freeing the pixel array

Packit a4058c
of a pixbuf.  The gdk_pixbuf_new_from_data() function lets you
Packit a4058c
pass in a pre-allocated pixel array so that a pixbuf can be
Packit a4058c
created from it; in this case you will need to pass in a function
Packit a4058c
of GdkPixbufDestroyNotify so that the pixel data can be freed
Packit a4058c
when the pixbuf is finalized.

Packit a4058c
Packit a4058c

Parameters

Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

pixels

Packit a4058c

The pixel array of the pixbuf

Packit a4058c
that is being finalized. 

Packit a4058c
[array][element-type guint8]
Packit a4058c
Packit a4058c
Packit a4058c

data

Packit a4058c

User closure data.

Packit a4058c
[closure]
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

Types and Values

Packit a4058c
Packit a4058c
Packit a4058c

See Also

Packit a4058c

GdkPixbuf, gdk_pixbuf_new_from_data().

Packit a4058c
Packit a4058c
Packit a4058c
Packit a4058c

Generated by GTK-Doc V1.25.1
Packit a4058c
</body>
Packit a4058c
</html>