2001-05-07 15:58:47 +00:00
|
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* GdkPixbuf library - Private declarations
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 1999 The Free Software Foundation
|
|
|
|
|
*
|
|
|
|
|
* Authors: Mark Crichton <crichton@gimp.org>
|
|
|
|
|
* Miguel de Icaza <miguel@gnu.org>
|
|
|
|
|
* Federico Mena-Quintero <federico@gimp.org>
|
|
|
|
|
* Havoc Pennington <hp@redhat.com>
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
2000-04-11 07:03:25 +00:00
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Lesser General Public License for more details.
|
2000-04-11 07:03:25 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2000-04-11 07:03:25 +00:00
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef GDK_PIXBUF_PRIVATE_H
|
|
|
|
|
#define GDK_PIXBUF_PRIVATE_H
|
|
|
|
|
|
|
|
|
|
#include "gdk-pixbuf.h"
|
2002-10-03 22:39:51 +00:00
|
|
|
|
#include "gdk-pixbuf-io.h"
|
|
|
|
|
#include "gdk-pixbuf-i18n.h"
|
|
|
|
|
#include <stdio.h>
|
2000-04-11 07:03:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-06-22 15:36:12 +00:00
|
|
|
|
typedef struct _GdkPixbufClass GdkPixbufClass;
|
|
|
|
|
|
|
|
|
|
#define GDK_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF, GdkPixbufClass))
|
|
|
|
|
#define GDK_IS_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF))
|
|
|
|
|
#define GDK_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF, GdkPixbufClass))
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* Private part of the GdkPixbuf structure */
|
|
|
|
|
struct _GdkPixbuf {
|
2000-06-22 15:36:12 +00:00
|
|
|
|
GObject parent_instance;
|
2000-04-11 07:03:25 +00:00
|
|
|
|
|
|
|
|
|
/* Color space */
|
|
|
|
|
GdkColorspace colorspace;
|
|
|
|
|
|
|
|
|
|
/* Number of channels, alpha included */
|
|
|
|
|
int n_channels;
|
|
|
|
|
|
|
|
|
|
/* Bits per channel */
|
|
|
|
|
int bits_per_sample;
|
|
|
|
|
|
|
|
|
|
/* Size */
|
|
|
|
|
int width, height;
|
|
|
|
|
|
|
|
|
|
/* Offset between rows */
|
|
|
|
|
int rowstride;
|
|
|
|
|
|
|
|
|
|
/* The pixel array */
|
|
|
|
|
guchar *pixels;
|
|
|
|
|
|
|
|
|
|
/* Destroy notification function; it is supposed to free the pixel array */
|
|
|
|
|
GdkPixbufDestroyNotify destroy_fn;
|
|
|
|
|
|
|
|
|
|
/* User data for the destroy notification function */
|
|
|
|
|
gpointer destroy_fn_data;
|
|
|
|
|
|
|
|
|
|
/* Do we have an alpha channel? */
|
|
|
|
|
guint has_alpha : 1;
|
|
|
|
|
};
|
|
|
|
|
|
2000-06-22 15:36:12 +00:00
|
|
|
|
struct _GdkPixbufClass {
|
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
#ifdef GDK_PIXBUF_ENABLE_BACKEND
|
2000-06-22 15:36:12 +00:00
|
|
|
|
|
Changes to make gdk-pixbuf threadsafe (#157310, #157306, Colin Walters):
2004-11-12 Matthias Clasen <mclasen@redhat.com>
Changes to make gdk-pixbuf threadsafe (#157310, #157306,
Colin Walters):
* gdk-pixbuf-io.h (enum GdkPixbufFormatFlags): Add
GDK_PIXBUF_FORMAT_THREADSAFE to indicate that an image loader
is threadsafe.
* gdk-pixbuf-io.c (get_file_formats, _gdk_pixbuf_load_module):
Use a lock to make initialization of global data structures
threadsafe.
* gdk-pixbuf-private.h:
* gdk-pixbuf-io.c (_gdk_pixbuf_lock, _gdk_pixbuf_unlock):
Auxiliary functions which use another lock to protect
threadunsafe image loaders.
* gdk-pixbuf-io.c (gdk_pixbuf_real_save):
(save_to_callback_with_tmp_file):
(gdk_pixbuf_real_save_to_callback):
(gdk_pixbuf_new_from_xpm_data):
(_gdk_pixbuf_generic_image_load):
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module):
(gdk_pixbuf_loader_close):
(gdk_pixbuf_loader_finalize):
Use _gdk_pixbuf_lock() and _gdk_pixbuf_unlock().
* io-ani.c, io-bmp.c, io-gif.c, io-ico.c:
* io-jpeg.c, io-pcx.c, io-png.c, io-pnm.c:
* io-ras.c, io-tga.c, io-wbmp.c, io-xbm.c:
* io-xpm.c: Mark as threadsafe.
* io-tiff.c: Remove pointless locking, mark as
threadunsafe.
2004-11-12 05:34:31 +00:00
|
|
|
|
void _gdk_pixbuf_lock (GdkPixbufModule *image_module);
|
|
|
|
|
void _gdk_pixbuf_unlock (GdkPixbufModule *image_module);
|
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
GdkPixbufModule *_gdk_pixbuf_get_module (guchar *buffer, guint size,
|
|
|
|
|
const gchar *filename,
|
|
|
|
|
GError **error);
|
|
|
|
|
GdkPixbufModule *_gdk_pixbuf_get_named_module (const char *name,
|
|
|
|
|
GError **error);
|
|
|
|
|
gboolean _gdk_pixbuf_load_module (GdkPixbufModule *image_module,
|
|
|
|
|
GError **error);
|
2000-06-22 15:36:12 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
GdkPixbuf *_gdk_pixbuf_generic_image_load (GdkPixbufModule *image_module,
|
|
|
|
|
FILE *f,
|
|
|
|
|
GError **error);
|
2001-05-07 15:58:47 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
GdkPixbufFormat *_gdk_pixbuf_get_format (GdkPixbufModule *image_module);
|
2000-06-22 15:36:12 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
#ifdef USE_GMODULE
|
|
|
|
|
#define MODULE_ENTRY(type,function) function
|
|
|
|
|
#else
|
|
|
|
|
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
|
|
|
|
|
#endif
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
#endif /* GDK_PIXBUF_ENABLE_BACKEND */
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
#endif /* GDK_PIXBUF_PRIVATE_H */
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
|
|
|
|
|