1 /* GdkPixbuf library - Basic memory management
3 * Copyright (C) 1999 The Free Software Foundation
5 * Authors: Mark Crichton <crichton@gimp.org>
6 * Miguel de Icaza <miguel@gnu.org>
7 * Federico Mena-Quintero <federico@gimp.org>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
27 #include <libart_lgpl/art_misc.h>
28 #include <libart_lgpl/art_affine.h>
29 #include <libart_lgpl/art_pixbuf.h>
30 #include <libart_lgpl/art_rgb_pixbuf_affine.h>
31 #include <libart_lgpl/art_alphagamma.h>
32 #include "gdk-pixbuf.h"
36 /* Reference counting */
42 * Adds a reference to a pixbuf. It must be released afterwards using
46 gdk_pixbuf_ref (GdkPixbuf *pixbuf)
48 g_return_if_fail (pixbuf != NULL);
49 g_return_if_fail (pixbuf->ref_count > 0);
58 * Removes a reference from a pixbuf. It will be destroyed when the reference
59 * count drops to zero.
62 gdk_pixbuf_unref (GdkPixbuf *pixbuf)
64 g_return_if_fail (pixbuf != NULL);
65 g_return_if_fail (pixbuf->ref_count > 0);
69 if (pixbuf->ref_count == 0) {
70 art_pixbuf_free (pixbuf->art_pixbuf);
71 pixbuf->art_pixbuf = NULL;
78 /* Wrap a libart pixbuf */
81 * gdk_pixbuf_new_from_art_pixbuf:
82 * @art_pixbuf: A libart pixbuf.
84 * Creates a &GdkPixbuf by wrapping a libart pixbuf.
86 * Return value: A newly-created &GdkPixbuf structure with a reference count of
90 gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf)
94 g_return_val_if_fail (art_pixbuf != NULL, NULL);
96 pixbuf = g_new (GdkPixbuf, 1);
97 pixbuf->ref_count = 1;
98 pixbuf->art_pixbuf = art_pixbuf;