1999-10-20 21:20:49 +00:00
|
|
|
|
/* GdkPixbuf library - Main loading interface.
|
1999-01-04 23:53:12 +00:00
|
|
|
|
*
|
1999-10-20 21:20:49 +00:00
|
|
|
|
* Copyright (C) 1999 The Free Software Foundation
|
|
|
|
|
*
|
|
|
|
|
* Authors: Miguel de Icaza <miguel@gnu.org>
|
|
|
|
|
* Federico Mena-Quintero <federico@gimp.org>
|
|
|
|
|
*
|
|
|
|
|
* 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-20 21:20:49 +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-20 21:20:49 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1999-10-20 21:20:49 +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-01-04 23:53:12 +00:00
|
|
|
|
*/
|
1999-08-09 06:09:24 +00:00
|
|
|
|
|
1999-01-04 23:53:12 +00:00
|
|
|
|
#include <config.h>
|
1999-08-09 06:09:24 +00:00
|
|
|
|
#include <string.h>
|
1999-11-22 20:43:58 +00:00
|
|
|
|
#include <glib.h>
|
2000-10-06 18:19:18 +00:00
|
|
|
|
#include <errno.h>
|
2000-04-11 07:03:25 +00:00
|
|
|
|
#include "gdk-pixbuf-private.h"
|
1999-11-23 01:25:28 +00:00
|
|
|
|
#include "gdk-pixbuf-io.h"
|
1999-01-04 23:53:12 +00:00
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
|
|
|
|
|
1999-01-05 04:31:03 +00:00
|
|
|
|
static gboolean
|
1999-10-20 21:20:49 +00:00
|
|
|
|
pixbuf_check_png (guchar *buffer, int size)
|
1999-01-05 04:31:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (size < 28)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (buffer [0] != 0x89 ||
|
|
|
|
|
buffer [1] != 'P' ||
|
|
|
|
|
buffer [2] != 'N' ||
|
|
|
|
|
buffer [3] != 'G' ||
|
|
|
|
|
buffer [4] != 0x0d ||
|
|
|
|
|
buffer [5] != 0x0a ||
|
|
|
|
|
buffer [6] != 0x1a ||
|
|
|
|
|
buffer [7] != 0x0a)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
1999-10-20 21:20:49 +00:00
|
|
|
|
pixbuf_check_jpeg (guchar *buffer, int size)
|
1999-01-05 04:31:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (size < 10)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (buffer [0] != 0xff || buffer [1] != 0xd8)
|
|
|
|
|
return FALSE;
|
1999-08-09 06:09:24 +00:00
|
|
|
|
|
1999-01-05 04:31:03 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
1999-10-20 21:20:49 +00:00
|
|
|
|
pixbuf_check_tiff (guchar *buffer, int size)
|
1999-01-05 04:31:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (size < 10)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
1999-08-09 06:09:24 +00:00
|
|
|
|
if (buffer [0] == 'M' &&
|
|
|
|
|
buffer [1] == 'M' &&
|
|
|
|
|
buffer [2] == 0 &&
|
1999-07-19 02:13:34 +00:00
|
|
|
|
buffer [3] == 0x2a)
|
1999-01-05 04:31:03 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
1999-08-09 06:09:24 +00:00
|
|
|
|
if (buffer [0] == 'I' &&
|
|
|
|
|
buffer [1] == 'I' &&
|
|
|
|
|
buffer [2] == 0x2a &&
|
1999-07-19 02:13:34 +00:00
|
|
|
|
buffer [3] == 0)
|
1999-01-05 04:31:03 +00:00
|
|
|
|
return TRUE;
|
1999-08-09 06:09:24 +00:00
|
|
|
|
|
1999-01-05 04:31:03 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
1999-10-20 21:20:49 +00:00
|
|
|
|
pixbuf_check_gif (guchar *buffer, int size)
|
1999-01-05 04:31:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (size < 20)
|
|
|
|
|
return FALSE;
|
1999-08-09 06:09:24 +00:00
|
|
|
|
|
1999-01-05 04:31:03 +00:00
|
|
|
|
if (strncmp (buffer, "GIF8", 4) == 0)
|
|
|
|
|
return TRUE;
|
1999-08-09 06:09:24 +00:00
|
|
|
|
|
1999-01-05 04:31:03 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
1999-10-20 21:20:49 +00:00
|
|
|
|
pixbuf_check_xpm (guchar *buffer, int size)
|
1999-01-05 04:31:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (size < 20)
|
|
|
|
|
return FALSE;
|
1999-08-09 06:09:24 +00:00
|
|
|
|
|
1999-01-05 04:31:03 +00:00
|
|
|
|
if (strncmp (buffer, "/* XPM */", 9) == 0)
|
|
|
|
|
return TRUE;
|
1999-08-09 06:09:24 +00:00
|
|
|
|
|
1999-01-05 04:31:03 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
1999-11-05 00:16:10 +00:00
|
|
|
|
pixbuf_check_pnm (guchar *buffer, int size)
|
1999-01-05 04:31:03 +00:00
|
|
|
|
{
|
|
|
|
|
if (size < 20)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
|
if (buffer [0] == 'P') {
|
1999-01-05 04:31:03 +00:00
|
|
|
|
if (buffer [1] == '1' ||
|
|
|
|
|
buffer [1] == '2' ||
|
|
|
|
|
buffer [1] == '3' ||
|
|
|
|
|
buffer [1] == '4' ||
|
|
|
|
|
buffer [1] == '5' ||
|
|
|
|
|
buffer [1] == '6')
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
1999-11-05 21:29:33 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
pixbuf_check_sunras (guchar *buffer, int size)
|
|
|
|
|
{
|
|
|
|
|
if (size < 32)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (buffer [0] != 0x59 ||
|
|
|
|
|
buffer [1] != 0xA6 ||
|
|
|
|
|
buffer [2] != 0x6A ||
|
|
|
|
|
buffer [3] != 0x95)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-29 16:49:39 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
pixbuf_check_ico (guchar *buffer, int size)
|
|
|
|
|
{
|
|
|
|
|
/* Note that this may cause false positives, but .ico's don't
|
|
|
|
|
have a magic number.*/
|
|
|
|
|
if (size < 6)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (buffer [0] != 0x0 ||
|
|
|
|
|
buffer [1] != 0x0 ||
|
1999-12-04 18:17:52 +00:00
|
|
|
|
((buffer [2] != 0x1)&&(buffer[2]!=0x2)) ||
|
1999-11-29 16:49:39 +00:00
|
|
|
|
buffer [3] != 0x0 ||
|
|
|
|
|
buffer [5] != 0x0 )
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-05 00:16:10 +00:00
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
pixbuf_check_bmp (guchar *buffer, int size)
|
|
|
|
|
{
|
|
|
|
|
if (size < 20)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (buffer [0] != 'B' || buffer [1] != 'M')
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-28 00:09:36 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
pixbuf_check_wbmp (guchar *buffer, int size)
|
|
|
|
|
{
|
|
|
|
|
if(size < 10) /* at least */
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if(buffer[0] == '\0' /* We only handle type 0 wbmp's for now */)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-22 02:08:53 +00:00
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
pixbuf_check_xbm (guchar *buffer, int size)
|
|
|
|
|
{
|
|
|
|
|
if (size < 20)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (buffer [0] != '#'
|
|
|
|
|
|| buffer [1] != 'd'
|
|
|
|
|
|| buffer [2] != 'e'
|
|
|
|
|
|| buffer [3] != 'f'
|
|
|
|
|
|| buffer [4] != 'i'
|
|
|
|
|
|| buffer [5] != 'n'
|
|
|
|
|
|| buffer [6] != 'e'
|
|
|
|
|
|| buffer [7] != ' ')
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-02-22 00:29:00 +00:00
|
|
|
|
static GdkPixbufModule file_formats [] = {
|
2000-10-06 18:19:18 +00:00
|
|
|
|
{ "png", pixbuf_check_png, NULL, NULL, NULL, NULL, NULL, NULL, NULL, },
|
|
|
|
|
{ "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
|
|
|
|
{ "tiff", pixbuf_check_tiff, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
|
|
|
|
{ "gif", pixbuf_check_gif, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
1999-10-22 21:05:16 +00:00
|
|
|
|
#define XPM_FILE_FORMAT_INDEX 4
|
2000-10-06 18:19:18 +00:00
|
|
|
|
{ "xpm", pixbuf_check_xpm, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
|
|
|
|
{ "pnm", pixbuf_check_pnm, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
|
|
|
|
{ "ras", pixbuf_check_sunras, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
|
|
|
|
{ "ico", pixbuf_check_ico, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
|
|
|
|
{ "bmp", pixbuf_check_bmp, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
|
|
|
|
{ "wbmp", pixbuf_check_wbmp, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
2001-01-22 02:08:53 +00:00
|
|
|
|
{ "xbm", pixbuf_check_xbm, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
|
1999-12-06 18:57:03 +00:00
|
|
|
|
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
|
1999-01-04 23:53:12 +00:00
|
|
|
|
};
|
|
|
|
|
|
2000-02-22 00:29:00 +00:00
|
|
|
|
#ifdef USE_GMODULE
|
|
|
|
|
static gboolean
|
|
|
|
|
pixbuf_module_symbol (GModule *module, const char *module_name, const char *symbol_name, gpointer *symbol)
|
|
|
|
|
{
|
|
|
|
|
char *full_symbol_name = g_strconcat ("gdk_pixbuf__", module_name, "_", symbol_name, NULL);
|
|
|
|
|
gboolean return_value;
|
|
|
|
|
|
|
|
|
|
return_value = g_module_symbol (module, full_symbol_name, symbol);
|
|
|
|
|
g_free (full_symbol_name);
|
|
|
|
|
|
|
|
|
|
return return_value;
|
|
|
|
|
}
|
1999-10-29 19:27:51 +00:00
|
|
|
|
|
2000-07-22 23:50:19 +00:00
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
get_libdir (void)
|
|
|
|
|
{
|
|
|
|
|
static char *libdir = NULL;
|
|
|
|
|
|
|
|
|
|
if (libdir == NULL)
|
2001-01-17 22:26:19 +00:00
|
|
|
|
libdir = g_win32_get_package_installation_subdirectory
|
|
|
|
|
(GETTEXT_PACKAGE,
|
|
|
|
|
g_strdup_printf ("gdk_pixbug-%d.%d.dll",
|
|
|
|
|
GDK_PIXBUF_MAJOR, GDK_PIXBUF_MINOR),
|
|
|
|
|
"loaders");
|
2000-07-22 23:50:19 +00:00
|
|
|
|
|
|
|
|
|
return libdir;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define PIXBUF_LIBDIR get_libdir ()
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-10-29 19:27:51 +00:00
|
|
|
|
/* actually load the image handler - gdk_pixbuf_get_module only get a */
|
|
|
|
|
/* reference to the module to load, it doesn't actually load it */
|
|
|
|
|
/* perhaps these actions should be combined in one function */
|
2000-10-18 18:42:54 +00:00
|
|
|
|
gboolean
|
2001-02-20 02:59:30 +00:00
|
|
|
|
_gdk_pixbuf_load_module (GdkPixbufModule *image_module,
|
|
|
|
|
GError **error)
|
1999-01-04 23:53:12 +00:00
|
|
|
|
{
|
1999-07-19 02:13:34 +00:00
|
|
|
|
char *module_name;
|
1999-01-05 04:31:03 +00:00
|
|
|
|
char *path;
|
|
|
|
|
GModule *module;
|
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 sym;
|
2000-02-22 00:29:00 +00:00
|
|
|
|
char *name;
|
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
|
|
|
|
gboolean retval;
|
2001-02-19 22:51:15 +00:00
|
|
|
|
const char *dir;
|
2000-02-22 00:29:00 +00:00
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
g_return_val_if_fail (image_module->module == NULL, FALSE);
|
1999-10-26 20:43:39 +00:00
|
|
|
|
|
2000-02-22 00:29:00 +00:00
|
|
|
|
name = image_module->module_name;
|
|
|
|
|
|
2000-04-13 01:18:41 +00:00
|
|
|
|
module_name = g_strconcat ("pixbufloader-", name, NULL);
|
1999-10-27 18:55:00 +00:00
|
|
|
|
|
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
|
|
|
|
/* This would be an exploit in an suid binary using gdk-pixbuf,
|
|
|
|
|
* but see http://www.gtk.org/setuid.html or the BugTraq
|
|
|
|
|
* archives for why you should report this as a bug against
|
|
|
|
|
* setuid apps using this library rather than the library
|
|
|
|
|
* itself.
|
|
|
|
|
*/
|
|
|
|
|
dir = g_getenv ("GDK_PIXBUF_MODULEDIR");
|
|
|
|
|
|
|
|
|
|
if (dir == NULL || *dir == '\0') {
|
|
|
|
|
|
|
|
|
|
path = g_module_build_path (PIXBUF_LIBDIR, module_name);
|
|
|
|
|
module = g_module_open (path, G_MODULE_BIND_LAZY);
|
|
|
|
|
} else {
|
|
|
|
|
path = g_module_build_path (dir, module_name);
|
|
|
|
|
module = g_module_open (path, G_MODULE_BIND_LAZY);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!module) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Unable to load image-loading module: %s: %s"),
|
|
|
|
|
path, g_module_error ());
|
|
|
|
|
g_free (module_name);
|
1999-10-27 18:55:00 +00:00
|
|
|
|
g_free (path);
|
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
|
|
|
|
return FALSE;
|
1999-10-27 18:55:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (module_name);
|
1999-07-17 20:03:34 +00:00
|
|
|
|
|
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
|
|
|
|
image_module->module = module;
|
|
|
|
|
|
|
|
|
|
if (pixbuf_module_symbol (module, name, "fill_vtable", &sym)) {
|
|
|
|
|
ModuleFillVtableFunc func = sym;
|
|
|
|
|
(* func) (image_module);
|
|
|
|
|
retval = TRUE;
|
|
|
|
|
} else {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Image-loading module %s does not export the proper interface; perhaps it's from a different GTK version?"),
|
|
|
|
|
path);
|
|
|
|
|
retval = FALSE;
|
|
|
|
|
}
|
2000-10-06 18:19:18 +00:00
|
|
|
|
|
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
|
|
|
|
g_free (path);
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
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
|
|
|
|
return retval;
|
1999-01-04 23:53:12 +00:00
|
|
|
|
}
|
2000-02-22 00:29:00 +00:00
|
|
|
|
#else
|
|
|
|
|
|
2001-01-26 18:50:58 +00:00
|
|
|
|
#define mname(type,fn) gdk_pixbuf__ ## type ## _ ##fn
|
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
|
|
|
|
#define m_fill_vtable(type) extern void mname(type,fill_vtable) (GdkPixbufModule *module)
|
|
|
|
|
|
|
|
|
|
m_fill_vtable (png);
|
|
|
|
|
m_fill_vtable (bmp);
|
|
|
|
|
m_fill_vtable (wbmp);
|
|
|
|
|
m_fill_vtable (gif);
|
|
|
|
|
m_fill_vtable (ico);
|
|
|
|
|
m_fill_vtable (jpeg);
|
|
|
|
|
m_fill_vtable (pnm);
|
|
|
|
|
m_fill_vtable (ras);
|
|
|
|
|
m_fill_vtable (tiff);
|
|
|
|
|
m_fill_vtable (xpm);
|
|
|
|
|
m_fill_vtable (xbm);
|
2000-02-22 00:29:00 +00:00
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
gboolean
|
2001-02-20 02:59:30 +00:00
|
|
|
|
_gdk_pixbuf_load_module (GdkPixbufModule *image_module,
|
|
|
|
|
GError **error)
|
2000-02-22 00:29:00 +00:00
|
|
|
|
{
|
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
|
|
|
|
ModuleFillVtableFunc fill_vtable = NULL;
|
2000-02-22 00:29:00 +00:00
|
|
|
|
image_module->module = (void *) 1;
|
2001-01-09 09:53:28 +00:00
|
|
|
|
|
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
|
|
|
|
if (FALSE) {
|
|
|
|
|
/* Ugly hack so we can use else if unconditionally below ;-) */
|
|
|
|
|
}
|
|
|
|
|
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#ifdef INCLUDE_png
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "png") == 0){
|
|
|
|
|
fill_vtable = mname (png, fill_vtable);
|
2000-02-22 00:29:00 +00:00
|
|
|
|
}
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#endif
|
2000-02-22 00:29:00 +00:00
|
|
|
|
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#ifdef INCLUDE_bmp
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "bmp") == 0){
|
|
|
|
|
fill_vtable = mname (bmp, fill_vtable);
|
2000-02-22 00:29:00 +00:00
|
|
|
|
}
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#endif
|
2000-02-22 00:29:00 +00:00
|
|
|
|
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#ifdef INCLUDE_wbmp
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "wbmp") == 0){
|
|
|
|
|
fill_vtable = mname (wbmp, fill_vtable);
|
2000-07-28 00:09:36 +00:00
|
|
|
|
}
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#endif
|
2000-07-28 00:09:36 +00:00
|
|
|
|
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#ifdef INCLUDE_gif
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "gif") == 0){
|
|
|
|
|
fill_vtable = mname (gif, fill_vtable);
|
2000-02-22 00:29:00 +00:00
|
|
|
|
}
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#endif
|
2000-02-22 00:29:00 +00:00
|
|
|
|
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#ifdef INCLUDE_ico
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "ico") == 0){
|
|
|
|
|
fill_vtable = mname (ico, fill_vtable);
|
2000-02-22 00:29:00 +00:00
|
|
|
|
}
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#endif
|
2000-02-22 00:29:00 +00:00
|
|
|
|
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#ifdef INCLUDE_jpeg
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "jpeg") == 0){
|
|
|
|
|
fill_vtable = mname (jpeg, fill_vtable);
|
2000-02-22 00:29:00 +00:00
|
|
|
|
}
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef INCLUDE_pnm
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "pnm") == 0){
|
|
|
|
|
fill_vtable = mname (pnm, fill_vtable);
|
2000-02-22 00:29:00 +00:00
|
|
|
|
}
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef INCLUDE_ras
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "ras") == 0){
|
|
|
|
|
fill_vtable = mname (ras, fill_vtable);
|
2000-02-22 00:29:00 +00:00
|
|
|
|
}
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef INCLUDE_tiff
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "tiff") == 0){
|
|
|
|
|
fill_vtable = mname (tiff, fill_vtable);
|
2000-02-22 00:29:00 +00:00
|
|
|
|
}
|
2001-01-09 09:53:28 +00:00
|
|
|
|
#endif
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
2001-01-22 02:08:53 +00:00
|
|
|
|
#ifdef INCLUDE_xpm
|
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
|
|
|
|
else if (strcmp (image_module->module_name, "xpm") == 0){
|
|
|
|
|
fill_vtable = mname (xpm, fill_vtable);
|
2001-01-22 02:08:53 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
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
|
|
|
|
#ifdef INCLUDE_xbm
|
|
|
|
|
else if (strcmp (image_module->module_name, "xbm") == 0){
|
|
|
|
|
fill_vtable = mname (xbm, fill_vtable);
|
2001-01-22 02:08:53 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
if (fill_vtable) {
|
|
|
|
|
(* fill_vtable) (image_module);
|
|
|
|
|
return TRUE;
|
|
|
|
|
} else {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
|
|
|
|
|
_("Image type '%s' is not supported"),
|
|
|
|
|
image_module->module_name);
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2000-02-22 00:29:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
1999-01-04 23:53:12 +00:00
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
|
|
|
|
|
2000-07-28 00:09:36 +00:00
|
|
|
|
GdkPixbufModule *
|
2001-02-20 02:59:30 +00:00
|
|
|
|
_gdk_pixbuf_get_named_module (const char *name,
|
|
|
|
|
GError **error)
|
2000-07-28 00:09:36 +00:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; file_formats [i].module_name; i++) {
|
|
|
|
|
if (!strcmp(name, file_formats[i].module_name))
|
|
|
|
|
return &(file_formats[i]);
|
|
|
|
|
}
|
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
|
|
|
|
|
_("Image type '%s' is not supported"),
|
|
|
|
|
name);
|
|
|
|
|
|
2000-07-28 00:09:36 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-28 14:46:46 +00:00
|
|
|
|
GdkPixbufModule *
|
2001-02-20 02:59:30 +00:00
|
|
|
|
_gdk_pixbuf_get_module (guchar *buffer, guint size,
|
|
|
|
|
const gchar *filename,
|
|
|
|
|
GError **error)
|
1999-10-26 20:43:39 +00:00
|
|
|
|
{
|
2000-01-02 03:59:22 +00:00
|
|
|
|
int i;
|
1999-10-26 20:43:39 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; file_formats [i].module_name; i++) {
|
|
|
|
|
if ((* file_formats [i].format_check) (buffer, size))
|
|
|
|
|
return &(file_formats[i]);
|
|
|
|
|
}
|
2000-01-02 03:59:22 +00:00
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
if (filename)
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
|
|
|
|
|
_("Couldn't recognize the image file format for file '%s'"),
|
|
|
|
|
filename);
|
|
|
|
|
else
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
|
|
|
|
|
_("Unrecognized image file format"));
|
|
|
|
|
|
|
|
|
|
|
1999-10-26 20:43:39 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-04 08:14:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_new_from_file:
|
|
|
|
|
* @filename: Name of file to load.
|
2000-10-18 18:42:54 +00:00
|
|
|
|
* @error: Return location for an error
|
1999-11-10 06:40:12 +00:00
|
|
|
|
*
|
1999-11-04 08:14:32 +00:00
|
|
|
|
* Creates a new pixbuf by loading an image from a file. The file format is
|
2000-10-18 18:42:54 +00:00
|
|
|
|
* detected automatically. If NULL is returned, then @error will be set.
|
|
|
|
|
* Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
|
1999-11-10 06:40:12 +00:00
|
|
|
|
*
|
|
|
|
|
* Return value: A newly-created pixbuf with a reference count of 1, or NULL if
|
|
|
|
|
* any of several error conditions occurred: the file could not be opened,
|
|
|
|
|
* there was no loader for the file's format, there was not enough memory to
|
|
|
|
|
* allocate the image buffer, or the image file contained invalid data.
|
1999-11-04 08:14:32 +00:00
|
|
|
|
**/
|
1999-10-18 19:29:45 +00:00
|
|
|
|
GdkPixbuf *
|
2000-10-18 18:42:54 +00:00
|
|
|
|
gdk_pixbuf_new_from_file (const char *filename,
|
|
|
|
|
GError **error)
|
1999-01-04 23:53:12 +00:00
|
|
|
|
{
|
1999-10-18 19:29:45 +00:00
|
|
|
|
GdkPixbuf *pixbuf;
|
2000-01-02 03:59:22 +00:00
|
|
|
|
int size;
|
1999-01-04 23:53:12 +00:00
|
|
|
|
FILE *f;
|
2000-01-02 03:59:22 +00:00
|
|
|
|
guchar buffer [128];
|
1999-10-28 14:46:46 +00:00
|
|
|
|
GdkPixbufModule *image_module;
|
1999-01-04 23:53:12 +00:00
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
g_return_val_if_fail (filename != NULL, NULL);
|
|
|
|
|
|
2000-07-22 23:50:19 +00:00
|
|
|
|
f = fopen (filename, "rb");
|
2000-10-18 18:42:54 +00:00
|
|
|
|
if (!f) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
G_FILE_ERROR,
|
|
|
|
|
g_file_error_from_errno (errno),
|
|
|
|
|
_("Failed to open file '%s': %s"),
|
|
|
|
|
filename, g_strerror (errno));
|
1999-01-04 23:53:12 +00:00
|
|
|
|
return NULL;
|
2000-10-18 18:42:54 +00:00
|
|
|
|
}
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
1999-10-26 20:43:39 +00:00
|
|
|
|
size = fread (&buffer, 1, sizeof (buffer), f);
|
|
|
|
|
if (size == 0) {
|
2000-10-18 18:42:54 +00:00
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Image file '%s' contains no data"),
|
|
|
|
|
filename);
|
|
|
|
|
|
1999-08-09 06:09:24 +00:00
|
|
|
|
fclose (f);
|
1999-01-04 23:53:12 +00:00
|
|
|
|
return NULL;
|
1999-01-05 04:31:03 +00:00
|
|
|
|
}
|
1999-01-04 23:53:12 +00:00
|
|
|
|
|
2001-02-20 02:59:30 +00:00
|
|
|
|
image_module = _gdk_pixbuf_get_module (buffer, size, filename, error);
|
2000-10-18 18:42:54 +00:00
|
|
|
|
if (image_module == NULL) {
|
|
|
|
|
fclose (f);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
if (image_module->module == NULL)
|
2001-02-20 02:59:30 +00:00
|
|
|
|
if (!_gdk_pixbuf_load_module (image_module, error)) {
|
2000-10-18 18:42:54 +00:00
|
|
|
|
fclose (f);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
1999-10-26 20:43:39 +00:00
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
if (image_module->load == NULL) {
|
2000-10-18 18:42:54 +00:00
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
|
|
|
|
|
_("Don't know how to load the image in file '%s'"),
|
|
|
|
|
filename);
|
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
fclose (f);
|
|
|
|
|
return NULL;
|
1999-01-04 23:53:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
fseek (f, 0, SEEK_SET);
|
2000-10-18 18:42:54 +00:00
|
|
|
|
pixbuf = (* image_module->load) (f, error);
|
1999-01-05 04:31:03 +00:00
|
|
|
|
fclose (f);
|
2000-01-02 03:59:22 +00:00
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
if (pixbuf == NULL && error != NULL && *error == NULL) {
|
|
|
|
|
/* I don't trust these crufty longjmp()'ing image libs
|
|
|
|
|
* to maintain proper error invariants, and I don't
|
|
|
|
|
* want user code to segfault as a result. We need to maintain
|
|
|
|
|
* the invariant that error gets set if NULL is returned.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.", image_module->module_name);
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Failed to load image '%s': reason not known, probably a corrupt image file"),
|
|
|
|
|
filename);
|
|
|
|
|
|
|
|
|
|
} else if (error != NULL && *error != NULL) {
|
|
|
|
|
|
|
|
|
|
/* Add the filename to the error message */
|
|
|
|
|
GError *e = *error;
|
|
|
|
|
gchar *old;
|
|
|
|
|
|
|
|
|
|
old = e->message;
|
|
|
|
|
|
|
|
|
|
e->message = g_strdup_printf (_("Failed to load image '%s': %s"),
|
|
|
|
|
filename, old);
|
|
|
|
|
|
|
|
|
|
g_free (old);
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
return pixbuf;
|
1999-01-04 23:53:12 +00:00
|
|
|
|
}
|
1999-10-22 21:05:16 +00:00
|
|
|
|
|
1999-11-10 06:40:12 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_new_from_xpm_data:
|
1999-11-10 22:48:46 +00:00
|
|
|
|
* @data: Pointer to inline XPM data.
|
1999-12-17 21:42:47 +00:00
|
|
|
|
*
|
1999-11-10 06:40:12 +00:00
|
|
|
|
* Creates a new pixbuf by parsing XPM data in memory. This data is commonly
|
|
|
|
|
* the result of including an XPM file into a program's C source.
|
1999-12-17 21:42:47 +00:00
|
|
|
|
*
|
1999-11-10 06:40:12 +00:00
|
|
|
|
* Return value: A newly-created pixbuf with a reference count of 1.
|
|
|
|
|
**/
|
1999-10-22 21:05:16 +00:00
|
|
|
|
GdkPixbuf *
|
2000-01-02 03:59:22 +00:00
|
|
|
|
gdk_pixbuf_new_from_xpm_data (const char **data)
|
1999-10-22 21:05:16 +00:00
|
|
|
|
{
|
2000-01-02 03:59:22 +00:00
|
|
|
|
GdkPixbuf *(* load_xpm_data) (const char **data);
|
|
|
|
|
GdkPixbuf *pixbuf;
|
2001-01-26 18:50:58 +00:00
|
|
|
|
GError *error = NULL;
|
1999-12-17 21:42:47 +00:00
|
|
|
|
|
2001-01-26 18:50:58 +00:00
|
|
|
|
if (file_formats[XPM_FILE_FORMAT_INDEX].module == NULL) {
|
2001-02-20 02:59:30 +00:00
|
|
|
|
if (!_gdk_pixbuf_load_module (&file_formats[XPM_FILE_FORMAT_INDEX], &error)) {
|
2001-01-26 18:50:58 +00:00
|
|
|
|
g_warning ("Error loading XPM image loader: %s", error->message);
|
|
|
|
|
g_error_free (error);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
if (file_formats[XPM_FILE_FORMAT_INDEX].module == NULL) {
|
|
|
|
|
g_warning ("Can't find gdk-pixbuf module for parsing inline XPM data");
|
1999-12-17 21:42:47 +00:00
|
|
|
|
return NULL;
|
2000-01-02 03:59:22 +00:00
|
|
|
|
} else if (file_formats[XPM_FILE_FORMAT_INDEX].load_xpm_data == NULL) {
|
|
|
|
|
g_warning ("gdk-pixbuf XPM module lacks XPM data capability");
|
1999-12-17 21:42:47 +00:00
|
|
|
|
return NULL;
|
2000-01-02 03:59:22 +00:00
|
|
|
|
} else
|
|
|
|
|
load_xpm_data = file_formats[XPM_FILE_FORMAT_INDEX].load_xpm_data;
|
1999-12-17 21:42:47 +00:00
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
|
pixbuf = (* load_xpm_data) (data);
|
|
|
|
|
return pixbuf;
|
1999-12-17 21:42:47 +00:00
|
|
|
|
}
|
2000-10-06 18:19:18 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
collect_save_options (va_list opts,
|
|
|
|
|
gchar ***keys,
|
|
|
|
|
gchar ***vals)
|
|
|
|
|
{
|
|
|
|
|
gchar *key;
|
|
|
|
|
gchar *val;
|
|
|
|
|
gchar *next;
|
|
|
|
|
gint count;
|
|
|
|
|
|
|
|
|
|
count = 0;
|
|
|
|
|
*keys = NULL;
|
|
|
|
|
*vals = NULL;
|
|
|
|
|
|
|
|
|
|
next = va_arg (opts, gchar*);
|
|
|
|
|
while (next)
|
|
|
|
|
{
|
|
|
|
|
key = next;
|
|
|
|
|
val = va_arg (opts, gchar*);
|
|
|
|
|
|
|
|
|
|
++count;
|
|
|
|
|
|
|
|
|
|
/* woo, slow */
|
|
|
|
|
*keys = g_realloc (*keys, sizeof(gchar*) * (count + 1));
|
|
|
|
|
*vals = g_realloc (*vals, sizeof(gchar*) * (count + 1));
|
|
|
|
|
|
|
|
|
|
(*keys)[count-1] = g_strdup (key);
|
|
|
|
|
(*vals)[count-1] = g_strdup (val);
|
|
|
|
|
|
|
|
|
|
(*keys)[count] = NULL;
|
|
|
|
|
(*vals)[count] = NULL;
|
|
|
|
|
|
|
|
|
|
next = va_arg (opts, gchar*);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_pixbuf_real_save (GdkPixbuf *pixbuf,
|
|
|
|
|
FILE *filehandle,
|
2000-10-06 18:26:23 +00:00
|
|
|
|
const char *type,
|
2000-10-06 18:19:18 +00:00
|
|
|
|
gchar **keys,
|
|
|
|
|
gchar **values,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
GdkPixbufModule *image_module = NULL;
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
2001-02-20 02:59:30 +00:00
|
|
|
|
image_module = _gdk_pixbuf_get_named_module (type, error);
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
|
|
|
|
if (image_module == NULL)
|
|
|
|
|
return FALSE;
|
2000-10-06 18:19:18 +00:00
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
|
if (image_module->module == NULL)
|
2001-02-20 02:59:30 +00:00
|
|
|
|
if (!_gdk_pixbuf_load_module (image_module, error))
|
2000-10-18 18:42:54 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (image_module->save == NULL) {
|
2000-10-06 18:26:23 +00:00
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
|
|
|
|
|
_("This build of gdk-pixbuf does not support saving the image format: %s"),
|
|
|
|
|
type);
|
2000-10-06 18:19:18 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2000-10-18 18:42:54 +00:00
|
|
|
|
|
2000-10-06 18:19:18 +00:00
|
|
|
|
return (* image_module->save) (filehandle, pixbuf,
|
|
|
|
|
keys, values,
|
|
|
|
|
error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_save:
|
|
|
|
|
* @pixbuf: pointer to GdkPixbuf.
|
|
|
|
|
* @filename: Name of file to save.
|
2000-10-06 18:26:23 +00:00
|
|
|
|
* @type: name of file format.
|
2000-10-06 18:19:18 +00:00
|
|
|
|
* @error: return location for error, or NULL
|
|
|
|
|
* @Varargs: list of key-value save options
|
|
|
|
|
*
|
2000-10-06 18:26:23 +00:00
|
|
|
|
* Saves pixbuf to a file in @type, which is currently "jpeg" or
|
2000-10-06 18:19:18 +00:00
|
|
|
|
* "png". If @error is set, FALSE will be returned. Possible errors include those
|
2000-10-18 18:42:54 +00:00
|
|
|
|
* in the #GDK_PIXBUF_ERROR domain and those in the #G_FILE_ERROR domain.
|
2000-10-06 18:19:18 +00:00
|
|
|
|
*
|
|
|
|
|
* The variable argument list should be NULL-terminated; if not empty,
|
|
|
|
|
* it should contain pairs of strings that modify the save
|
|
|
|
|
* parameters. For example:
|
|
|
|
|
*
|
|
|
|
|
* <programlisting>
|
|
|
|
|
* gdk_pixbuf_save (pixbuf, handle, "jpeg", &error,
|
|
|
|
|
* "quality", "100", NULL);
|
|
|
|
|
* </programlisting>
|
|
|
|
|
*
|
|
|
|
|
* The only save parameter that currently exists is the "quality" field
|
|
|
|
|
* for JPEG images; its value should be in the range [0,100].
|
|
|
|
|
*
|
|
|
|
|
* Return value: whether an error was set
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_pixbuf_save (GdkPixbuf *pixbuf,
|
|
|
|
|
const char *filename,
|
2000-10-06 18:26:23 +00:00
|
|
|
|
const char *type,
|
2000-10-06 18:19:18 +00:00
|
|
|
|
GError **error,
|
|
|
|
|
...)
|
|
|
|
|
{
|
|
|
|
|
gchar **keys = NULL;
|
|
|
|
|
gchar **values = NULL;
|
|
|
|
|
va_list args;
|
|
|
|
|
gboolean result;
|
|
|
|
|
|
|
|
|
|
va_start (args, error);
|
|
|
|
|
|
|
|
|
|
collect_save_options (args, &keys, &values);
|
|
|
|
|
|
|
|
|
|
va_end (args);
|
|
|
|
|
|
2000-10-06 18:26:23 +00:00
|
|
|
|
result = gdk_pixbuf_savev (pixbuf, filename, type,
|
2000-10-06 18:19:18 +00:00
|
|
|
|
keys, values,
|
|
|
|
|
error);
|
|
|
|
|
|
|
|
|
|
g_strfreev (keys);
|
|
|
|
|
g_strfreev (values);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_savev:
|
|
|
|
|
* @pixbuf: pointer to GdkPixbuf.
|
|
|
|
|
* @filename: Name of file to save.
|
2000-10-06 18:26:23 +00:00
|
|
|
|
* @type: name of file format.
|
2000-10-06 18:19:18 +00:00
|
|
|
|
* @option_keys: name of options to set, NULL-terminated
|
|
|
|
|
* @option_values: values for named options
|
|
|
|
|
* @error: return location for error, or NULL
|
|
|
|
|
*
|
2000-10-06 18:26:23 +00:00
|
|
|
|
* Saves pixbuf to a file in @type, which is currently "jpeg" or "png".
|
2000-10-06 18:19:18 +00:00
|
|
|
|
* If @error is set, FALSE will be returned. See gdk_pixbuf_save () for more
|
2000-10-18 18:42:54 +00:00
|
|
|
|
* details.
|
2000-10-06 18:19:18 +00:00
|
|
|
|
*
|
|
|
|
|
* Return value: whether an error was set
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_pixbuf_savev (GdkPixbuf *pixbuf,
|
|
|
|
|
const char *filename,
|
2000-10-06 18:26:23 +00:00
|
|
|
|
const char *type,
|
2000-10-06 18:19:18 +00:00
|
|
|
|
char **option_keys,
|
|
|
|
|
char **option_values,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
FILE *f = NULL;
|
|
|
|
|
gboolean result;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (filename != NULL, FALSE);
|
2000-10-06 18:26:23 +00:00
|
|
|
|
g_return_val_if_fail (type != NULL, FALSE);
|
2000-10-06 18:19:18 +00:00
|
|
|
|
|
2000-11-12 15:58:18 +00:00
|
|
|
|
f = fopen (filename, "wb");
|
2000-10-06 18:19:18 +00:00
|
|
|
|
|
|
|
|
|
if (f == NULL) {
|
|
|
|
|
g_set_error (error,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
G_FILE_ERROR,
|
|
|
|
|
g_file_error_from_errno (errno),
|
2000-10-06 18:19:18 +00:00
|
|
|
|
_("Failed to open '%s' for writing: %s"),
|
|
|
|
|
filename, g_strerror (errno));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-10-06 18:26:23 +00:00
|
|
|
|
result = gdk_pixbuf_real_save (pixbuf, f, type,
|
2000-10-06 18:19:18 +00:00
|
|
|
|
option_keys, option_values,
|
|
|
|
|
error);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!result) {
|
|
|
|
|
g_return_val_if_fail (error == NULL || *error != NULL, FALSE);
|
|
|
|
|
fclose (f);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fclose (f) < 0) {
|
|
|
|
|
g_set_error (error,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
G_FILE_ERROR,
|
|
|
|
|
g_file_error_from_errno (errno),
|
2000-10-06 18:19:18 +00:00
|
|
|
|
_("Failed to close '%s' while writing image, all data may not have been saved: %s"),
|
|
|
|
|
filename, g_strerror (errno));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|