2001-06-01 23:05:46 +00:00
|
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
2000-10-05 21:40:37 +00:00
|
|
|
|
/* GdkPixbuf library - TIFF image loader
|
1999-10-20 21:20:49 +00:00
|
|
|
|
*
|
1999-07-01 06:59:07 +00:00
|
|
|
|
* Copyright (C) 1999 Mark Crichton
|
1999-10-20 21:20:49 +00:00
|
|
|
|
* Copyright (C) 1999 The Free Software Foundation
|
|
|
|
|
*
|
|
|
|
|
* Authors: Mark Crichton <crichton@gimp.org>
|
|
|
|
|
* Federico Mena-Quintero <federico@gimp.org>
|
2000-01-07 18:29:13 +00:00
|
|
|
|
* Jonathan Blandford <jrb@redhat.com>
|
2001-06-01 23:05:46 +00:00
|
|
|
|
* S<EFBFBD>ren Sandmann <sandmann@daimi.au.dk>
|
1999-07-01 06:59:07 +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-07-01 06:59:07 +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-07-01 06:59:07 +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-07-01 06:59:07 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* Following code (almost) blatantly ripped from Imlib */
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
1999-10-28 14:46:46 +00:00
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
2000-08-01 21:43:56 +00:00
|
|
|
|
#ifdef HAVE_UNISTD_H
|
1999-10-28 16:40:15 +00:00
|
|
|
|
#include <unistd.h>
|
2000-08-01 21:43:56 +00:00
|
|
|
|
#endif
|
1999-12-02 20:44:43 +00:00
|
|
|
|
#include <tiffio.h>
|
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
|
|
|
|
#include <errno.h>
|
2000-04-11 07:03:25 +00:00
|
|
|
|
#include "gdk-pixbuf-private.h"
|
1999-12-02 20:44:43 +00:00
|
|
|
|
#include "gdk-pixbuf-io.h"
|
1999-07-01 06:59:07 +00:00
|
|
|
|
|
2000-07-22 23:50:19 +00:00
|
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
|
#include <fcntl.h>
|
2004-02-28 13:17:53 +00:00
|
|
|
|
#include <io.h>
|
|
|
|
|
#define lseek(a,b,c) _lseek(a,b,c)
|
2000-07-22 23:50:19 +00:00
|
|
|
|
#define O_RDWR _O_RDWR
|
|
|
|
|
#endif
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
typedef struct _TiffContext TiffContext;
|
|
|
|
|
struct _TiffContext
|
1999-10-20 21:20:49 +00:00
|
|
|
|
{
|
2004-01-07 00:26:58 +00:00
|
|
|
|
GdkPixbufModuleSizeFunc size_func;
|
2002-10-03 22:39:51 +00:00
|
|
|
|
GdkPixbufModulePreparedFunc prepare_func;
|
|
|
|
|
GdkPixbufModuleUpdatedFunc update_func;
|
1999-10-28 16:40:15 +00:00
|
|
|
|
gpointer user_data;
|
2001-06-01 23:05:46 +00:00
|
|
|
|
|
|
|
|
|
guchar *buffer;
|
|
|
|
|
guint allocated;
|
|
|
|
|
guint used;
|
|
|
|
|
guint pos;
|
1999-10-28 16:40:15 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
static char *global_error = NULL;
|
|
|
|
|
static TIFFErrorHandler orig_error_handler = NULL;
|
|
|
|
|
static TIFFErrorHandler orig_warning_handler = NULL;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tiff_warning_handler (const char *mod, const char *fmt, va_list ap)
|
|
|
|
|
{
|
|
|
|
|
/* Don't print anything; we should not be dumping junk to
|
|
|
|
|
* stderr, since that may be bad for some apps.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* libTIFF seems to occasionally warn about things that
|
|
|
|
|
* are really errors, so maybe we should just call tiff_error_handler
|
|
|
|
|
* here.
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tiff_error_handler (const char *mod, const char *fmt, va_list ap)
|
|
|
|
|
{
|
|
|
|
|
if (global_error) {
|
|
|
|
|
/* Blah, loader called us twice */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
global_error = g_strdup_vprintf (fmt, ap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tiff_push_handlers (void)
|
|
|
|
|
{
|
|
|
|
|
if (global_error)
|
|
|
|
|
g_warning ("TIFF loader left crufty global_error around, FIXME");
|
|
|
|
|
|
|
|
|
|
orig_error_handler = TIFFSetErrorHandler (tiff_error_handler);
|
|
|
|
|
orig_warning_handler = TIFFSetWarningHandler (tiff_warning_handler);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tiff_pop_handlers (void)
|
|
|
|
|
{
|
|
|
|
|
if (global_error)
|
|
|
|
|
g_warning ("TIFF loader left crufty global_error around, FIXME");
|
|
|
|
|
|
|
|
|
|
TIFFSetErrorHandler (orig_error_handler);
|
|
|
|
|
TIFFSetWarningHandler (orig_warning_handler);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tiff_set_error (GError **error,
|
|
|
|
|
int error_code,
|
|
|
|
|
const char *msg)
|
|
|
|
|
{
|
|
|
|
|
/* Take the error message from libtiff and merge it with
|
|
|
|
|
* some context we provide.
|
|
|
|
|
*/
|
|
|
|
|
if (global_error) {
|
2002-07-06 08:55:51 +00:00
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
error_code,
|
|
|
|
|
"%s%s%s", msg, ": ", global_error);
|
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
g_free (global_error);
|
|
|
|
|
global_error = NULL;
|
|
|
|
|
}
|
2002-07-06 08:55:51 +00:00
|
|
|
|
else {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
error_code, msg);
|
|
|
|
|
}
|
2001-06-01 23:05:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-04-05 21:02:07 +00:00
|
|
|
|
static void free_buffer (guchar *pixels, gpointer data)
|
|
|
|
|
{
|
|
|
|
|
g_free (pixels);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
static GdkPixbuf *
|
2001-06-01 23:05:46 +00:00
|
|
|
|
tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
|
1999-07-01 06:59:07 +00:00
|
|
|
|
{
|
1999-10-26 20:43:39 +00:00
|
|
|
|
guchar *pixels = NULL;
|
2002-04-05 21:02:07 +00:00
|
|
|
|
gint width, height, rowstride, bytes;
|
1999-10-28 16:40:15 +00:00
|
|
|
|
GdkPixbuf *pixbuf;
|
2007-05-18 14:19:47 +00:00
|
|
|
|
uint16 orientation = 0;
|
|
|
|
|
uint16 transform = 0;
|
1999-07-01 06:59:07 +00:00
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
/* We're called with the lock held. */
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (global_error == NULL, NULL);
|
|
|
|
|
|
2002-04-05 21:02:07 +00:00
|
|
|
|
if (!TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width) || global_error) {
|
2001-06-01 23:05:46 +00:00
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Could not get image width (bad TIFF file)"));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-05 21:02:07 +00:00
|
|
|
|
if (!TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height) || global_error) {
|
2001-06-01 23:05:46 +00:00
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Could not get image height (bad TIFF file)"));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-05 21:02:07 +00:00
|
|
|
|
if (width <= 0 || height <= 0) {
|
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_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
2001-06-01 23:05:46 +00:00
|
|
|
|
_("Width or height of TIFF image is zero"));
|
|
|
|
|
return NULL;
|
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
|
|
|
|
}
|
2001-06-01 23:05:46 +00:00
|
|
|
|
|
2002-04-05 21:02:07 +00:00
|
|
|
|
rowstride = width * 4;
|
|
|
|
|
if (rowstride / 4 != width) { /* overflow */
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Dimensions of TIFF image too large"));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bytes = height * rowstride;
|
|
|
|
|
if (bytes / rowstride != height) { /* overflow */
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Dimensions of TIFF image too large"));
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-07 00:26:58 +00:00
|
|
|
|
if (context && context->size_func) {
|
|
|
|
|
gint w = width;
|
|
|
|
|
gint h = height;
|
|
|
|
|
(* context->size_func) (&w, &h, context->user_data);
|
|
|
|
|
|
|
|
|
|
if (w == 0 || h == 0)
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-05 21:02:07 +00:00
|
|
|
|
pixels = g_try_malloc (bytes);
|
|
|
|
|
|
|
|
|
|
if (!pixels) {
|
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_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
|
|
|
|
_("Insufficient memory to open TIFF file"));
|
2001-06-01 23:05:46 +00:00
|
|
|
|
return NULL;
|
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
|
|
|
|
}
|
2001-06-01 23:05:46 +00:00
|
|
|
|
|
2002-04-05 21:02:07 +00:00
|
|
|
|
pixbuf = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8,
|
|
|
|
|
width, height, rowstride,
|
|
|
|
|
free_buffer, NULL);
|
|
|
|
|
if (!pixbuf) {
|
|
|
|
|
g_free (pixels);
|
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_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
|
|
|
|
_("Insufficient memory to open TIFF file"));
|
2001-06-01 23:05:46 +00:00
|
|
|
|
return NULL;
|
2002-04-05 21:02:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-05-18 14:19:47 +00:00
|
|
|
|
/* Set the "orientation" key associated with this image. libtiff
|
|
|
|
|
orientation handling is odd, so further processing is required
|
|
|
|
|
by higher-level functions based on this tag. If the embedded
|
|
|
|
|
orientation tag is 1-4, libtiff flips/mirrors the image as
|
|
|
|
|
required, and no client processing is required - so we report
|
|
|
|
|
no orientation. Orientations 5-8 require rotations which would
|
|
|
|
|
swap the width and height of the image. libtiff does not do this.
|
|
|
|
|
Instead it interprets orientations 5-8 the same as 1-4.
|
|
|
|
|
See http://bugzilla.remotesensing.org/show_bug.cgi?id=1548.
|
|
|
|
|
To correct for this, the client must apply the transform normally
|
|
|
|
|
used for orientation 5 to both orientations 5 and 7, and apply
|
|
|
|
|
the transform normally used for orientation 7 for both
|
|
|
|
|
orientations 6 and 8. Then everythings works out OK! */
|
|
|
|
|
|
|
|
|
|
TIFFGetField (tiff, TIFFTAG_ORIENTATION, &orientation);
|
|
|
|
|
|
|
|
|
|
switch (orientation) {
|
|
|
|
|
case 5:
|
|
|
|
|
case 7:
|
|
|
|
|
transform = 5;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
case 8:
|
|
|
|
|
transform = 7;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
transform = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (transform > 0 ) {
|
|
|
|
|
gchar str[5];
|
|
|
|
|
snprintf (str, sizeof (str), "%d", transform);
|
|
|
|
|
gdk_pixbuf_set_option (pixbuf, "orientation", str);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-10 19:02:38 +00:00
|
|
|
|
if (context && context->prepare_func)
|
2002-04-05 21:02:07 +00:00
|
|
|
|
(* context->prepare_func) (pixbuf, NULL, context->user_data);
|
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
|
|
|
|
|
2007-05-18 14:19:47 +00:00
|
|
|
|
if (!TIFFReadRGBAImageOriented (tiff, width, height, (uint32 *)pixels, ORIENTATION_TOPLEFT, 1) || global_error) {
|
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Failed to load RGB data from TIFF file"));
|
|
|
|
|
g_object_unref (pixbuf);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
1999-07-01 06:59:07 +00:00
|
|
|
|
|
2002-12-04 21:07:30 +00:00
|
|
|
|
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
2007-05-18 14:19:47 +00:00
|
|
|
|
/* Turns out that the packing used by TIFFRGBAImage depends on
|
|
|
|
|
* the host byte order...
|
|
|
|
|
*/
|
|
|
|
|
while (pixels < pixbuf->pixels + bytes) {
|
|
|
|
|
uint32 pixel = *(uint32 *)pixels;
|
|
|
|
|
int r = TIFFGetR(pixel);
|
|
|
|
|
int g = TIFFGetG(pixel);
|
|
|
|
|
int b = TIFFGetB(pixel);
|
|
|
|
|
int a = TIFFGetA(pixel);
|
|
|
|
|
*pixels++ = r;
|
|
|
|
|
*pixels++ = g;
|
|
|
|
|
*pixels++ = b;
|
|
|
|
|
*pixels++ = a;
|
|
|
|
|
}
|
2004-06-16 17:52:49 +00:00
|
|
|
|
#endif
|
2002-05-18 14:56:20 +00:00
|
|
|
|
|
2006-02-10 19:02:38 +00:00
|
|
|
|
if (context && context->update_func)
|
2002-04-05 21:02:07 +00:00
|
|
|
|
(* context->update_func) (pixbuf, 0, 0, width, height, context->user_data);
|
2007-05-18 14:19:47 +00:00
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
return pixbuf;
|
1999-07-01 06:59:07 +00:00
|
|
|
|
}
|
1999-10-28 14:46:46 +00:00
|
|
|
|
|
1999-10-28 16:40:15 +00:00
|
|
|
|
|
1999-10-28 14:46:46 +00:00
|
|
|
|
|
1999-10-28 16:40:15 +00:00
|
|
|
|
/* Static loader */
|
1999-10-28 14:46:46 +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
|
|
|
|
static GdkPixbuf *
|
|
|
|
|
gdk_pixbuf__tiff_image_load (FILE *f, GError **error)
|
1999-10-28 14:46:46 +00:00
|
|
|
|
{
|
2001-06-01 23:05:46 +00:00
|
|
|
|
TIFF *tiff;
|
|
|
|
|
int fd;
|
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (f != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
tiff_push_handlers ();
|
|
|
|
|
|
|
|
|
|
fd = fileno (f);
|
2001-09-20 21:24:19 +00:00
|
|
|
|
|
|
|
|
|
/* On OSF, apparently fseek() works in some on-demand way, so
|
|
|
|
|
* the fseek gdk_pixbuf_new_from_file() doesn't work here
|
|
|
|
|
* since we are using the raw file descriptor. So, we call lseek() on the fd
|
|
|
|
|
* before using it. (#60840)
|
|
|
|
|
*/
|
|
|
|
|
lseek (fd, 0, SEEK_SET);
|
2001-06-01 23:05:46 +00:00
|
|
|
|
tiff = TIFFFdOpen (fd, "libpixbuf-tiff", "r");
|
|
|
|
|
|
2001-09-14 22:04:55 +00:00
|
|
|
|
if (!tiff || global_error) {
|
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
|
_("Failed to open TIFF image"));
|
2001-06-01 23:05:46 +00:00
|
|
|
|
tiff_pop_handlers ();
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pixbuf = tiff_image_parse (tiff, NULL, error);
|
|
|
|
|
|
|
|
|
|
TIFFClose (tiff);
|
|
|
|
|
if (global_error) {
|
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("TIFFClose operation failed"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tiff_pop_handlers ();
|
|
|
|
|
|
|
|
|
|
return pixbuf;
|
1999-10-28 16:40:15 +00:00
|
|
|
|
}
|
1999-10-28 14:46:46 +00:00
|
|
|
|
|
1999-10-28 16:40:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Progressive loader */
|
1999-11-04 18:18:07 +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
|
|
|
|
static gpointer
|
2002-10-03 22:39:51 +00:00
|
|
|
|
gdk_pixbuf__tiff_image_begin_load (GdkPixbufModuleSizeFunc size_func,
|
|
|
|
|
GdkPixbufModulePreparedFunc prepare_func,
|
|
|
|
|
GdkPixbufModuleUpdatedFunc update_func,
|
2000-10-18 18:42:54 +00:00
|
|
|
|
gpointer user_data,
|
|
|
|
|
GError **error)
|
1999-10-28 14:46:46 +00:00
|
|
|
|
{
|
2001-06-01 23:05:46 +00:00
|
|
|
|
TiffContext *context;
|
|
|
|
|
|
|
|
|
|
context = g_new0 (TiffContext, 1);
|
2004-01-07 00:26:58 +00:00
|
|
|
|
context->size_func = size_func;
|
1999-11-04 18:18:07 +00:00
|
|
|
|
context->prepare_func = prepare_func;
|
1999-11-04 19:22:45 +00:00
|
|
|
|
context->update_func = update_func;
|
1999-10-28 14:46:46 +00:00
|
|
|
|
context->user_data = user_data;
|
2001-06-01 23:05:46 +00:00
|
|
|
|
context->buffer = NULL;
|
|
|
|
|
context->allocated = 0;
|
|
|
|
|
context->used = 0;
|
|
|
|
|
context->pos = 0;
|
|
|
|
|
|
|
|
|
|
return context;
|
|
|
|
|
}
|
1999-10-28 14:46:46 +00:00
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
static tsize_t
|
2006-02-28 09:48:49 +00:00
|
|
|
|
tiff_load_read (thandle_t handle, tdata_t buf, tsize_t size)
|
2001-06-01 23:05:46 +00:00
|
|
|
|
{
|
|
|
|
|
TiffContext *context = (TiffContext *)handle;
|
|
|
|
|
|
|
|
|
|
if (context->pos + size > context->used)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
memcpy (buf, context->buffer + context->pos, size);
|
|
|
|
|
context->pos += size;
|
|
|
|
|
return size;
|
|
|
|
|
}
|
1999-10-28 16:40:15 +00:00
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
static tsize_t
|
2006-02-28 09:48:49 +00:00
|
|
|
|
tiff_load_write (thandle_t handle, tdata_t buf, tsize_t size)
|
2001-06-01 23:05:46 +00:00
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static toff_t
|
2006-02-28 09:48:49 +00:00
|
|
|
|
tiff_load_seek (thandle_t handle, toff_t offset, int whence)
|
2001-06-01 23:05:46 +00:00
|
|
|
|
{
|
|
|
|
|
TiffContext *context = (TiffContext *)handle;
|
|
|
|
|
|
|
|
|
|
switch (whence) {
|
|
|
|
|
case SEEK_SET:
|
2006-10-08 05:32:07 +00:00
|
|
|
|
if (offset > context->used)
|
2001-06-01 23:05:46 +00:00
|
|
|
|
return -1;
|
|
|
|
|
context->pos = offset;
|
|
|
|
|
break;
|
|
|
|
|
case SEEK_CUR:
|
|
|
|
|
if (offset + context->pos >= context->used)
|
|
|
|
|
return -1;
|
|
|
|
|
context->pos += offset;
|
|
|
|
|
break;
|
|
|
|
|
case SEEK_END:
|
|
|
|
|
if (offset + context->used > context->used)
|
|
|
|
|
return -1;
|
|
|
|
|
context->pos = context->used + offset;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return context->pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2006-02-28 09:48:49 +00:00
|
|
|
|
tiff_load_close (thandle_t context)
|
2001-06-01 23:05:46 +00:00
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static toff_t
|
2006-02-28 09:48:49 +00:00
|
|
|
|
tiff_load_size (thandle_t handle)
|
2001-06-01 23:05:46 +00:00
|
|
|
|
{
|
|
|
|
|
TiffContext *context = (TiffContext *)handle;
|
|
|
|
|
|
|
|
|
|
return context->used;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2006-02-28 09:48:49 +00:00
|
|
|
|
tiff_load_map_file (thandle_t handle, tdata_t *buf, toff_t *size)
|
2001-06-01 23:05:46 +00:00
|
|
|
|
{
|
|
|
|
|
TiffContext *context = (TiffContext *)handle;
|
|
|
|
|
|
|
|
|
|
*buf = context->buffer;
|
|
|
|
|
*size = context->used;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2006-02-28 09:48:49 +00:00
|
|
|
|
tiff_load_unmap_file (thandle_t handle, tdata_t data, toff_t offset)
|
2001-06-01 23:05:46 +00:00
|
|
|
|
{
|
1999-10-28 14:46:46 +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
|
|
|
|
static gboolean
|
|
|
|
|
gdk_pixbuf__tiff_image_stop_load (gpointer data,
|
|
|
|
|
GError **error)
|
1999-10-28 14:46:46 +00:00
|
|
|
|
{
|
2001-06-01 23:05:46 +00:00
|
|
|
|
TiffContext *context = data;
|
|
|
|
|
TIFF *tiff;
|
|
|
|
|
gboolean retval;
|
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
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
g_return_val_if_fail (data != NULL, FALSE);
|
1999-10-28 16:40:15 +00:00
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
tiff_push_handlers ();
|
|
|
|
|
|
|
|
|
|
tiff = TIFFClientOpen ("libtiff-pixbuf", "r", data,
|
2006-02-28 09:48:49 +00:00
|
|
|
|
tiff_load_read, tiff_load_write,
|
|
|
|
|
tiff_load_seek, tiff_load_close,
|
|
|
|
|
tiff_load_size,
|
|
|
|
|
tiff_load_map_file, tiff_load_unmap_file);
|
2001-09-14 22:04:55 +00:00
|
|
|
|
if (!tiff || global_error) {
|
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Failed to load TIFF image"));
|
2001-06-01 23:05:46 +00:00
|
|
|
|
retval = FALSE;
|
|
|
|
|
} else {
|
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
|
|
|
|
GdkPixbuf *pixbuf;
|
2001-06-01 23:05:46 +00:00
|
|
|
|
|
|
|
|
|
pixbuf = tiff_image_parse (tiff, context, error);
|
|
|
|
|
if (pixbuf)
|
Remove assorted G_OBJECT casts where unnecessary.
2001-12-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk-pixbuf-animation.c, gdk-pixbuf-loader.c, gdk-pixpuf.c,
io-gif-animation.c, io-gif.c, io-tiff.c, test-loaders.c: Remove
assorted G_OBJECT casts where unnecessary.
* gdk-pixbuf-loader.c: Call g_object_ref and g_object_unref
instead of gdk_pixbuf_animation_ref and gdk_pixbuf_animation_unref
resp.
* gdk-pixbuf-csource.c, io-bmp.c, io-gif-animation.c, io-ico.c,
io-jpeg.c, io-png.c, io-pnm.c, io-ras.c, io-tga.c, io-wbmp.c,
io-xbm.c, io-xpm.c, test-gdk-pixbuf.c: Dito for gdk_pixbuf_ref and
gdk_pixbuf_unref.
* Makefile.am, pixops/Makefile.am: Compile everything with
-DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
* gdk-pixdata.c: Use g_ascii_strup() instead of g_strup().
* io-xpm.c: Use g_ascii_strcasecmp() instead of g_strcasecmp().
* demos/testpixbuf-drawable.c, demos/testpixbuf-save.c,
demos/testpixbuf-scale.c, demos/testpixbuf.c: Call g_object_ref
and g_object_unref instead of gdk_pixbuf_ref and gdk_pixbuf_unref
resp.
2001-12-13 21:22:12 +00:00
|
|
|
|
g_object_unref (pixbuf);
|
2001-06-01 23:05:46 +00:00
|
|
|
|
retval = pixbuf != NULL;
|
2001-09-14 22:04:55 +00:00
|
|
|
|
if (global_error)
|
|
|
|
|
{
|
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Failed to load TIFF image"));
|
2002-07-06 08:55:51 +00:00
|
|
|
|
tiff_pop_handlers ();
|
|
|
|
|
|
2001-09-14 22:04:55 +00:00
|
|
|
|
retval = FALSE;
|
|
|
|
|
}
|
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
|
|
|
|
}
|
2001-09-14 22:04:55 +00:00
|
|
|
|
|
2002-07-06 08:55:51 +00:00
|
|
|
|
if (tiff)
|
|
|
|
|
TIFFClose (tiff);
|
|
|
|
|
|
2001-09-14 22:04:55 +00:00
|
|
|
|
g_assert (!global_error);
|
2001-06-01 23:05:46 +00:00
|
|
|
|
|
|
|
|
|
g_free (context->buffer);
|
|
|
|
|
g_free (context);
|
|
|
|
|
|
|
|
|
|
tiff_pop_handlers ();
|
1999-10-28 16:40:15 +00:00
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
return retval;
|
|
|
|
|
}
|
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
|
|
|
|
|
2001-06-01 23:05:46 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
make_available_at_least (TiffContext *context, guint needed)
|
|
|
|
|
{
|
|
|
|
|
guchar *new_buffer = NULL;
|
|
|
|
|
guint need_alloc;
|
|
|
|
|
|
|
|
|
|
need_alloc = context->used + needed;
|
|
|
|
|
if (need_alloc > context->allocated) {
|
|
|
|
|
guint new_size = 1;
|
|
|
|
|
while (new_size < need_alloc)
|
|
|
|
|
new_size *= 2;
|
|
|
|
|
|
|
|
|
|
new_buffer = g_try_realloc (context->buffer, new_size);
|
|
|
|
|
if (new_buffer) {
|
|
|
|
|
context->buffer = new_buffer;
|
|
|
|
|
context->allocated = new_size;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
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 TRUE;
|
1999-10-28 14:46:46 +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
|
|
|
|
static gboolean
|
|
|
|
|
gdk_pixbuf__tiff_image_load_increment (gpointer data, const guchar *buf,
|
|
|
|
|
guint size, GError **error)
|
1999-10-28 14:46:46 +00:00
|
|
|
|
{
|
2001-06-01 23:05:46 +00:00
|
|
|
|
TiffContext *context = (TiffContext *) data;
|
|
|
|
|
|
1999-10-28 16:40:15 +00:00
|
|
|
|
g_return_val_if_fail (data != NULL, FALSE);
|
2001-06-01 23:05:46 +00:00
|
|
|
|
|
|
|
|
|
if (!make_available_at_least (context, size)) {
|
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_set_error (error,
|
2001-06-01 23:05:46 +00:00
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
|
|
|
|
_("Insufficient memory to open TIFF file"));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
memcpy (context->buffer + context->used, buf, size);
|
|
|
|
|
context->used += size;
|
1999-10-28 14:46:46 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
1999-10-28 16:40:15 +00:00
|
|
|
|
|
2006-02-28 09:48:49 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
gchar *buffer;
|
|
|
|
|
guint allocated;
|
|
|
|
|
guint used;
|
|
|
|
|
guint pos;
|
|
|
|
|
} TiffSaveContext;
|
|
|
|
|
|
|
|
|
|
static tsize_t
|
|
|
|
|
tiff_save_read (thandle_t handle, tdata_t buf, tsize_t size)
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static tsize_t
|
|
|
|
|
tiff_save_write (thandle_t handle, tdata_t buf, tsize_t size)
|
|
|
|
|
{
|
|
|
|
|
TiffSaveContext *context = (TiffSaveContext *)handle;
|
|
|
|
|
|
|
|
|
|
/* Modify buffer length */
|
|
|
|
|
if (context->pos + size > context->used)
|
|
|
|
|
context->used = context->pos + size;
|
|
|
|
|
|
|
|
|
|
/* Realloc */
|
|
|
|
|
if (context->used > context->allocated) {
|
|
|
|
|
context->buffer = g_realloc (context->buffer, context->pos + size);
|
|
|
|
|
context->allocated = context->used;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now copy the data */
|
|
|
|
|
memcpy (context->buffer + context->pos, buf, size);
|
|
|
|
|
|
|
|
|
|
/* Update pos */
|
|
|
|
|
context->pos += size;
|
|
|
|
|
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static toff_t
|
|
|
|
|
tiff_save_seek (thandle_t handle, toff_t offset, int whence)
|
|
|
|
|
{
|
|
|
|
|
TiffSaveContext *context = (TiffSaveContext *)handle;
|
|
|
|
|
|
|
|
|
|
switch (whence) {
|
|
|
|
|
case SEEK_SET:
|
|
|
|
|
context->pos = offset;
|
|
|
|
|
break;
|
|
|
|
|
case SEEK_CUR:
|
|
|
|
|
context->pos += offset;
|
|
|
|
|
break;
|
|
|
|
|
case SEEK_END:
|
|
|
|
|
context->pos = context->used + offset;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
return context->pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
tiff_save_close (thandle_t context)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static toff_t
|
|
|
|
|
tiff_save_size (thandle_t handle)
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static TiffSaveContext *
|
|
|
|
|
create_save_context (void)
|
|
|
|
|
{
|
|
|
|
|
TiffSaveContext *context;
|
|
|
|
|
|
|
|
|
|
context = g_new (TiffSaveContext, 1);
|
|
|
|
|
context->buffer = NULL;
|
|
|
|
|
context->allocated = 0;
|
|
|
|
|
context->used = 0;
|
|
|
|
|
context->pos = 0;
|
|
|
|
|
|
|
|
|
|
return context;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
free_save_context (TiffSaveContext *context)
|
|
|
|
|
{
|
|
|
|
|
g_free (context->buffer);
|
|
|
|
|
g_free (context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_pixbuf__tiff_image_save_to_callback (GdkPixbufSaveFunc save_func,
|
|
|
|
|
gpointer user_data,
|
|
|
|
|
GdkPixbuf *pixbuf,
|
|
|
|
|
gchar **keys,
|
|
|
|
|
gchar **values,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
TIFF *tiff;
|
|
|
|
|
gint width, height, rowstride;
|
|
|
|
|
guchar *pixels;
|
|
|
|
|
gboolean has_alpha;
|
|
|
|
|
gushort alpha_samples[1] = { EXTRASAMPLE_UNASSALPHA };
|
|
|
|
|
int y;
|
|
|
|
|
TiffSaveContext *context;
|
|
|
|
|
gboolean retval;
|
|
|
|
|
|
|
|
|
|
tiff_push_handlers ();
|
|
|
|
|
|
|
|
|
|
context = create_save_context ();
|
|
|
|
|
tiff = TIFFClientOpen ("libtiff-pixbuf", "w", context,
|
|
|
|
|
tiff_save_read, tiff_save_write,
|
|
|
|
|
tiff_save_seek, tiff_save_close,
|
|
|
|
|
tiff_save_size,
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
|
|
if (!tiff || global_error) {
|
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Failed to save TIFF image"));
|
|
|
|
|
|
|
|
|
|
tiff_pop_handlers ();
|
|
|
|
|
|
|
|
|
|
free_save_context (context);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
|
|
|
|
pixels = gdk_pixbuf_get_pixels (pixbuf);
|
|
|
|
|
|
|
|
|
|
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
|
|
|
|
|
|
|
|
|
|
height = gdk_pixbuf_get_height (pixbuf);
|
|
|
|
|
width = gdk_pixbuf_get_width (pixbuf);
|
|
|
|
|
|
|
|
|
|
TIFFSetField (tiff, TIFFTAG_IMAGEWIDTH, width);
|
|
|
|
|
TIFFSetField (tiff, TIFFTAG_IMAGELENGTH, height);
|
|
|
|
|
TIFFSetField (tiff, TIFFTAG_BITSPERSAMPLE, 8);
|
|
|
|
|
TIFFSetField (tiff, TIFFTAG_SAMPLESPERPIXEL, has_alpha ? 4 : 3);
|
|
|
|
|
TIFFSetField (tiff, TIFFTAG_ROWSPERSTRIP, height);
|
|
|
|
|
|
|
|
|
|
if (has_alpha)
|
|
|
|
|
TIFFSetField (tiff, TIFFTAG_EXTRASAMPLES, 1, alpha_samples);
|
|
|
|
|
|
|
|
|
|
TIFFSetField (tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
|
|
|
|
|
TIFFSetField (tiff, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
|
|
|
|
|
TIFFSetField (tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
|
|
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++) {
|
|
|
|
|
if (TIFFWriteScanline (tiff, pixels + y * rowstride, y, 0) == -1 ||
|
|
|
|
|
global_error)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (global_error) {
|
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Failed to write TIFF data"));
|
|
|
|
|
|
|
|
|
|
TIFFClose (tiff);
|
|
|
|
|
|
|
|
|
|
free_save_context (context);
|
|
|
|
|
tiff_pop_handlers ();
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TIFFClose (tiff);
|
|
|
|
|
if (global_error) {
|
|
|
|
|
tiff_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("TIFFClose operation failed"));
|
|
|
|
|
|
|
|
|
|
free_save_context (context);
|
|
|
|
|
tiff_pop_handlers ();
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tiff_pop_handlers ();
|
|
|
|
|
|
|
|
|
|
/* Now call the callback */
|
|
|
|
|
retval = save_func (context->buffer, context->used, error, user_data);
|
|
|
|
|
|
|
|
|
|
free_save_context (context);
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
save_to_file_cb (const gchar *buf,
|
|
|
|
|
gsize count,
|
|
|
|
|
GError **error,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
gint bytes;
|
|
|
|
|
|
|
|
|
|
while (count > 0) {
|
|
|
|
|
bytes = fwrite (buf, sizeof (gchar), count, (FILE *) data);
|
|
|
|
|
if (bytes <= 0)
|
|
|
|
|
break;
|
|
|
|
|
count -= bytes;
|
|
|
|
|
buf += bytes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count) {
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
|
_("Couldn't write to TIFF file"));
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_pixbuf__tiff_image_save (FILE *f,
|
|
|
|
|
GdkPixbuf *pixbuf,
|
|
|
|
|
gchar **keys,
|
|
|
|
|
gchar **values,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
return gdk_pixbuf__tiff_image_save_to_callback (save_to_file_cb,
|
|
|
|
|
f, pixbuf, keys,
|
|
|
|
|
values, error);
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-11 12:41:14 +00:00
|
|
|
|
#ifndef INCLUDE_tiff
|
|
|
|
|
#define MODULE_ENTRY(type,function) function
|
|
|
|
|
#else
|
|
|
|
|
#define MODULE_ENTRY(type,function) _gdk_pixbuf__ ## type ## _ ## function
|
|
|
|
|
#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
|
|
|
|
void
|
2002-10-03 22:39:51 +00:00
|
|
|
|
MODULE_ENTRY (tiff, fill_vtable) (GdkPixbufModule *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
|
|
|
|
{
|
2001-06-01 23:05:46 +00:00
|
|
|
|
module->load = gdk_pixbuf__tiff_image_load;
|
|
|
|
|
module->begin_load = gdk_pixbuf__tiff_image_begin_load;
|
|
|
|
|
module->stop_load = gdk_pixbuf__tiff_image_stop_load;
|
|
|
|
|
module->load_increment = gdk_pixbuf__tiff_image_load_increment;
|
2006-02-28 09:48:49 +00:00
|
|
|
|
module->save = gdk_pixbuf__tiff_image_save;
|
|
|
|
|
module->save_to_callback = gdk_pixbuf__tiff_image_save_to_callback;
|
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
|
|
|
|
}
|
2002-10-03 22:39:51 +00:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
MODULE_ENTRY (tiff, fill_info) (GdkPixbufFormat *info)
|
|
|
|
|
{
|
|
|
|
|
static GdkPixbufModulePattern signature[] = {
|
|
|
|
|
{ "MM \x2a", " z ", 100 },
|
|
|
|
|
{ "II\x2a ", " z", 100 },
|
|
|
|
|
{ NULL, NULL, 0 }
|
|
|
|
|
};
|
|
|
|
|
static gchar * mime_types[] = {
|
|
|
|
|
"image/tiff",
|
|
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
static gchar * extensions[] = {
|
|
|
|
|
"tiff",
|
|
|
|
|
"tif",
|
|
|
|
|
NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
info->name = "tiff";
|
|
|
|
|
info->signature = signature;
|
|
|
|
|
info->description = N_("The TIFF image format");
|
|
|
|
|
info->mime_types = mime_types;
|
|
|
|
|
info->extensions = extensions;
|
2005-02-07 19:40:46 +00:00
|
|
|
|
/* not threadsafe, due to the error handler handling */
|
2006-02-28 09:48:49 +00:00
|
|
|
|
info->flags = GDK_PIXBUF_FORMAT_WRITABLE;
|
2004-07-08 03:56:36 +00:00
|
|
|
|
info->license = "LGPL";
|
2002-10-03 22:39:51 +00:00
|
|
|
|
}
|