Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
gdk-pixdata.h
Go to the documentation of this file.
1/* GdkPixbuf library - GdkPixdata - functions for inlined pixbuf handling
2 * Copyright (C) 1999, 2001 Tim Janik
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser 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 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16 */
17#ifndef __GDK_PIXDATA_H__
18#define __GDK_PIXDATA_H__
19
20#ifndef GDK_PIXBUF_DISABLE_DEPRECATED
22
24
25/**
26 * GDK_PIXBUF_MAGIC_NUMBER:
27 *
28 * Magic number for #GdkPixdata structures.
29 **/
30#define GDK_PIXBUF_MAGIC_NUMBER (0x47646b50) /* 'GdkP' */
31
32/**
33 * GdkPixdataType:
34 * @GDK_PIXDATA_COLOR_TYPE_RGB: each pixel has red, green and blue samples.
35 * @GDK_PIXDATA_COLOR_TYPE_RGBA: each pixel has red, green and blue samples
36 * and an alpha value.
37 * @GDK_PIXDATA_COLOR_TYPE_MASK: mask for the colortype flags of the enum.
38 * @GDK_PIXDATA_SAMPLE_WIDTH_8: each sample has 8 bits.
39 * @GDK_PIXDATA_SAMPLE_WIDTH_MASK: mask for the sample width flags of the enum.
40 * @GDK_PIXDATA_ENCODING_RAW: the pixel data is in raw form.
41 * @GDK_PIXDATA_ENCODING_RLE: the pixel data is run-length encoded. Runs may
42 * be up to 127 bytes long; their length is stored in a single byte
43 * preceding the pixel data for the run. If a run is constant, its length
44 * byte has the high bit set and the pixel data consists of a single pixel
45 * which must be repeated.
46 * @GDK_PIXDATA_ENCODING_MASK: mask for the encoding flags of the enum.
47 *
48 * An enumeration containing three sets of flags for a #GdkPixdata struct:
49 * one for the used colorspace, one for the width of the samples and one
50 * for the encoding of the pixel data.
51 *
52 * Deprecated: 2.32
53 **/
54typedef enum
55{
56 /* colorspace + alpha */
60 /* width, support 8bits only currently */
63 /* encoding */
66 GDK_PIXDATA_ENCODING_MASK = 0x0f << 24
68
69typedef struct _GdkPixdata GdkPixdata;
71{
72 guint32 magic; /* GDK_PIXBUF_MAGIC_NUMBER */
73 gint32 length; /* <1 to disable length checks, otherwise:
74 * GDK_PIXDATA_HEADER_LENGTH + pixel_data length
75 */
76 guint32 pixdata_type; /* GdkPixdataType */
81};
82
83/**
84 * GDK_PIXDATA_HEADER_LENGTH:
85 *
86 * The length of a #GdkPixdata structure without the @pixel_data pointer.
87 *
88 * Deprecated: 2.32
89 **/
90#define GDK_PIXDATA_HEADER_LENGTH (4 + 4 + 4 + 4 + 4 + 4)
91
92/* the returned stream is plain htonl of GdkPixdata members + pixel_data */
95 guint *stream_length_p);
98 guint stream_length,
99 const guint8 *stream,
100 GError **error);
103 const GdkPixbuf *pixbuf,
104 gboolean use_rle);
107 gboolean copy_pixels,
108 GError **error);
109/**
110 * GdkPixdataDumpType:
111 * @GDK_PIXDATA_DUMP_PIXDATA_STREAM: Generate pixbuf data stream (a single
112 * string containing a serialized #GdkPixdata structure in network byte
113 * order).
114 * @GDK_PIXDATA_DUMP_PIXDATA_STRUCT: Generate #GdkPixdata structure (needs
115 * the #GdkPixdata structure definition from gdk-pixdata.h).
116 * @GDK_PIXDATA_DUMP_MACROS: Generate <function>*_ROWSTRIDE</function>,
117 * <function>*_WIDTH</function>, <function>*_HEIGHT</function>,
118 * <function>*_BYTES_PER_PIXEL</function> and
119 * <function>*_RLE_PIXEL_DATA</function> or <function>*_PIXEL_DATA</function>
120 * macro definitions for the image.
121 * @GDK_PIXDATA_DUMP_GTYPES: Generate GLib data types instead of
122 * standard C data types.
123 * @GDK_PIXDATA_DUMP_CTYPES: Generate standard C data types instead of
124 * GLib data types.
125 * @GDK_PIXDATA_DUMP_STATIC: Generate static symbols.
126 * @GDK_PIXDATA_DUMP_CONST: Generate const symbols.
127 * @GDK_PIXDATA_DUMP_RLE_DECODER: Provide a <function>*_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp)</function>
128 * macro definition to decode run-length encoded image data.
129 *
130 * An enumeration which is used by gdk_pixdata_to_csource() to
131 * determine the form of C source to be generated. The three values
132 * @GDK_PIXDATA_DUMP_PIXDATA_STREAM, @GDK_PIXDATA_DUMP_PIXDATA_STRUCT
133 * and @GDK_PIXDATA_DUMP_MACROS are mutually exclusive, as are
134 * @GDK_PIXBUF_DUMP_GTYPES and @GDK_PIXBUF_DUMP_CTYPES. The remaining
135 * elements are optional flags that can be freely added.
136 *
137 * Deprecated: 2.32
138 **/
139typedef enum
140{
141 /* type of source to save */
145 /* type of variables to use */
150 /* save RLE decoder macro? */
153
154
157 const gchar *name,
158 GdkPixdataDumpType dump_type);
159
160
162
163#endif /* GDK_PIXBUF_DISABLE_DEPRECATED */
164
165#endif /* __GDK_PIXDATA_H__ */
struct _GdkPixbuf GdkPixbuf
#define GDK_PIXBUF_DEPRECATED_IN_2_32
GDK_PIXBUF_DEPRECATED_IN_2_32 GString * gdk_pixdata_to_csource(GdkPixdata *pixdata, const gchar *name, GdkPixdataDumpType dump_type)
GdkPixdataDumpType
@ GDK_PIXDATA_DUMP_STATIC
@ GDK_PIXDATA_DUMP_RLE_DECODER
@ GDK_PIXDATA_DUMP_MACROS
@ GDK_PIXDATA_DUMP_PIXDATA_STRUCT
@ GDK_PIXDATA_DUMP_GTYPES
@ GDK_PIXDATA_DUMP_CONST
@ GDK_PIXDATA_DUMP_PIXDATA_STREAM
@ GDK_PIXDATA_DUMP_CTYPES
GDK_PIXBUF_DEPRECATED_IN_2_32 gpointer gdk_pixdata_from_pixbuf(GdkPixdata *pixdata, const GdkPixbuf *pixbuf, gboolean use_rle)
GDK_PIXBUF_DEPRECATED_IN_2_32 GdkPixbuf * gdk_pixbuf_from_pixdata(const GdkPixdata *pixdata, gboolean copy_pixels, GError **error)
GDK_PIXBUF_DEPRECATED_IN_2_32 gboolean gdk_pixdata_deserialize(GdkPixdata *pixdata, guint stream_length, const guint8 *stream, GError **error)
GdkPixdataType
Definition gdk-pixdata.h:55
@ GDK_PIXDATA_SAMPLE_WIDTH_MASK
Definition gdk-pixdata.h:62
@ GDK_PIXDATA_ENCODING_MASK
Definition gdk-pixdata.h:66
@ GDK_PIXDATA_COLOR_TYPE_RGB
Definition gdk-pixdata.h:57
@ GDK_PIXDATA_ENCODING_RAW
Definition gdk-pixdata.h:64
@ GDK_PIXDATA_ENCODING_RLE
Definition gdk-pixdata.h:65
@ GDK_PIXDATA_COLOR_TYPE_MASK
Definition gdk-pixdata.h:59
@ GDK_PIXDATA_COLOR_TYPE_RGBA
Definition gdk-pixdata.h:58
@ GDK_PIXDATA_SAMPLE_WIDTH_8
Definition gdk-pixdata.h:61
GDK_PIXBUF_DEPRECATED_IN_2_32 guint8 * gdk_pixdata_serialize(const GdkPixdata *pixdata, guint *stream_length_p)
unsigned int guint32
Definition glibconfig.h:57
unsigned char guint8
Definition glibconfig.h:46
signed int gint32
Definition glibconfig.h:56
#define G_END_DECLS
Definition gmacros.h:910
#define G_BEGIN_DECLS
Definition gmacros.h:909
typedefG_BEGIN_DECLS struct _GString GString
Definition gstring.h:43
gint gboolean
Definition gtypes.h:56
G_BEGIN_DECLS typedef char gchar
Definition gtypes.h:52
void * gpointer
Definition gtypes.h:109
unsigned int guint
Definition gtypes.h:61
const char * name
Definition lsqlite3.c:2154
static void error(LoadState *S, const char *why)
guint32 width
Definition gdk-pixdata.h:78
guint32 pixdata_type
Definition gdk-pixdata.h:76
guint32 rowstride
Definition gdk-pixdata.h:77
gint32 length
Definition gdk-pixdata.h:73
guint8 * pixel_data
Definition gdk-pixdata.h:80
guint32 height
Definition gdk-pixdata.h:79
guint32 magic
Definition gdk-pixdata.h:72