2001-10-05 18:51:47 +00:00
|
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
1999-10-20 21:20:49 +00:00
|
|
|
|
/* GdkPixbuf library - Basic memory management
|
1999-01-04 23:53:12 +00:00
|
|
|
|
*
|
1999-10-18 19:29:45 +00:00
|
|
|
|
* Copyright (C) 1999 The Free Software Foundation
|
|
|
|
|
*
|
|
|
|
|
* Authors: Mark Crichton <crichton@gimp.org>
|
|
|
|
|
* Miguel de Icaza <miguel@gnu.org>
|
|
|
|
|
* Federico Mena-Quintero <federico@gimp.org>
|
|
|
|
|
*
|
|
|
|
|
* 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-18 19:29:45 +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-18 19:29:45 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1999-10-18 19:29:45 +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-07-19 02:13:34 +00:00
|
|
|
|
#include <math.h>
|
2000-04-11 07:03:25 +00:00
|
|
|
|
#include <stdlib.h>
|
2000-07-14 20:24:14 +00:00
|
|
|
|
#include <string.h>
|
1999-12-02 20:44:43 +00:00
|
|
|
|
#include "gdk-pixbuf.h"
|
2000-04-11 07:03:25 +00:00
|
|
|
|
#include "gdk-pixbuf-private.h"
|
1999-01-04 23:53:12 +00:00
|
|
|
|
|
2000-06-22 15:36:12 +00:00
|
|
|
|
static void gdk_pixbuf_class_init (GdkPixbufClass *klass);
|
|
|
|
|
static void gdk_pixbuf_finalize (GObject *object);
|
|
|
|
|
|
1999-10-18 19:29:45 +00:00
|
|
|
|
|
1999-01-04 23:53:12 +00:00
|
|
|
|
|
2000-06-22 15:36:12 +00:00
|
|
|
|
static gpointer parent_class;
|
|
|
|
|
|
|
|
|
|
GType
|
|
|
|
|
gdk_pixbuf_get_type (void)
|
|
|
|
|
{
|
|
|
|
|
static GType object_type = 0;
|
|
|
|
|
|
|
|
|
|
if (!object_type) {
|
|
|
|
|
static const GTypeInfo object_info = {
|
|
|
|
|
sizeof (GdkPixbufClass),
|
|
|
|
|
(GBaseInitFunc) NULL,
|
|
|
|
|
(GBaseFinalizeFunc) NULL,
|
|
|
|
|
(GClassInitFunc) gdk_pixbuf_class_init,
|
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
|
NULL, /* class_data */
|
|
|
|
|
sizeof (GdkPixbuf),
|
|
|
|
|
0, /* n_preallocs */
|
|
|
|
|
(GInstanceInitFunc) 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
|
|
|
|
|
2000-06-22 15:36:12 +00:00
|
|
|
|
object_type = g_type_register_static (G_TYPE_OBJECT,
|
|
|
|
|
"GdkPixbuf",
|
urg, removed implementation of gtk_marshal_VOID__INT_INT_INT_INT. if
Wed Oct 25 20:47:41 2000 Tim Janik <timj@gtk.org>
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): urg, removed
implementation of gtk_marshal_VOID__INT_INT_INT_INT. if people do that,
couldn't they at least give it a non-standard name?
* gtk/gtktextlayout.c: arg! yet another implementation of
gtk_marshal_VOID__INT_INT_INT_INT(), is this a conspiracy?
* gtk/gtktextbuffer.c: gotcha! captured a vagabonding
gtk_marshal_VOID__INT_POINTER_INT() implementation, braught it back
home. now i know this _is_ a conspiracy.
* gtk/gtkwidget.c (gtk_widget_class_init): marshaller fixups for
::state-changed.
* gtk/gtkaccelgroup.c (gtk_accel_group_create_remove):
(gtk_accel_group_create_add): marshaller signature fixups.
* gtk/gtklistitem.c (gtk_list_item_class_init): signal creation fixups,
pass in GTK_TYPE_SCROLL_TYPE instead of GTK_TYPE_ENUM.
* gtk/gtkobject.[hc]: removed GTK_CONNECTED flag, it's not valid
anymore.
Tue Oct 24 23:59:21 2000 Tim Janik <timj@gtk.org>
* docs/reference/Makefile.am: disabled SUBDIRS for the moment, since
due to the signal system changes, it wouldn't build currently. to
be fixed soon.
* docs/Changes-2.0.txt: GtkSignal/GSignal updates.
* gtk/gtkwidget.c: ::direction_changed takes an enum as argument,
so it needs gtk_marshal_VOID__ENUM() instead of
gtk_marshal_NONE__UINT().
* gdk/gdk*.c: adapted type registration functions.
* gtk/gtkbindings.c:
* gtk/gtkaccelgroup.c: operate on GSignalQuery, GtkSignalQuery is
gone.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType.
* gtk/gtkobject.c:
(gtk_object_destroy):
(gtk_object_shutdown): fixed recursion guards. basically we have to
catch the case where any of GObject.shutdown() or gtk_object_destroy()
is called during ::destroy, and avoid recursion there.
* gtk/gtktypeutils.c:
* gtk/maketypes.awk: awk-script hackup to provide gtk_type_init() with
boxed_copy/boxed_free. this needs a more general solution based on a
publically installed code-generator utility.
* gtk/gtktypeutils.[hc]: compat aliased GTK_TYPE_BOXED to G_TYPE_BOXED,
glib's gobject has support for that now.
define GtkSignalMarshaller in terms of GSignalCMarshaller.
Mon Oct 23 09:36:42 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]:
* gtk/gtkmarshal.[hc]:
* gtk/Makefile.am: generate marshallers with glib-genmarshal and don't
compile gtkmarshal.c on its own anymore, just include it in gtksignal.c.
removed #include <gtkmarshal.h>s all over the place, gtksignal.h takes
care of that.
* *.c: marshaller name fixups.
* gtk/gtkmarshal.list: added a comment briefing the format.
Sun Oct 22 23:14:39 2000 Tim Janik <timj@gtk.org>
* gtk/gtksignal.[hc]: nuked old implementation. we mostly have
compatibility macros here now. more specifically, most of
the API is preserved (yes, _most_, nonwithstanding the
following exceptions listed, the API is stil lHUGE ;)
things that got removed completely:
GtkSignalQuery, gtk_signal_query(), gtk_signal_n_emissions(),
gtk_signal_n_emissions_by_name(), gtk_signal_handlers_destroy(),
gtk_signal_set_funcs(), gtk_signal_handler_pending_by_id(),
gtk_signal_add_emission_hook(), gtk_signal_add_emission_hook_full(),
gtk_signal_remove_emission_hook().
non-functional functions variants:
gtk_signal_add_emission_hook(), gtk_signal_remove_emission_hook().
the GtkCallbackMarshal argument to gtk_signal_connect_full() is
not supported anymore.
(gtk_signal_compat_matched): new internal function to aid
implementation of the compatibility macros, it provides
functionality to block/unblock/disconnect handlers based
on func/data.
* gtk/gtkenums.h: define GtkSignalRunType in terms of GSignalType,
* *.c: adaptions to new type registration API signatures.
Fri Oct 20 15:26:33 2000 Tim Janik <timj@gtk.org>
* gtk/gtktypeutils.[hc]: removed G_TYPE_GTK_POINTER cludge.
2000-10-25 22:34:14 +00:00
|
|
|
|
&object_info, 0);
|
2000-06-22 15:36:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return object_type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_pixbuf_class_init (GdkPixbufClass *klass)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
|
|
|
|
|
|
|
|
|
object_class->finalize = gdk_pixbuf_finalize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_pixbuf_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GdkPixbuf *pixbuf = GDK_PIXBUF (object);
|
|
|
|
|
|
|
|
|
|
if (pixbuf->destroy_fn)
|
|
|
|
|
(* pixbuf->destroy_fn) (pixbuf->pixels, pixbuf->destroy_fn_data);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
|
}
|
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
|
|
|
|
|
1999-09-22 22:30:51 +00:00
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_ref:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
2000-06-22 15:36:12 +00:00
|
|
|
|
* Adds a reference to a pixbuf. Deprecated; use g_object_ref().
|
2000-01-21 22:54:44 +00:00
|
|
|
|
*
|
|
|
|
|
* Return value: The same as the @pixbuf argument.
|
1999-10-20 21:20:49 +00:00
|
|
|
|
**/
|
2000-01-21 22:54:44 +00:00
|
|
|
|
GdkPixbuf *
|
1999-10-18 19:29:45 +00:00
|
|
|
|
gdk_pixbuf_ref (GdkPixbuf *pixbuf)
|
1999-01-04 23:53:12 +00:00
|
|
|
|
{
|
2002-09-29 21:24:24 +00:00
|
|
|
|
return (GdkPixbuf *) g_object_ref (pixbuf);
|
1999-01-04 23:53:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_unref:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
2000-06-22 15:36:12 +00:00
|
|
|
|
* Removes a reference from a pixbuf. Deprecated; use
|
|
|
|
|
* g_object_unref().
|
2000-04-13 01:18:41 +00:00
|
|
|
|
*
|
1999-10-20 21:20:49 +00:00
|
|
|
|
**/
|
1999-01-04 23:53:12 +00:00
|
|
|
|
void
|
1999-10-18 19:29:45 +00:00
|
|
|
|
gdk_pixbuf_unref (GdkPixbuf *pixbuf)
|
1999-01-04 23:53:12 +00:00
|
|
|
|
{
|
2002-09-29 21:24:24 +00:00
|
|
|
|
g_object_unref (pixbuf);
|
1999-07-16 20:35:21 +00:00
|
|
|
|
}
|
1999-01-04 23:53:12 +00:00
|
|
|
|
|
1999-10-20 21:20:49 +00:00
|
|
|
|
|
1999-07-17 20:03:34 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* Used as the destroy notification function for gdk_pixbuf_new() */
|
1999-10-27 23:36:44 +00:00
|
|
|
|
static void
|
2000-04-11 07:03:25 +00:00
|
|
|
|
free_buffer (guchar *pixels, gpointer data)
|
1999-10-27 23:36:44 +00:00
|
|
|
|
{
|
2001-02-19 14:35:25 +00:00
|
|
|
|
g_free (pixels);
|
1999-10-27 23:36:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-27 17:28:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_new:
|
2000-04-11 07:03:25 +00:00
|
|
|
|
* @colorspace: Color space for image.
|
1999-10-27 23:36:44 +00:00
|
|
|
|
* @has_alpha: Whether the image should have transparency information.
|
|
|
|
|
* @bits_per_sample: Number of bits per color sample.
|
|
|
|
|
* @width: Width of image in pixels.
|
|
|
|
|
* @height: Height of image in pixels.
|
1999-11-04 08:14:32 +00:00
|
|
|
|
*
|
2002-03-12 20:38:49 +00:00
|
|
|
|
* Creates a new #GdkPixbuf structure and allocates a buffer for it. The
|
|
|
|
|
* buffer has an optimal rowstride. Note that the buffer is not cleared;
|
|
|
|
|
* you will have to fill it completely yourself.
|
1999-11-04 08:14:32 +00:00
|
|
|
|
*
|
2001-12-20 23:44:19 +00:00
|
|
|
|
* Return value: A newly-created #GdkPixbuf with a reference count of 1, or
|
|
|
|
|
* %NULL if not enough memory could be allocated for the image buffer.
|
1999-10-27 17:28:44 +00:00
|
|
|
|
**/
|
|
|
|
|
GdkPixbuf *
|
2002-03-12 20:38:49 +00:00
|
|
|
|
gdk_pixbuf_new (GdkColorspace colorspace,
|
|
|
|
|
gboolean has_alpha,
|
|
|
|
|
int bits_per_sample,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
1999-10-27 17:28:44 +00:00
|
|
|
|
{
|
1999-10-27 23:36:44 +00:00
|
|
|
|
guchar *buf;
|
|
|
|
|
int channels;
|
|
|
|
|
int rowstride;
|
2002-03-03 02:35:25 +00:00
|
|
|
|
gsize bytes;
|
1999-10-27 17:28:44 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
g_return_val_if_fail (colorspace == GDK_COLORSPACE_RGB, NULL);
|
1999-10-27 23:36:44 +00:00
|
|
|
|
g_return_val_if_fail (bits_per_sample == 8, NULL);
|
1999-10-27 17:28:44 +00:00
|
|
|
|
g_return_val_if_fail (width > 0, NULL);
|
1999-10-27 23:36:44 +00:00
|
|
|
|
g_return_val_if_fail (height > 0, NULL);
|
1999-10-27 17:28:44 +00:00
|
|
|
|
|
2002-03-03 02:35:25 +00:00
|
|
|
|
if (width <= 0 || height <= 0)
|
|
|
|
|
return NULL;
|
1999-10-27 17:28:44 +00:00
|
|
|
|
|
1999-10-27 23:36:44 +00:00
|
|
|
|
channels = has_alpha ? 4 : 3;
|
2002-03-03 02:35:25 +00:00
|
|
|
|
rowstride = width * channels;
|
|
|
|
|
if (rowstride / channels != width || rowstride + 3 < 0) /* overflow */
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
/* Always align rows to 32-bit boundaries */
|
|
|
|
|
rowstride = (rowstride + 3) & ~3;
|
1999-10-27 17:28:44 +00:00
|
|
|
|
|
2002-03-03 02:35:25 +00:00
|
|
|
|
bytes = height * rowstride;
|
|
|
|
|
if (bytes / rowstride != height) /* overflow */
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
buf = g_try_malloc (bytes);
|
1999-10-27 23:36:44 +00:00
|
|
|
|
if (!buf)
|
|
|
|
|
return NULL;
|
1999-10-27 17:28:44 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
return gdk_pixbuf_new_from_data (buf, colorspace, has_alpha, bits_per_sample,
|
|
|
|
|
width, height, rowstride,
|
1999-10-27 23:36:44 +00:00
|
|
|
|
free_buffer, NULL);
|
|
|
|
|
}
|
1999-10-28 19:00:02 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_copy:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Creates a new #GdkPixbuf with a copy of the information in the specified
|
|
|
|
|
* @pixbuf.
|
|
|
|
|
*
|
2001-12-20 23:44:19 +00:00
|
|
|
|
* Return value: A newly-created pixbuf with a reference count of 1, or %NULL if
|
2000-04-11 07:03:25 +00:00
|
|
|
|
* not enough memory could be allocated.
|
|
|
|
|
**/
|
|
|
|
|
GdkPixbuf *
|
|
|
|
|
gdk_pixbuf_copy (const GdkPixbuf *pixbuf)
|
|
|
|
|
{
|
|
|
|
|
guchar *buf;
|
|
|
|
|
int size;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
/* Calculate a semi-exact size. Here we copy with full rowstrides;
|
|
|
|
|
* maybe we should copy each row individually with the minimum
|
|
|
|
|
* rowstride?
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
size = ((pixbuf->height - 1) * pixbuf->rowstride +
|
|
|
|
|
pixbuf->width * ((pixbuf->n_channels * pixbuf->bits_per_sample + 7) / 8));
|
|
|
|
|
|
2001-02-19 14:35:25 +00:00
|
|
|
|
buf = g_try_malloc (size * sizeof (guchar));
|
2000-04-11 07:03:25 +00:00
|
|
|
|
if (!buf)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
memcpy (buf, pixbuf->pixels, size);
|
|
|
|
|
|
|
|
|
|
return gdk_pixbuf_new_from_data (buf,
|
|
|
|
|
pixbuf->colorspace, pixbuf->has_alpha,
|
|
|
|
|
pixbuf->bits_per_sample,
|
|
|
|
|
pixbuf->width, pixbuf->height,
|
|
|
|
|
pixbuf->rowstride,
|
|
|
|
|
free_buffer,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2000-11-01 07:07:46 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_new_subpixbuf:
|
|
|
|
|
* @src_pixbuf: a #GdkPixbuf
|
|
|
|
|
* @src_x: X coord in @src_pixbuf
|
|
|
|
|
* @src_y: Y coord in @src_pixbuf
|
|
|
|
|
* @width: width of region in @src_pixbuf
|
|
|
|
|
* @height: height of region in @src_pixbuf
|
|
|
|
|
*
|
|
|
|
|
* Creates a new pixbuf which represents a sub-region of
|
|
|
|
|
* @src_pixbuf. The new pixbuf shares its pixels with the
|
|
|
|
|
* original pixbuf, so writing to one affects both.
|
|
|
|
|
* The new pixbuf holds a reference to @src_pixbuf, so
|
|
|
|
|
* @src_pixbuf will not be finalized until the new pixbuf
|
|
|
|
|
* is finalized.
|
|
|
|
|
*
|
|
|
|
|
* Return value: a new pixbuf
|
|
|
|
|
**/
|
|
|
|
|
GdkPixbuf*
|
|
|
|
|
gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf,
|
|
|
|
|
int src_x,
|
|
|
|
|
int src_y,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
|
|
|
|
{
|
|
|
|
|
guchar *pixels;
|
|
|
|
|
GdkPixbuf *sub;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF (src_pixbuf), NULL);
|
|
|
|
|
g_return_val_if_fail (src_x >= 0 && src_x + width <= src_pixbuf->width, NULL);
|
|
|
|
|
g_return_val_if_fail (src_y >= 0 && src_y + height <= src_pixbuf->height, NULL);
|
|
|
|
|
|
|
|
|
|
pixels = (gdk_pixbuf_get_pixels (src_pixbuf)
|
|
|
|
|
+ src_y * src_pixbuf->rowstride
|
|
|
|
|
+ src_x * src_pixbuf->n_channels);
|
|
|
|
|
|
|
|
|
|
sub = gdk_pixbuf_new_from_data (pixels,
|
|
|
|
|
src_pixbuf->colorspace,
|
|
|
|
|
src_pixbuf->has_alpha,
|
|
|
|
|
src_pixbuf->bits_per_sample,
|
|
|
|
|
width, height,
|
|
|
|
|
src_pixbuf->rowstride,
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
|
|
|
|
|
/* Keep a reference to src_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_ref (src_pixbuf);
|
2000-11-01 07:07:46 +00:00
|
|
|
|
|
|
|
|
|
g_object_set_qdata_full (G_OBJECT (sub),
|
|
|
|
|
g_quark_from_static_string ("gdk-pixbuf-subpixbuf-src"),
|
|
|
|
|
src_pixbuf,
|
|
|
|
|
(GDestroyNotify) g_object_unref);
|
|
|
|
|
|
|
|
|
|
return sub;
|
|
|
|
|
}
|
|
|
|
|
|
1999-11-04 08:14:32 +00:00
|
|
|
|
|
1999-10-28 19:00:02 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
/* Accessors */
|
1999-11-04 08:14:32 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2000-04-11 07:03:25 +00:00
|
|
|
|
* gdk_pixbuf_get_colorspace:
|
1999-11-04 08:14:32 +00:00
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
2000-04-11 07:03:25 +00:00
|
|
|
|
* Queries the color space of a pixbuf.
|
1999-11-04 08:14:32 +00:00
|
|
|
|
*
|
2000-04-11 07:03:25 +00:00
|
|
|
|
* Return value: Color space.
|
1999-11-04 08:14:32 +00:00
|
|
|
|
**/
|
2000-04-11 07:03:25 +00:00
|
|
|
|
GdkColorspace
|
|
|
|
|
gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf)
|
1999-10-28 19:00:02 +00:00
|
|
|
|
{
|
2000-04-11 07:03:25 +00:00
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, GDK_COLORSPACE_RGB);
|
1999-10-28 19:00:02 +00:00
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
return pixbuf->colorspace;
|
1999-10-28 19:00:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-04 08:14:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_get_n_channels:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Queries the number of channels of a pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Return value: Number of channels.
|
|
|
|
|
**/
|
1999-10-28 19:00:02 +00:00
|
|
|
|
int
|
2000-04-11 07:03:25 +00:00
|
|
|
|
gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf)
|
1999-10-28 19:00:02 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, -1);
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
return pixbuf->n_channels;
|
1999-10-28 19:00:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-04 08:14:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_get_has_alpha:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Queries whether a pixbuf has an alpha channel (opacity information).
|
|
|
|
|
*
|
2001-12-20 23:44:19 +00:00
|
|
|
|
* Return value: %TRUE if it has an alpha channel, %FALSE otherwise.
|
1999-11-04 08:14:32 +00:00
|
|
|
|
**/
|
2000-03-29 19:54:29 +00:00
|
|
|
|
gboolean
|
2000-04-11 07:03:25 +00:00
|
|
|
|
gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf)
|
1999-10-28 19:00:02 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, -1);
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
return pixbuf->has_alpha ? TRUE : FALSE;
|
1999-10-28 19:00:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-04 08:14:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_get_bits_per_sample:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Queries the number of bits per color sample in a pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Return value: Number of bits per color sample.
|
|
|
|
|
**/
|
1999-10-28 19:00:02 +00:00
|
|
|
|
int
|
2000-04-11 07:03:25 +00:00
|
|
|
|
gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf)
|
1999-10-28 19:00:02 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, -1);
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
return pixbuf->bits_per_sample;
|
1999-10-28 19:00:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-04 08:14:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_get_pixels:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Queries a pointer to the pixel data of a pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Return value: A pointer to the pixbuf's pixel data.
|
|
|
|
|
**/
|
1999-10-28 19:00:02 +00:00
|
|
|
|
guchar *
|
2000-04-11 07:03:25 +00:00
|
|
|
|
gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf)
|
1999-10-28 19:00:02 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, NULL);
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
return pixbuf->pixels;
|
1999-10-28 19:00:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-04 08:14:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_get_width:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Queries the width of a pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Return value: Width in pixels.
|
|
|
|
|
**/
|
1999-10-28 19:00:02 +00:00
|
|
|
|
int
|
2000-04-11 07:03:25 +00:00
|
|
|
|
gdk_pixbuf_get_width (const GdkPixbuf *pixbuf)
|
1999-10-28 19:00:02 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, -1);
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
return pixbuf->width;
|
1999-10-28 19:00:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-04 08:14:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_get_height:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Queries the height of a pixbuf.
|
|
|
|
|
*
|
|
|
|
|
* Return value: Height in pixels.
|
|
|
|
|
**/
|
1999-10-28 19:00:02 +00:00
|
|
|
|
int
|
2000-04-11 07:03:25 +00:00
|
|
|
|
gdk_pixbuf_get_height (const GdkPixbuf *pixbuf)
|
1999-10-28 19:00:02 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, -1);
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
return pixbuf->height;
|
1999-10-28 19:00:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-04 08:14:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_get_rowstride:
|
|
|
|
|
* @pixbuf: A pixbuf.
|
|
|
|
|
*
|
2000-04-11 07:03:25 +00:00
|
|
|
|
* Queries the rowstride of a pixbuf, which is the number of bytes between rows.
|
1999-11-04 08:14:32 +00:00
|
|
|
|
*
|
|
|
|
|
* Return value: Number of bytes between rows.
|
|
|
|
|
**/
|
1999-10-28 19:00:02 +00:00
|
|
|
|
int
|
2000-04-11 07:03:25 +00:00
|
|
|
|
gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf)
|
1999-10-28 19:00:02 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (pixbuf != NULL, -1);
|
|
|
|
|
|
2000-04-11 07:03:25 +00:00
|
|
|
|
return pixbuf->rowstride;
|
1999-10-28 19:00:02 +00:00
|
|
|
|
}
|
2000-01-10 19:17:42 +00:00
|
|
|
|
|
2000-04-02 18:54:17 +00:00
|
|
|
|
|
2000-04-01 03:28:31 +00:00
|
|
|
|
|
2000-01-10 19:17:42 +00:00
|
|
|
|
/* General initialization hooks */
|
2000-04-11 07:03:25 +00:00
|
|
|
|
const guint gdk_pixbuf_major_version = GDK_PIXBUF_MAJOR;
|
|
|
|
|
const guint gdk_pixbuf_minor_version = GDK_PIXBUF_MINOR;
|
|
|
|
|
const guint gdk_pixbuf_micro_version = GDK_PIXBUF_MICRO;
|
2000-01-10 19:17:42 +00:00
|
|
|
|
|
|
|
|
|
const char *gdk_pixbuf_version = GDK_PIXBUF_VERSION;
|
|
|
|
|
|
2000-10-06 18:19:18 +00:00
|
|
|
|
/* Error quark */
|
|
|
|
|
GQuark
|
|
|
|
|
gdk_pixbuf_error_quark (void)
|
|
|
|
|
{
|
|
|
|
|
static GQuark q = 0;
|
|
|
|
|
if (q == 0)
|
|
|
|
|
q = g_quark_from_static_string ("gdk-pixbuf-error-quark");
|
|
|
|
|
|
|
|
|
|
return q;
|
|
|
|
|
}
|
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-04-18 18:09:18 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_fill:
|
|
|
|
|
* @pixbuf: a #GdkPixbuf
|
2002-03-12 20:38:49 +00:00
|
|
|
|
* @pixel: RGBA pixel to clear to
|
|
|
|
|
* (0xffffffff is opaque white, 0x00000000 transparent black)
|
2001-04-18 18:09:18 +00:00
|
|
|
|
*
|
|
|
|
|
* Clears a pixbuf to the given RGBA value, converting the RGBA value into
|
|
|
|
|
* the pixbuf's pixel format. The alpha will be ignored if the pixbuf
|
|
|
|
|
* doesn't have an alpha channel.
|
|
|
|
|
*
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gdk_pixbuf_fill (GdkPixbuf *pixbuf,
|
|
|
|
|
guint32 pixel)
|
|
|
|
|
{
|
|
|
|
|
guchar *pixels;
|
|
|
|
|
guint r, g, b, a;
|
2002-02-01 23:43:07 +00:00
|
|
|
|
guchar *p;
|
2002-03-12 20:38:49 +00:00
|
|
|
|
guint w, h;
|
2002-02-01 23:43:07 +00:00
|
|
|
|
|
2001-04-18 18:09:18 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
|
|
|
|
|
|
2001-08-07 17:49:09 +00:00
|
|
|
|
if (pixbuf->width == 0 || pixbuf->height == 0)
|
2002-03-12 20:38:49 +00:00
|
|
|
|
return;
|
2001-08-07 17:49:09 +00:00
|
|
|
|
|
2001-04-18 18:09:18 +00:00
|
|
|
|
pixels = pixbuf->pixels;
|
|
|
|
|
|
|
|
|
|
r = (pixel & 0xff000000) >> 24;
|
|
|
|
|
g = (pixel & 0x00ff0000) >> 16;
|
|
|
|
|
b = (pixel & 0x0000ff00) >> 8;
|
|
|
|
|
a = (pixel & 0x000000ff);
|
|
|
|
|
|
2002-03-12 20:38:49 +00:00
|
|
|
|
h = pixbuf->height;
|
2001-04-18 18:09:18 +00:00
|
|
|
|
|
2002-03-12 20:38:49 +00:00
|
|
|
|
while (h--) {
|
|
|
|
|
w = pixbuf->width;
|
2001-04-18 18:09:18 +00:00
|
|
|
|
p = pixels;
|
2002-03-12 20:38:49 +00:00
|
|
|
|
|
|
|
|
|
switch (pixbuf->n_channels) {
|
|
|
|
|
case 3:
|
|
|
|
|
while (w--) {
|
|
|
|
|
p[0] = r;
|
|
|
|
|
p[1] = g;
|
|
|
|
|
p[2] = b;
|
2001-08-07 17:49:09 +00:00
|
|
|
|
p += 3;
|
2002-03-12 20:38:49 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
while (w--) {
|
|
|
|
|
p[0] = r;
|
|
|
|
|
p[1] = g;
|
|
|
|
|
p[2] = b;
|
|
|
|
|
p[3] = a;
|
|
|
|
|
p += 4;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2001-08-07 17:49:09 +00:00
|
|
|
|
}
|
2002-03-12 20:38:49 +00:00
|
|
|
|
|
|
|
|
|
pixels += pixbuf->rowstride;
|
2001-04-18 18:09:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-05 18:51:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_pixbuf_get_option:
|
|
|
|
|
* @pixbuf: a #GdkPixbuf
|
|
|
|
|
* @key: a nul-terminated string.
|
|
|
|
|
*
|
|
|
|
|
* Looks up @key in the list of options that may have been attached to the
|
|
|
|
|
* @pixbuf when it was loaded.
|
|
|
|
|
*
|
|
|
|
|
* Return value: the value associated with @key. This is a nul-terminated
|
|
|
|
|
* string that should not be freed or %NULL if @key was not found.
|
|
|
|
|
**/
|
|
|
|
|
G_CONST_RETURN gchar *
|
|
|
|
|
gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
|
|
|
|
|
const gchar *key)
|
|
|
|
|
{
|
|
|
|
|
gchar **options;
|
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
|
|
|
|
|
g_return_val_if_fail (key != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
options = g_object_get_qdata (G_OBJECT (pixbuf),
|
|
|
|
|
g_quark_from_static_string ("gdk_pixbuf_options"));
|
|
|
|
|
if (options) {
|
|
|
|
|
for (i = 0; options[2*i]; i++) {
|
|
|
|
|
if (strcmp (options[2*i], key) == 0)
|
|
|
|
|
return options[2*i+1];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2002-09-19 21:00:52 +00:00
|
|
|
|
* gdk_pixbuf_set_option:
|
2001-10-05 18:51:47 +00:00
|
|
|
|
* @pixbuf: a #GdkPixbuf
|
|
|
|
|
* @key: a nul-terminated string.
|
|
|
|
|
* @value: a nul-terminated string.
|
|
|
|
|
*
|
|
|
|
|
* Attaches a key/value pair as an option to a #GdkPixbuf. If %key already
|
|
|
|
|
* exists in the list of options attached to @pixbuf, the new value is
|
|
|
|
|
* ignored and %FALSE is returned.
|
|
|
|
|
*
|
|
|
|
|
* Return value: %TRUE on success.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
2002-09-19 21:00:52 +00:00
|
|
|
|
gdk_pixbuf_set_option (GdkPixbuf *pixbuf,
|
2001-10-05 18:51:47 +00:00
|
|
|
|
const gchar *key,
|
|
|
|
|
const gchar *value)
|
|
|
|
|
{
|
|
|
|
|
GQuark quark;
|
|
|
|
|
gchar **options;
|
|
|
|
|
gint n = 0;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), FALSE);
|
|
|
|
|
g_return_val_if_fail (key != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (value != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
quark = g_quark_from_static_string ("gdk_pixbuf_options");
|
|
|
|
|
|
|
|
|
|
options = g_object_get_qdata (G_OBJECT (pixbuf), quark);
|
|
|
|
|
|
|
|
|
|
if (options) {
|
|
|
|
|
for (n = 0; options[2*n]; n++) {
|
|
|
|
|
if (strcmp (options[2*n], key) == 0)
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_object_steal_qdata (G_OBJECT (pixbuf), quark);
|
|
|
|
|
options = g_renew (gchar *, options, 2*(n+1) + 1);
|
|
|
|
|
} else {
|
|
|
|
|
options = g_new (gchar *, 3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
options[2*n] = g_strdup (key);
|
|
|
|
|
options[2*n+1] = g_strdup (value);
|
|
|
|
|
options[2*n+2] = NULL;
|
|
|
|
|
|
|
|
|
|
g_object_set_qdata_full (G_OBJECT (pixbuf), quark,
|
|
|
|
|
options, (GDestroyNotify) g_strfreev);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-04-18 18:09: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
|
|
|
|
/* Include the marshallers */
|
2001-01-31 15:09:59 +00:00
|
|
|
|
#include <glib-object.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 "gdk-pixbuf-marshal.c"
|