source: trunk/third/mozilla/other-licenses/libart_lgpl/art_pixbuf.h @ 22325

Revision 22325, 2.9 KB checked in by rbasch, 19 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r22324, which included commits to RCS files with non-trunk default branches.
RevLine 
[22324]1/* Libart_LGPL - library of basic graphic primitives
2 * Copyright (C) 1998 Raph Levien
3 *
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.
8 *
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.
13 *
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.
18 */
19
20#ifndef __ART_PIXBUF_H__
21#define __ART_PIXBUF_H__
22
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. */
26
27#ifdef LIBART_COMPILATION
28#include "art_misc.h"
29#else
30#include <libart_lgpl/art_misc.h>
31#endif
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37
38typedef void (*ArtDestroyNotify) (void *func_data, void *data);
39
40typedef struct _ArtPixBuf ArtPixBuf;
41
42typedef enum {
43  ART_PIX_RGB
44  /* gray, cmyk, lab, ... ? */
45} ArtPixFormat;
46
47
48/* The pixel buffer consists of width * height pixels, each of which
49   has n_channels samples. It is stored in simple packed format. */
50
51struct _ArtPixBuf {
52  /*< public >*/
53  ArtPixFormat format;
54  int n_channels;
55  int has_alpha;
56  int bits_per_sample;
57
58  art_u8 *pixels;
59  int width;
60  int height;
61  int rowstride;
62  void *destroy_data;
63  ArtDestroyNotify destroy;
64};
65
66/* allocate an ArtPixBuf from art_alloc()ed pixels (automated destruction) */
67ArtPixBuf *
68art_pixbuf_new_rgb (art_u8 *pixels, int width, int height, int rowstride);
69
70ArtPixBuf *
71art_pixbuf_new_rgba (art_u8 *pixels, int width, int height, int rowstride);
72
73/* allocate an ArtPixBuf from constant pixels (no destruction) */
74ArtPixBuf *
75art_pixbuf_new_const_rgb (const art_u8 *pixels, int width, int height, int rowstride);
76
77ArtPixBuf *
78art_pixbuf_new_const_rgba (const art_u8 *pixels, int width, int height, int rowstride);
79
80/* allocate an ArtPixBuf and notify creator upon destruction */
81ArtPixBuf *
82art_pixbuf_new_rgb_dnotify (art_u8 *pixels, int width, int height, int rowstride,
83                            void *dfunc_data, ArtDestroyNotify dfunc);
84
85ArtPixBuf *
86art_pixbuf_new_rgba_dnotify (art_u8 *pixels, int width, int height, int rowstride,
87                             void *dfunc_data, ArtDestroyNotify dfunc);
88
89/* free an ArtPixBuf with destroy notification */
90void
91art_pixbuf_free (ArtPixBuf *pixbuf);
92
93/* deprecated function, use the _dnotify variants for allocation instead */
94void
95art_pixbuf_free_shallow (ArtPixBuf *pixbuf);
96
97ArtPixBuf *
98art_pixbuf_duplicate (const ArtPixBuf *pixbuf);
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif
Note: See TracBrowser for help on using the repository browser.