1 /* Libart_LGPL - library of basic graphic primitives
2 * Copyright (C) 1998 Raph Levien
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #ifndef __ART_PIXBUF_H__
21 #define __ART_PIXBUF_H__
23 /* A generic data structure for holding a buffer of pixels. One way
24 to think about this module is as a virtualization over specific
25 pixel buffer formats. */
27 #ifdef LIBART_COMPILATION
38 typedef void (*ArtDestroyNotify) (void *func_data, void *data);
40 typedef struct _ArtPixBuf ArtPixBuf;
44 /* gray, cmyk, lab, ... ? */
48 /* The pixel buffer consists of width * height pixels, each of which
49 has n_channels samples. It is stored in simple packed format. */
63 ArtDestroyNotify destroy;
66 /* allocate an ArtPixBuf from art_alloc()ed pixels (automated destruction) */
68 art_pixbuf_new_rgb (art_u8 *pixels, int width, int height, int rowstride);
71 art_pixbuf_new_rgba (art_u8 *pixels, int width, int height, int rowstride);
73 /* allocate an ArtPixBuf from constant pixels (no destruction) */
75 art_pixbuf_new_const_rgb (const art_u8 *pixels, int width, int height, int rowstride);
78 art_pixbuf_new_const_rgba (const art_u8 *pixels, int width, int height, int rowstride);
80 /* allocate an ArtPixBuf and notify creator upon destruction */
82 art_pixbuf_new_rgb_dnotify (art_u8 *pixels, int width, int height, int rowstride,
83 void *dfunc_data, ArtDestroyNotify dfunc);
86 art_pixbuf_new_rgba_dnotify (art_u8 *pixels, int width, int height, int rowstride,
87 void *dfunc_data, ArtDestroyNotify dfunc);
89 /* free an ArtPixBuf with destroy notification */
91 art_pixbuf_free (ArtPixBuf *pixbuf);
93 /* deprecated function, use the _dnotify variants for allocation instead */
95 art_pixbuf_free_shallow (ArtPixBuf *pixbuf);
98 art_pixbuf_duplicate (const ArtPixBuf *pixbuf);