gtk2/gdk-pixbuf/gdk-pixbuf-animation.c

467 lines
13 KiB
C
Raw Normal View History

Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
/* GdkPixbuf library - Simple animation support
*
* Copyright (C) 1999 The Free Software Foundation
*
* Authors: Jonathan Blandford <jrb@redhat.com>
* Havoc Pennington <hp@redhat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +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
* Lesser General Public License for more details.
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
*
* You should have received a copy of the GNU Lesser General Public
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +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.
*/
#include <config.h>
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
#include <errno.h>
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
#include "gdk-pixbuf-io.h"
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) 2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
2000-04-11 07:03:25 +00:00
#include "gdk-pixbuf-private.h"
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
static void gdk_pixbuf_animation_class_init (GdkPixbufAnimationClass *klass);
static void gdk_pixbuf_animation_finalize (GObject *object);
static gpointer parent_class;
GType
gdk_pixbuf_animation_get_type (void)
{
static GType object_type = 0;
if (!object_type) {
static const GTypeInfo object_info = {
sizeof (GdkPixbufAnimationClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_pixbuf_animation_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkPixbufAnimation),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
"GdkPixbufAnimation",
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);
}
return object_type;
}
static void
gdk_pixbuf_animation_class_init (GdkPixbufAnimationClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_pixbuf_animation_finalize;
}
static void
gdk_pixbuf_animation_finalize (GObject *object)
{
GdkPixbufAnimation *animation = GDK_PIXBUF_ANIMATION (object);
GList *l;
GdkPixbufFrame *frame;
for (l = animation->frames; l; l = l->next) {
frame = l->data;
gdk_pixbuf_unref (frame->pixbuf);
g_free (frame);
}
g_list_free (animation->frames);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
/**
* gdk_pixbuf_animation_new_from_file:
* @filename: Name of file to load.
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
* @error: return location for error
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
*
* Creates a new animation by loading it from a file. The file format is
* detected automatically. If the file's format does not support multi-frame
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
* images, then an animation with a single frame will be created. Possible errors
* are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
*
* Return value: A newly created animation with a reference count of 1, or NULL
* if any of several error conditions ocurred: the file could not be opened,
* there was no loader for the file's format, there was not enough memory to
* allocate the image buffer, or the image file contained invalid data.
**/
GdkPixbufAnimation *
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
gdk_pixbuf_animation_new_from_file (const char *filename,
GError **error)
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
{
GdkPixbufAnimation *animation;
int size;
FILE *f;
guchar buffer [128];
GdkPixbufModule *image_module;
g_return_val_if_fail (filename != NULL, NULL);
f = fopen (filename, "rb");
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
if (!f) {
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (errno),
_("Failed to open file '%s': %s"),
filename, g_strerror (errno));
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
return NULL;
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
}
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
size = fread (&buffer, 1, sizeof (buffer), f);
if (size == 0) {
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Image file '%s' contains no data"),
filename);
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
fclose (f);
return NULL;
}
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
image_module = gdk_pixbuf_get_module (buffer, size, filename, error);
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
if (!image_module) {
fclose (f);
return NULL;
}
if (image_module->module == NULL)
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
if (!gdk_pixbuf_load_module (image_module, error)) {
fclose (f);
return NULL;
}
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
if (image_module->load_animation == NULL) {
GdkPixbuf *pixbuf;
GdkPixbufFrame *frame;
/* Keep this logic in sync with gdk_pixbuf_new_from_file() */
if (image_module->load == NULL) {
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
_("Don't know how to load the animation in file '%s'"),
filename);
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
fclose (f);
return NULL;
}
fseek (f, 0, SEEK_SET);
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
pixbuf = (* image_module->load) (f, error);
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
fclose (f);
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
if (pixbuf == NULL && error != NULL && *error == NULL) {
/* I don't trust these crufty longjmp()'ing image libs
* to maintain proper error invariants, and I don't
* want user code to segfault as a result. We need to maintain
* the invariant that error gets set if NULL is returned.
*/
g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
image_module->module_name);
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("Failed to load image '%s': reason not known, probably a corrupt image file"),
filename);
}
if (pixbuf == NULL)
return NULL;
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
frame = g_new (GdkPixbufFrame, 1);
frame->pixbuf = pixbuf;
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
g_object_ref (G_OBJECT (frame->pixbuf));
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
frame->x_offset = 0;
frame->y_offset = 0;
frame->delay_time = -1;
frame->action = GDK_PIXBUF_FRAME_RETAIN;
add xthickness and ythickness to GtkRcStyle and add the necessary tokens. Tue Jul 11 06:38:42 2000 Tim Janik <timj@gtk.org> * gtk/gtkrc.h: add xthickness and ythickness to GtkRcStyle and add the necessary tokens. * gtk/gtkrc.c (gtk_rc_style_init): properly initiality the rc style. (gtk_rc_style_to_style): copy thicknesses. (gtk_rc_init_style): apply thicknesses. (gtk_rc_parse_style): parse xthickness and ythickness. * gdk/x11/gdkdnd-x11.c: silence compiler in switch() statements. * gdk/x11/gdkwindow-x11.c (gdk_window_foreign_new): (gdk_window_new): (_gdk_windowing_window_init): * gdk/x11/gdkpixmap-x11.c (gdk_pixmap_foreign_new): (gdk_pixmap_create_from_data): (gdk_bitmap_create_from_data): (gdk_pixmap_new): * gdk/x11/gdkimage-x11.c (gdk_image_get): (gdk_image_new): * gdk/x11/gdkgc-x11.c (_gdk_x11_gc_new): * gdk/x11/gdkdnd-x11.c (gdk_drag_context_new): * gdk/x11/gdkcolor-x11.c (gdkx_colormap_get): (gdk_colormap_get_system): (gdk_colormap_new): * gdk/gdkwindow.c (gdk_window_init): * gtk/gtkstyle.c (gtk_style_new): * gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done): * gdk/gdkpixmap.c (gdk_pixmap_init): * gtk/gtkrc.c (gtk_rc_style_new): use g_object_new() instead of g_type_create_instance() which is a private function for fundamental type implementations. Tue Jul 11 06:20:14 2000 Tim Janik <timj@gtk.org> * io-gif.c (gdk_pixbuf__gif_image_load_animation): * gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): use g_object_new() instead of g_type_create_instance() which is a private function for fundamental type implementations.
2000-07-11 04:46:11 +00:00
animation = g_object_new (GDK_TYPE_PIXBUF_ANIMATION, NULL);
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
animation->n_frames = 1;
animation->frames = g_list_prepend (NULL, frame);
animation->width = gdk_pixbuf_get_width (pixbuf);
animation->height = gdk_pixbuf_get_height (pixbuf);
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
} else {
fseek (f, 0, SEEK_SET);
Some updates 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtk-sections.txt: Some updates * gdk/gdk-sections.txt: remove GdkPixbufAlphaMode * gdk-pixbuf/gdk-pixbuf-sections.txt: Add new API, remove GdkPixbufClass/GdkAnimationClass since those are private * gdk-pixbuf/Makefile.am (IGNORE_HFILES): ignore more headers 2000-10-18 Havoc Pennington <hp@redhat.com> * gtk/gtktextiter.c (gtk_text_iter_forward_to_newline): Fix a bug where any number of empty lines would get skipped * gtk/gtktextiter.h: Remove padding from GtkTextIter; live on the edge. * gtk/gtktextiter.c (gtk_text_iter_make_surreal): enhance the warning about invalid iterators (explain more thoroughly) (gtk_text_iter_in_region): rename gtk_text_iter_in_range * gtk/gtktextview.c (FOCUS_EDGE_WIDTH): Make focus rectangle less big * demos/*.c: Add error handling * gtk/gtktextbuffer.c: don't modify const iterators * gtk/gdk-pixbuf-loader.c: Add full error handling here * gtk/gtkimage.c (gtk_image_set_from_file): ignore errors on file load * gtk/gtkiconfactory.c: Update to reflect addition of error handling to gdk-pixbuf loaders 2000-10-16 Havoc Pennington <hp@redhat.com> * gdk-pixbuf-io.c (gdk_pixbuf_get_module) (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module): add error reporting here also * make-inline-pixbuf.c (main): use GError * io-xpm.c: include unistd.h * gdk-pixbuf-util.c: include string.h * io-*.c: add error reporting * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add error reporting * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting * gdk-pixbuf-io.h: Add GError** to load_increment and load methods * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return a G_FILE_ERROR if we fail to write or close the file. * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following the GError naming rules. Add GError** to load functions.
2000-10-18 18:42:54 +00:00
animation = (* image_module->load_animation) (f, error);
if (animation == NULL && error != NULL && *error == NULL) {
/* I don't trust these crufty longjmp()'ing
* image libs to maintain proper error
* invariants, and I don't want user code to
* segfault as a result. We need to maintain
* the invariant that error gets set if NULL
* is returned.
*/
g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
image_module->module_name);
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("Failed to load animation '%s': reason not known, probably a corrupt animation file"),
filename);
}
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
fclose (f);
}
return animation;
}
/**
* gdk_pixbuf_animation_ref:
* @animation: An animation.
*
* Adds a reference to an animation. Deprecated; use
* g_object_ref(). The reference must be released afterwards using
* g_object_unref().
*
* Return value: The same as the @animation argument.
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
**/
GdkPixbufAnimation *
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation)
{
return (GdkPixbufAnimation*) g_object_ref (G_OBJECT (animation));
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
}
/**
* gdk_pixbuf_animation_unref:
* @animation: An animation.
*
* Removes a reference from an animation. Deprecated; use g_object_unref().
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
**/
void
gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation)
{
g_object_unref (G_OBJECT (animation));
Added reference counting to animations. A web browser may want to share a 2000-01-01 Federico Mena Quintero <federico@helixcode.com> * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference counting to animations. A web browser may want to share a single copy of an animated GIF if it appears multiple times in a web page, for example. * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the animation functions here. (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL animation if the loader does not support multiframe loading and the single-frame load returned NULL. Check that the filename is not NULL. Updated inline documentation. (gdk_pixbuf_animation_ref): New function. (gdk_pixbuf_animation_unref): New function. Removed gdk_pixbuf_animation_destroy() in favor of reference counting. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Prettified. Made ref_count assertion more paranoid. Check that the filename is not NULL. (gdk_pixbuf_get_module): Use guchar * and guint for buffer and size, respectively. (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to const char **. * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation with a reference count of 1. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-animation.c. * doc/tmpl/animation.sgml: Populated. It is still missing a description of the overlay modes. * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved the canvas item section to the end, as it will be moved later to gnome-libs. * doc/gdk-pixbuf.sgml: Added the animation section. * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
2000-01-02 03:59:22 +00:00
}
/**
* gdk_pixbuf_animation_get_width:
* @animation: An animation.
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
*
* Queries the width of the bounding box of a pixbuf animation.
*
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
* Return value: Width of the bounding box of the animation.
**/
int
gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation)
{
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
g_return_val_if_fail (animation != NULL, -1);
return animation->width;
}
/**
* gdk_pixbuf_animation_get_height:
* @animation: An animation.
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
*
* Queries the height of the bounding box of a pixbuf animation.
*
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
* Return value: Height of the bounding box of the animation.
**/
int
gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation)
{
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
g_return_val_if_fail (animation != NULL, -1);
return animation->height;
}
/**
* gdk_pixbuf_animation_get_num_frames:
* @animation: An animation.
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
*
* Queries the number of frames in a pixbuf animation.
*
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
* Return value: Number of frames in the animation.
**/
int
gdk_pixbuf_animation_get_num_frames (GdkPixbufAnimation *animation)
{
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
g_return_val_if_fail (animation != NULL, -1);
return animation->n_frames;
}
/**
* gdk_pixbuf_animation_get_frames:
* @animation: An animation.
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
*
* Queries the list of frames of an animation.
*
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
* Return value: List of frames in the animation; this is a #GList of
* #GdkPixbufFrame structures.
**/
GList *
gdk_pixbuf_animation_get_frames (GdkPixbufAnimation *animation)
{
Your eyes are bloodshot. Your eyes are bloodshot. Your mouth starts to foam. Your hands are shaking. You know your need your fix. NEED MORE ABSTRACTION! 2000-04-12 Federico Mena Quintero <federico@helixcode.com> This comes from an excellent idea by Tim Janik (timj@gtk.org) to hook to the last unref operation. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New function to set the last unref handler for a pixbuf. (gdk_pixbuf_finalize): New function to actually finalize a pixbuf. It calls the pixbuf's destroy notification function and frees the GdkPixbuf structure itself. (gdk_pixbuf_unref): Use the last unref function of the pixbuf if available. * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields for the last unref handler and its user data. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use g_new0() to allocate the pixbuf. * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Fixed the call to gtk_signal_new() for the "frame_done" signal; it was not specifying the `frame' argument. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_width): Fixed docstring. (gdk_pixbuf_animation_get_height): Likewise. (gdk_pixbuf_animation_get_num_frames): Likewise. (gdk_pixbuf_animation_get_frames): Likewise. * doc/gdk-pixbuf-sections.txt: Updated with the new functions and types. * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace. * doc/tmpl/scaling.sgml: Added the description for GdkInterpType. * doc/tmpl/refcounting.sgml: Updated with the information about the last unref handler. * doc/tmpl/*.sgml: Markup tweaks. * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh, update the libtool version number for libgnomecanvaspixbuf as well. (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned as well, or the old ones won't work with the new stuff. Also, renamed the modules as follows. * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the modules are called "libpixbufloader-<format>.so" instead of "libpixbuf-<format>.so". They needed renaming so that the new loaders won't overwrite the old ones; even with the versioning stuff, the new .so symlink to the .so.1.0.0 would overwrite the old real .so file.
2000-04-13 01:18:41 +00:00
g_return_val_if_fail (animation != NULL, NULL);
return animation->frames;
}
Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) 2000-04-11 Federico Mena Quintero <federico@helixcode.com> Most of this patch is based on a patch by Havoc Pennington (hp@redhat.com) to make GdkPixbuf's structures opaque and to remove the libart dependency. * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures. (GdkColorspace): New enum that for now only contains GDK_COLORSPACE_RGB. (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy notification function. (GdkInterpType): New num with interpolation types. * *.[ch]: Replace the libart stuff with our own stuff. * pixops/*.[ch]: Likewise. * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private declarations of the GdkPixbuf structures. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf): Removed function. (gdk_pixbuf_get_format): Constify. (gdk_pixbuf_get_n_channels): Constify. (gdk_pixbuf_get_has_alpha): Constify. (gdk_pixbuf_get_bits_per_sample): Constify. (gdk_pixbuf_get_pixels): Constify. (gdk_pixbuf_get_width): Constify. (gdk_pixbuf_get_height): Constify. (gdk_pixbuf_get_rowstride): Constify. * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy a pixbuf. * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a bits_per_sample argument; currently only 8 bits per sample are supported. * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf): New accessor. (gdk_pixbuf_frame_get_x_offset): New accessor. (gdk_pixbuf_frame_get_y_offset): New accessor. (gdk_pixbuf_frame_get_delay_time): New accessor. (gdk_pixbuf_frame_get_action): New accessor. * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid mask rectangle for pixbufs without an alpha channel, set the *mask_return to NULL. * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify. * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes. * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some preconditions. Maybe we should also check for the colorspace, bits per pixel, and such. (gdk_pixbuf_composite): Likewise. (gdk_pixbuf_composite_color): Likewise. (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we cannot allocate the new pixbuf. (gdk_pixbuf_composite_color_simple): Likewise. * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer have an ArtPixBuf. * gdk-pixbuf/io-bmp.c: Fix includes. * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in an lvalue. * TODO: Populated. * configure.in: Removed checks for libart. * gdk-pixbuf/Makefile.am: Removed references to libart. (noinst_HEADERS): Added gdk-pixbuf-private.h. * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented the version number of the libtool library to indicate that this definitely is not compatible with the old usage. I know you love me. I know you do. * configure.in: Bumped version number to 0.7.0. * README: Updated. * gdk-pixbuf-config.in (--libs): We no longer require libart. * DEPENDS.libgdk_pixbuf: We no longer depend on libart. * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
2000-04-11 07:03:25 +00:00
/**
* gdk_pixbuf_frame_get_pixbuf:
* @frame: A pixbuf animation frame.
*
* Queries the pixbuf of an animation frame.
*
* Return value: A pixbuf.
**/
GdkPixbuf *
gdk_pixbuf_frame_get_pixbuf (GdkPixbufFrame *frame)
{
g_return_val_if_fail (frame != NULL, NULL);
return frame->pixbuf;
}
/**
* gdk_pixbuf_frame_get_x_offset:
* @frame: A pixbuf animation frame.
*
* Queries the X offset of an animation frame.
*
* Return value: X offset from the top left corner of the animation.
**/
int
gdk_pixbuf_frame_get_x_offset (GdkPixbufFrame *frame)
{
g_return_val_if_fail (frame != NULL, -1);
return frame->x_offset;
}
/**
* gdk_pixbuf_frame_get_y_offset:
* @frame: A pixbuf animation frame.
*
* Queries the Y offset of an animation frame.
*
* Return value: Y offset from the top left corner of the animation.
**/
int
gdk_pixbuf_frame_get_y_offset (GdkPixbufFrame *frame)
{
g_return_val_if_fail (frame != NULL, -1);
return frame->y_offset;
}
/**
* gdk_pixbuf_frame_get_delay_time:
* @frame: A pixbuf animation frame.
*
* Queries the delay time in milliseconds of an animation frame.
*
* Return value: Delay time in milliseconds.
**/
int
gdk_pixbuf_frame_get_delay_time (GdkPixbufFrame *frame)
{
g_return_val_if_fail (frame != NULL, -1);
return frame->delay_time;
}
/**
* gdk_pixbuf_frame_get_action:
* @frame: A pixbuf animation frame.
*
* Queries the overlay action of an animation frame.
*
* Return value: Overlay action for this frame.
**/
GdkPixbufFrameAction
gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame)
{
g_return_val_if_fail (frame != NULL, GDK_PIXBUF_FRAME_RETAIN);
return frame->action;
}
Port to GObject, can go back in gdk-pixbuf after setting up a 2000-12-16 Havoc Pennington <hp@pobox.com> * gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c: Port to GObject, can go back in gdk-pixbuf after setting up a gdk-pixbuf-marshal.h header over there. * gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g; (gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal args (gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be set (gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons here, do it when we create the buttons later (gtk_tree_view_realize_buttons): add some g_return_if_fail (gtk_tree_view_map): paranoia checks that column->button is shown and unmapped (gtk_tree_view_size_request): only request visible children. Move header size calculation in here, for cleanliness, and to maintain invariants for child widgets if we eventually let users set different children inside the buttons (gtk_tree_view_map_buttons): factor out code to map buttons, since it was being called several times (gtk_tree_view_size_allocate_buttons): move_resize the drag windows instead of just moving them; their height may change if we allow random widgets in there, or the theme changes. (gtk_tree_view_size_allocate): move button size allocation above emitting the scroll signals, to ensure a sane state when we hit user code (gtk_tree_view_button_release): remove queue_resize after tree_view_set_size(), set_size() will handle any resize queuing that's needed (gtk_tree_view_focus_in): just queue a draw, don't fool with draw_focus goo (gtk_tree_view_focus): use gtk_get_current_event() and gdk_event_get_state() (gtk_tree_view_deleted): don't queue_resize() after calling set_size() (gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove semicolon (gtk_tree_view_create_button): show the button here (gtk_tree_view_button_clicked): actually emit the clicked signal on the column (_gtk_tree_view_set_size): return right away if the size is unchanged, as a cheesy optimization (gtk_tree_view_setup_model): rename set_model_realized to setup_model to match the flag that indicates whether we've called it (gtk_tree_view_get_hadjustment): create adjustment if it doesn't exist, because set_scroll_adjustment does that and it shouldn't matter what order you call these in (gtk_tree_view_get_vadjustment): ditto (gtk_tree_view_set_headers_visible): canonicalize the bool, for paranoia (gtk_tree_view_set_headers_visible): call gtk_tree_view_map_buttons() instead of using cut-and-paste code (gtk_tree_view_append_column): clarify whether the return value is the count of columns before or after, and do the increment separately from the return statement so you can tell from the code. (gtk_tree_view_remove_column): ditto (gtk_tree_view_insert_column): ditto (gtk_tree_view_get_column): remove g_return_if_fail for columns outside the existing range, the docs say that outside-range columns are allowed, so we handle them as documented. (Presumably this allows a nice loop with column != NULL as test.) (gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments mean (left/right/center etc.). (gtk_tree_view_collapse_all): only queue a draw if we're mapped (gtk_tree_view_expand_row): add docs (gtk_tree_view_collapse_row): add docs * gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new function to emit the clicked signal on a column * gdk/gdkevents.c (gdk_event_get_state): new function, to get the state of an event (gdk_event_get_time): don't treat GDK_SCROLL as a button event, remove default case from switch so gcc will whine if we don't explicitly handle all event types * gtk/gtktreeselection.h: added some FIXME * gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename "columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
/**
* gdk_pixbuf_frame_copy:
* @src: a #GdkPixbufFrame to copy
*
* Copies a #GdkPixbufFrame. Free the result
* with gdk_pixbuf_frame_free().
*
* Return value: a new #GdkPixbufFrame
**/
GdkPixbufFrame*
gdk_pixbuf_frame_copy (GdkPixbufFrame *src)
{
GdkPixbufFrame *frame;
frame = g_new (GdkPixbufFrame, 1);
frame->pixbuf = src->pixbuf;
g_object_ref (G_OBJECT (frame->pixbuf));
frame->x_offset = src->x_offset;
frame->y_offset = src->y_offset;
frame->delay_time = src->delay_time;
frame->action = src->action;
return frame;
}
/**
* gdk_pixbuf_frame_free:
* @frame: a #GdkPixbufFrame
*
* Frees a #GdkPixbufFrame. Don't do this with frames you got from
* #GdkPixbufAnimation, usually the animation owns those (it doesn't
* make a copy before returning the frame).
**/
void
gdk_pixbuf_frame_free (GdkPixbufFrame *frame)
{
g_return_if_fail (frame != NULL);
g_object_unref (G_OBJECT (frame->pixbuf));
g_free (frame);
}
GType
gdk_pixbuf_frame_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
{
our_type = g_boxed_type_register_static ("GdkPixbufFrame",
gdk_pixbuf_frame_copy,
gdk_pixbuf_frame_free);
}
return our_type;
}