2002-10-03 22:39:51 +00:00
|
|
|
|
/* GdkPixbuf library - Io handling. This is an internal header for
|
|
|
|
|
* GdkPixbuf. You should never use it unless you are doing development for
|
|
|
|
|
* GdkPixbuf itself.
|
1999-10-26 20:43:39 +00:00
|
|
|
|
*
|
|
|
|
|
* 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>
|
|
|
|
|
* Jonathan Blandford <jrb@redhat.com>
|
1999-10-29 19:27:51 +00:00
|
|
|
|
* Michael Fulbright <drmike@redhat.com>
|
1999-10-26 20:43:39 +00:00
|
|
|
|
*
|
|
|
|
|
* 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
|
1999-10-26 20:43:39 +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.
|
1999-10-26 20:43:39 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1999-10-26 20:43:39 +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.
|
|
|
|
|
*/
|
1999-11-02 01:50:06 +00:00
|
|
|
|
|
|
|
|
|
#ifndef GDK_PIXBUF_IO_H
|
|
|
|
|
#define GDK_PIXBUF_IO_H
|
|
|
|
|
|
1999-10-26 20:43:39 +00:00
|
|
|
|
#include <stdio.h>
|
2004-06-20 05:11:57 +00:00
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <gmodule.h>
|
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf-core.h>
|
|
|
|
|
#include <gdk-pixbuf/gdk-pixbuf-animation.h>
|
1999-10-26 20:43:39 +00:00
|
|
|
|
|
2002-01-09 16:36:20 +00:00
|
|
|
|
G_BEGIN_DECLS
|
1999-11-02 01:50:06 +00:00
|
|
|
|
|
2004-06-20 05:11:57 +00:00
|
|
|
|
typedef struct _GdkPixbufFormat GdkPixbufFormat;
|
|
|
|
|
|
2004-07-08 03:56:36 +00:00
|
|
|
|
GSList *gdk_pixbuf_get_formats (void);
|
2004-06-20 05:11:57 +00:00
|
|
|
|
gchar *gdk_pixbuf_format_get_name (GdkPixbufFormat *format);
|
|
|
|
|
gchar *gdk_pixbuf_format_get_description (GdkPixbufFormat *format);
|
|
|
|
|
gchar **gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format);
|
|
|
|
|
gchar **gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format);
|
|
|
|
|
gboolean gdk_pixbuf_format_is_writable (GdkPixbufFormat *format);
|
|
|
|
|
gboolean gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format);
|
2004-07-08 03:56:36 +00:00
|
|
|
|
gboolean gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format);
|
|
|
|
|
void gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format,
|
|
|
|
|
gboolean disabled);
|
|
|
|
|
gchar *gdk_pixbuf_format_get_license (GdkPixbufFormat *format);
|
2004-06-20 05:11:57 +00:00
|
|
|
|
|
2004-07-08 03:56:36 +00:00
|
|
|
|
GdkPixbufFormat *gdk_pixbuf_get_file_info (const gchar *filename,
|
|
|
|
|
gint *width,
|
|
|
|
|
gint *height);
|
2004-06-20 05:11:57 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
#ifdef GDK_PIXBUF_ENABLE_BACKEND
|
1999-10-27 17:31:07 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
|
2002-07-06 23:10:46 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
typedef void (* GdkPixbufModuleSizeFunc) (gint *width,
|
|
|
|
|
gint *height,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
|
|
typedef void (* GdkPixbufModulePreparedFunc) (GdkPixbuf *pixbuf,
|
|
|
|
|
GdkPixbufAnimation *anim,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
typedef void (* GdkPixbufModuleUpdatedFunc) (GdkPixbuf *pixbuf,
|
|
|
|
|
int x,
|
|
|
|
|
int y,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
|
|
typedef struct _GdkPixbufModulePattern GdkPixbufModulePattern;
|
|
|
|
|
struct _GdkPixbufModulePattern {
|
2005-08-30 15:07:12 +00:00
|
|
|
|
char *prefix;
|
|
|
|
|
char *mask;
|
2002-10-03 22:39:51 +00:00
|
|
|
|
int relevance;
|
|
|
|
|
};
|
1999-10-26 22:04:29 +00:00
|
|
|
|
|
1999-10-28 14:46:46 +00:00
|
|
|
|
typedef struct _GdkPixbufModule GdkPixbufModule;
|
|
|
|
|
struct _GdkPixbufModule {
|
1999-10-26 20:43:39 +00:00
|
|
|
|
char *module_name;
|
2002-10-03 22:39:51 +00:00
|
|
|
|
char *module_path;
|
1999-10-27 19:15:37 +00:00
|
|
|
|
GModule *module;
|
2002-10-03 22:39:51 +00:00
|
|
|
|
GdkPixbufFormat *info;
|
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
GdkPixbuf *(* load) (FILE *f,
|
|
|
|
|
GError **error);
|
2000-01-02 03:59:22 +00:00
|
|
|
|
GdkPixbuf *(* load_xpm_data) (const char **data);
|
1999-10-26 22:04:29 +00:00
|
|
|
|
|
|
|
|
|
/* Incremental loading */
|
2000-01-02 03:59:22 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
gpointer (* begin_load) (GdkPixbufModuleSizeFunc size_func,
|
|
|
|
|
GdkPixbufModulePreparedFunc prepare_func,
|
|
|
|
|
GdkPixbufModuleUpdatedFunc update_func,
|
Add built marshaller files to support GdkPixbufLoader signals
2001-01-22 Havoc Pennington <hp@redhat.com>
* Makefile.am: Add built marshaller files to support
GdkPixbufLoader signals
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
module location, rather than acting as a fallback, because we are
using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
* gdk-pixbuf.h: include gdk-pixbuf-loader.h
* gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
from gtk, and add error to close(), because stop_load may do
parsing of the image.
* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
* io-*.c: make individual operations static, and add fill_vtable
functions which are exported. Fix the collection of type warnings
that surfaced, including a number of functions that didn't
properly take a GError and some that weren't
const-correct. Involved adding error handling for a few loaders.
* gdk-pixbuf-io.h: Add error reporting to stop_load function
* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
a function that fills in the GdkPixbufModule vtable, instead of
looking up all the image functions individually; this means we
can get type safety within modules for the loader functions.
Also it means you don't have to keep the statically compiled and
GModule versions in sync.
* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
* gdk-pixbuf.h: nuke gdk_pixbuf_init()
* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
() here
* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
g_type_init() here
2001-01-22 Havoc Pennington <hp@redhat.com>
* demos/testanimation.c: fix to reflect gdk-pixbuf changes
* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes
* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
Remove, move back to gdk-pixbuf
* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
to all the word functions
* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
before doing anything on NULL layout or if we don't have the focus
* gtk/testtext.c (fill_example_buffer): "justification"
* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
to be called "justification" not "justify"
* demos/gtk-demo/textview.c (create_tags): "justification"
* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
2001-01-22 23:09:48 +00:00
|
|
|
|
gpointer user_data,
|
|
|
|
|
GError **error);
|
|
|
|
|
gboolean (* stop_load) (gpointer context,
|
|
|
|
|
GError **error);
|
2000-10-06 18:19:18 +00:00
|
|
|
|
gboolean (* load_increment) (gpointer context,
|
|
|
|
|
const guchar *buf,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
guint size,
|
|
|
|
|
GError **error);
|
1999-12-11 00:21:27 +00:00
|
|
|
|
|
|
|
|
|
/* Animation loading */
|
2000-10-18 18:42:54 +00:00
|
|
|
|
GdkPixbufAnimation *(* load_animation) (FILE *f,
|
|
|
|
|
GError **error);
|
2000-10-06 18:19:18 +00:00
|
|
|
|
|
2004-01-07 01:57:42 +00:00
|
|
|
|
/* Saving */
|
2000-10-06 18:19:18 +00:00
|
|
|
|
gboolean (* save) (FILE *f,
|
|
|
|
|
GdkPixbuf *pixbuf,
|
|
|
|
|
gchar **param_keys,
|
|
|
|
|
gchar **param_values,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
GError **error);
|
2004-01-07 01:57:42 +00:00
|
|
|
|
|
|
|
|
|
gboolean (*save_to_callback) (GdkPixbufSaveFunc save_func,
|
|
|
|
|
gpointer user_data,
|
|
|
|
|
GdkPixbuf *pixbuf,
|
|
|
|
|
gchar **option_keys,
|
|
|
|
|
gchar **option_values,
|
|
|
|
|
GError **error);
|
2002-10-03 22:39:51 +00:00
|
|
|
|
|
2002-12-08 00:18:13 +00:00
|
|
|
|
/*< private >*/
|
2002-10-03 22:39:51 +00:00
|
|
|
|
void (*_reserved1) (void);
|
|
|
|
|
void (*_reserved2) (void);
|
|
|
|
|
void (*_reserved3) (void);
|
|
|
|
|
void (*_reserved4) (void);
|
|
|
|
|
void (*_reserved5) (void);
|
1999-10-26 20:43:39 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
};
|
1999-10-26 20:43:39 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
typedef void (* GdkPixbufModuleFillVtableFunc) (GdkPixbufModule *module);
|
|
|
|
|
typedef void (* GdkPixbufModuleFillInfoFunc) (GdkPixbufFormat *info);
|
|
|
|
|
|
|
|
|
|
/* key/value pairs that can be attached by the pixbuf loader */
|
|
|
|
|
|
|
|
|
|
gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf,
|
|
|
|
|
const gchar *key,
|
|
|
|
|
const gchar *value);
|
|
|
|
|
|
|
|
|
|
typedef enum /*< skip >*/
|
|
|
|
|
{
|
2004-01-07 01:57:42 +00:00
|
|
|
|
GDK_PIXBUF_FORMAT_WRITABLE = 1 << 0,
|
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
|
|
|
|
GDK_PIXBUF_FORMAT_SCALABLE = 1 << 1,
|
|
|
|
|
GDK_PIXBUF_FORMAT_THREADSAFE = 1 << 2
|
2002-10-03 22:39:51 +00:00
|
|
|
|
} GdkPixbufFormatFlags;
|
|
|
|
|
|
|
|
|
|
struct _GdkPixbufFormat {
|
|
|
|
|
gchar *name;
|
|
|
|
|
GdkPixbufModulePattern *signature;
|
|
|
|
|
gchar *domain;
|
|
|
|
|
gchar *description;
|
|
|
|
|
gchar **mime_types;
|
|
|
|
|
gchar **extensions;
|
|
|
|
|
guint32 flags;
|
2004-07-08 03:56:36 +00:00
|
|
|
|
gboolean disabled;
|
|
|
|
|
gchar *license;
|
2002-10-03 22:39:51 +00:00
|
|
|
|
};
|
1999-10-26 22:04:29 +00:00
|
|
|
|
|
2002-08-22 21:32:06 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
#endif /* GDK_PIXBUF_ENABLE_BACKEND */
|
1999-11-02 01:50:06 +00:00
|
|
|
|
|
2002-01-09 16:36:20 +00:00
|
|
|
|
G_END_DECLS
|
1999-11-02 01:50:06 +00:00
|
|
|
|
|
2002-10-03 22:39:51 +00:00
|
|
|
|
#endif /* GDK_PIXBUF_IO_H */
|