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 3 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, see <http://www.gnu.org/licenses/>.
16
* Boston, MA 02111-1307, USA.
19
#ifndef __ART_PIXBUF_H__
20
#define __ART_PIXBUF_H__
22
/* A generic data structure for holding a buffer of pixels. One way
23
to think about this module is as a virtualization over specific
24
pixel buffer formats. */
26
#ifdef LIBART_COMPILATION
29
#include <libart_lgpl/art_misc.h>
37
typedef void (*ArtDestroyNotify) (void *func_data, void *data);
39
typedef struct _ArtPixBuf ArtPixBuf;
43
/* gray, cmyk, lab, ... ? */
47
/* The pixel buffer consists of width * height pixels, each of which
48
has n_channels samples. It is stored in simple packed format. */
62
ArtDestroyNotify destroy;
65
/* allocate an ArtPixBuf from art_alloc()ed pixels (automated destruction) */
67
art_pixbuf_new_rgb (art_u8 *pixels, int width, int height, int rowstride);
70
art_pixbuf_new_rgba (art_u8 *pixels, int width, int height, int rowstride);
72
/* allocate an ArtPixBuf from constant pixels (no destruction) */
74
art_pixbuf_new_const_rgb (const art_u8 *pixels, int width, int height, int rowstride);
77
art_pixbuf_new_const_rgba (const art_u8 *pixels, int width, int height, int rowstride);
79
/* allocate an ArtPixBuf and notify creator upon destruction */
81
art_pixbuf_new_rgb_dnotify (art_u8 *pixels, int width, int height, int rowstride,
82
void *dfunc_data, ArtDestroyNotify dfunc);
85
art_pixbuf_new_rgba_dnotify (art_u8 *pixels, int width, int height, int rowstride,
86
void *dfunc_data, ArtDestroyNotify dfunc);
88
/* free an ArtPixBuf with destroy notification */
90
art_pixbuf_free (ArtPixBuf *pixbuf);
92
/* deprecated function, use the _dnotify variants for allocation instead */
94
art_pixbuf_free_shallow (ArtPixBuf *pixbuf);
97
art_pixbuf_duplicate (const ArtPixBuf *pixbuf);