1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2/* GdkPixbuf library - Private declarations
3 *
4 * Copyright (C) 1999 The Free Software Foundation
5 *
6 * Authors: Mark Crichton <crichton@gimp.org>
7 * Miguel de Icaza <miguel@gnu.org>
8 * Federico Mena-Quintero <federico@gimp.org>
9 * Havoc Pennington <hp@redhat.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
23 */
24
25#ifndef GDK_PIXBUF_PRIVATE_H
26#define GDK_PIXBUF_PRIVATE_H
27
28#include <stdio.h>
29#include <math.h>
30
31#include <glib-object.h>
32#include <glib/gi18n-lib.h>
33
34#include "gdk-pixbuf-core.h"
35#include "gdk-pixbuf-loader.h"
36#include "gdk-pixbuf-io.h"
37
38#define LOAD_BUFFER_SIZE 65536
39#define SNIFF_BUFFER_SIZE 4096
40
41
42
43typedef struct _GdkPixbufClass GdkPixbufClass;
44
45#define GDK_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF, GdkPixbufClass))
46#define GDK_IS_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF))
47#define GDK_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF, GdkPixbufClass))
48
49/* Default fill color */
50#define DEFAULT_FILL_COLOR 0x979899ff
51
52typedef enum {
53 STORAGE_UNINITIALIZED,
54 STORAGE_PIXELS,
55 STORAGE_BYTES
56} Storage;
57
58typedef struct {
59 /* The pixel array */
60 guchar *pixels;
61
62 /* Destroy notification function; it is supposed to free the pixel array */
63 GdkPixbufDestroyNotify destroy_fn;
64
65 /* User data for the destroy notification function */
66 gpointer destroy_fn_data;
67} Pixels;
68
69typedef struct {
70 GBytes *bytes;
71} Bytes;
72
73/* Private part of the GdkPixbuf structure */
74struct _GdkPixbuf {
75 GObject parent_instance;
76
77 /* Color space */
78 GdkColorspace colorspace;
79
80 /* Number of channels, alpha included */
81 int n_channels;
82
83 /* Bits per channel */
84 int bits_per_sample;
85
86 /* Size */
87 int width, height;
88
89 /* Offset between rows */
90 int rowstride;
91
92 Storage storage;
93
94 struct {
95 Pixels pixels;
96 Bytes bytes;
97 } s;
98
99 /* Do we have an alpha channel? */
100 guint has_alpha : 1;
101};
102
103struct _GdkPixbufClass {
104 GObjectClass parent_class;
105
106};
107
108#ifdef GDK_PIXBUF_ENABLE_BACKEND
109
110GdkPixbufModule *_gdk_pixbuf_get_module (guchar *buffer, guint size,
111 const gchar *filename,
112 GError **error);
113GdkPixbufModule *_gdk_pixbuf_get_named_module (const char *name,
114 GError **error);
115gboolean _gdk_pixbuf_load_module (GdkPixbufModule *image_module,
116 GError **error);
117
118GdkPixbuf *_gdk_pixbuf_generic_image_load (GdkPixbufModule *image_module,
119 FILE *f,
120 GError **error);
121
122GdkPixbufFormat *_gdk_pixbuf_get_format (GdkPixbufModule *image_module);
123
124
125#endif /* GDK_PIXBUF_ENABLE_BACKEND */
126
127GdkPixbuf * _gdk_pixbuf_new_from_resource_try_pixdata (const char *resource_path);
128GdkPixbufLoader *_gdk_pixbuf_loader_new_with_filename (const char *filename);
129
130void _gdk_pixbuf_init_gettext (void);
131
132#endif /* GDK_PIXBUF_PRIVATE_H */
133
134#ifdef GDK_PIXBUF_RELOCATABLE
135
136gchar * gdk_pixbuf_get_toplevel (void);
137
138#endif /* G_OS_WIN32 */
139

source code of gtk/subprojects/gdk-pixbuf/gdk-pixbuf/gdk-pixbuf-private.h