Commit 829ed024 authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero

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.
parent daaae930
......@@ -19,12 +19,12 @@
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <gtk/gtk.h>
#include "gdk-pixbuf.h"
#include "gdk-pixbuf-io.h"
#include "gdk-pixbuf-loader.h"
typedef struct {
......@@ -201,22 +201,17 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
if (!pixbuf->art_pixbuf) {
g_warning ("art_pixbuf is NULL in expose_func!!\n");
return;
}
if (pixbuf->art_pixbuf->has_alpha) {
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
gdk_draw_rgb_32_image (drawing_area->window,
drawing_area->style->black_gc,
event->area.x, event->area.y,
event->area.width,
event->area.height,
GDK_RGB_DITHER_MAX,
pixbuf->art_pixbuf->pixels
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
pixbuf->art_pixbuf->rowstride);
gdk_pixbuf_get_pixels (pixbuf)
+ (event->area.y * gdk_pixbuf_get_rowstride (pixbuf))
+ (event->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
gdk_pixbuf_get_rowstride (pixbuf));
} else {
gdk_draw_rgb_image (drawing_area->window,
drawing_area->style->white_gc,
......@@ -224,10 +219,10 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
event->area.width,
event->area.height,
GDK_RGB_DITHER_NORMAL,
pixbuf->art_pixbuf->pixels
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
pixbuf->art_pixbuf->rowstride);
gdk_pixbuf_get_pixels (pixbuf)
+ (event->area.y * gdk_pixbuf_get_rowstride (pixbuf))
+ (event->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
gdk_pixbuf_get_rowstride (pixbuf));
}
}
......@@ -239,8 +234,8 @@ config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
#if 0
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
((event->height) != (pixbuf->art_pixbuf->height)))
if (((event->width) != gdk_pixbuf_get_width (pixbuf)) ||
((event->height) != gdk_pixbuf_get_height (pixbuf)))
gdk_pixbuf_scale(pixbuf, event->width, event->height);
#endif
}
......@@ -255,8 +250,8 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
GtkWidget *drawing_area;
gint w, h;
w = pixbuf->art_pixbuf->width;
h = pixbuf->art_pixbuf->height;
w = gdk_pixbuf_get_width (pixbuf);
h = gdk_pixbuf_get_height (pixbuf);
window = gtk_widget_new (gtk_window_get_type (),
"GtkObject::user_data", NULL,
......@@ -306,6 +301,7 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
return window;
}
#if 0
static gint
update_timeout(gpointer data)
......@@ -367,6 +363,8 @@ progressive_updated_callback(GdkPixbufLoader* loader, guint x, guint y, guint wi
return;
}
#endif
static int readlen = 4096;
int
......@@ -376,7 +374,6 @@ main (int argc, char **argv)
int found_valid = FALSE;
GdkPixbufAnimation *animation;
GdkPixbufLoader *pixbuf_loader;
gtk_init (&argc, &argv);
......@@ -414,16 +411,24 @@ main (int argc, char **argv)
if (animation) {
gint i = 0;
GList *listptr;
for (listptr = animation->frames; listptr; listptr = listptr->next){
for (listptr = gdk_pixbuf_animation_get_frames (animation);
listptr;
listptr = listptr->next) {
GdkPixbufFrame *frame;
GdkPixbuf *pixbuf;
gchar *title;
frame = listptr->data;
pixbuf = gdk_pixbuf_frame_get_pixbuf (frame);
title = g_strdup_printf ("Frame %d", i);
g_print ("Frame %d x:%d y:%d width:%d height:%d\n",
i,
((GdkPixbufFrame *)listptr->data)->x_offset,
((GdkPixbufFrame *)listptr->data)->y_offset,
gdk_pixbuf_get_width (((GdkPixbufFrame *)listptr->data)->pixbuf),
gdk_pixbuf_get_height (((GdkPixbufFrame *)listptr->data)->pixbuf));
new_testrgb_window (((GdkPixbufFrame *)listptr->data)->pixbuf, title);
gdk_pixbuf_frame_get_x_offset (frame),
gdk_pixbuf_frame_get_y_offset (frame),
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
new_testrgb_window (pixbuf, title);
g_free (title);
i++;
}
......@@ -434,6 +439,7 @@ main (int argc, char **argv)
{
GtkWidget* rgb_window = NULL;
ProgressFileStatus status;
GdkPixbufLoader *pixbuf_loader;
pixbuf_loader = gdk_pixbuf_loader_new ();
status.loader = pixbuf_loader;
......
......@@ -15,7 +15,7 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
pixbuf = (GdkPixbuf *) gtk_object_get_data(GTK_OBJECT(drawing_area),
"pixbuf");
if(pixbuf->art_pixbuf->has_alpha)
if(gdk_pixbuf_get_has_alpha (pixbuf))
{
gdk_draw_rgb_32_image(drawing_area->window,
drawing_area->style->black_gc,
......@@ -23,10 +23,10 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
evt->area.width,
evt->area.height,
GDK_RGB_DITHER_MAX,
pixbuf->art_pixbuf->pixels +
(evt->area.y * pixbuf->art_pixbuf->rowstride) +
(evt->area.x * pixbuf->art_pixbuf->n_channels),
pixbuf->art_pixbuf->rowstride);
gdk_pixbuf_get_pixels (pixbuf) +
(evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) +
(evt->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
gdk_pixbuf_get_rowstride (pixbuf));
}
else
{
......@@ -36,10 +36,10 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
evt->area.width,
evt->area.height,
GDK_RGB_DITHER_NORMAL,
pixbuf->art_pixbuf->pixels +
(evt->area.y * pixbuf->art_pixbuf->rowstride) +
(evt->area.x * pixbuf->art_pixbuf->n_channels),
pixbuf->art_pixbuf->rowstride);
gdk_pixbuf_get_pixels (pixbuf) +
(evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) +
(evt->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
gdk_pixbuf_get_rowstride (pixbuf));
}
return FALSE;
}
......@@ -52,7 +52,7 @@ int configure_cb(GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
"pixbuf");
g_print("X:%d Y:%d\n", evt->width, evt->height);
if(evt->width != pixbuf->art_pixbuf->width || evt->height != pixbuf->art_pixbuf->height)
if(evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf))
{
GdkWindow *root;
GdkPixbuf *new_pixbuf;
......@@ -97,8 +97,8 @@ int main(int argc, char **argv)
drawing_area = gtk_drawing_area_new();
gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area),
pixbuf->art_pixbuf->width,
pixbuf->art_pixbuf->height);
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event",
GTK_SIGNAL_FUNC(expose_cb), NULL);
......
......@@ -3,15 +3,15 @@
#include <stdio.h>
ArtFilterLevel filter_level = ART_FILTER_BILINEAR;
GdkInterpType interp_type = GDK_INTERP_BILINEAR;
int overall_alpha = 255;
GdkPixbuf *pixbuf;
GtkWidget *darea;
void
set_filter_level (GtkWidget *widget, gpointer data)
set_interp_type (GtkWidget *widget, gpointer data)
{
filter_level = GPOINTER_TO_UINT (data);
interp_type = GPOINTER_TO_UINT (data);
gtk_widget_queue_draw (darea);
}
......@@ -32,14 +32,14 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
dest = gdk_pixbuf_new (ART_PIX_RGB, FALSE, 8, event->area.width, event->area.height);
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
gdk_pixbuf_composite_color (pixbuf, dest,
0, 0, event->area.width, event->area.height,
-event->area.x, -event->area.y,
(double) widget->allocation.width / pixbuf->art_pixbuf->width,
(double) widget->allocation.height / pixbuf->art_pixbuf->height,
filter_level, overall_alpha,
(double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf),
(double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf),
interp_type, overall_alpha,
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
gdk_pixbuf_render_to_drawable (dest, widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
......@@ -87,28 +87,28 @@ main(int argc, char **argv)
menuitem = gtk_menu_item_new_with_label ("NEAREST");
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (set_filter_level),
GUINT_TO_POINTER (ART_FILTER_NEAREST));
GTK_SIGNAL_FUNC (set_interp_type),
GUINT_TO_POINTER (GDK_INTERP_NEAREST));
gtk_widget_show (menuitem);
gtk_container_add (GTK_CONTAINER (menu), menuitem);
menuitem = gtk_menu_item_new_with_label ("BILINEAR");
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (set_filter_level),
GUINT_TO_POINTER (ART_FILTER_BILINEAR));
GTK_SIGNAL_FUNC (set_interp_type),
GUINT_TO_POINTER (GDK_INTERP_BILINEAR));
gtk_widget_show (menuitem);
gtk_container_add (GTK_CONTAINER (menu), menuitem);
menuitem = gtk_menu_item_new_with_label ("TILES");
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (set_filter_level),
GUINT_TO_POINTER (ART_FILTER_TILES));
GTK_SIGNAL_FUNC (set_interp_type),
GUINT_TO_POINTER (GDK_INTERP_TILES));
gtk_container_add (GTK_CONTAINER (menu), menuitem);
menuitem = gtk_menu_item_new_with_label ("HYPER");
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (set_filter_level),
GUINT_TO_POINTER (ART_FILTER_HYPER));
GTK_SIGNAL_FUNC (set_interp_type),
GUINT_TO_POINTER (GDK_INTERP_HYPER));
gtk_container_add (GTK_CONTAINER (menu), menuitem);
optionmenu = gtk_option_menu_new ();
......@@ -145,8 +145,8 @@ main(int argc, char **argv)
GTK_SIGNAL_FUNC (expose_cb), NULL);
gtk_window_set_default_size (GTK_WINDOW (window),
pixbuf->art_pixbuf->width,
scratch_requisition.height + pixbuf->art_pixbuf->height);
gdk_pixbuf_get_width (pixbuf),
scratch_requisition.height + gdk_pixbuf_get_height (pixbuf));
gtk_widget_show_all (window);
......
/* testpixbuf -- test program for gdk-pixbuf code
* Copyright (C) 1999 Mark Crichton, Larry Ewing
*
......@@ -19,12 +18,12 @@
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <gtk/gtk.h>
#include "gdk-pixbuf.h"
#include "gdk-pixbuf-io.h"
#include "gdk-pixbuf-loader.h"
typedef struct {
......@@ -34,7 +33,6 @@ typedef struct {
guchar *buf;
guint timeout;
guint readlen;
} ProgressFileStatus;
......@@ -321,22 +319,17 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
pixbuf = (GdkPixbuf *)gtk_object_get_data(GTK_OBJECT(drawing_area), "pixbuf");
if (!pixbuf->art_pixbuf) {
g_warning ("art_pixbuf is NULL in expose_func!!\n");
return;
}
if (pixbuf->art_pixbuf->has_alpha) {
if (gdk_pixbuf_get_has_alpha (pixbuf)) {
gdk_draw_rgb_32_image (drawing_area->window,
drawing_area->style->black_gc,
event->area.x, event->area.y,
event->area.width,
event->area.height,
GDK_RGB_DITHER_MAX,
pixbuf->art_pixbuf->pixels
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
pixbuf->art_pixbuf->rowstride);
gdk_pixbuf_get_pixels (pixbuf)
+ (event->area.y * gdk_pixbuf_get_rowstride (pixbuf))
+ (event->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
gdk_pixbuf_get_rowstride (pixbuf));
} else {
gdk_draw_rgb_image (drawing_area->window,
drawing_area->style->white_gc,
......@@ -344,10 +337,10 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
event->area.width,
event->area.height,
GDK_RGB_DITHER_NORMAL,
pixbuf->art_pixbuf->pixels
+ (event->area.y * pixbuf->art_pixbuf->rowstride)
+ (event->area.x * pixbuf->art_pixbuf->n_channels),
pixbuf->art_pixbuf->rowstride);
gdk_pixbuf_get_pixels (pixbuf)
+ (event->area.y * gdk_pixbuf_get_rowstride (pixbuf))
+ (event->area.x * gdk_pixbuf_get_n_channels (pixbuf)),
gdk_pixbuf_get_rowstride (pixbuf));
}
}
......@@ -361,8 +354,8 @@ config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
g_print("X:%d Y:%d\n", event->width, event->height);
#if 0
if (((event->width) != (pixbuf->art_pixbuf->width)) ||
((event->height) != (pixbuf->art_pixbuf->height)))
if (((event->width) != gdk_pixbuf_get_width (pixbuf)) ||
((event->height) != gdk_pixbuf_get_height (pixbuf)))
gdk_pixbuf_scale(pixbuf, event->width, event->height);
#endif
}
......@@ -377,8 +370,8 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
GtkWidget *drawing_area;
gint w, h;
w = pixbuf->art_pixbuf->width;
h = pixbuf->art_pixbuf->height;
w = gdk_pixbuf_get_width (pixbuf);
h = gdk_pixbuf_get_height (pixbuf);
window = gtk_widget_new (gtk_window_get_type (),
"GtkObject::user_data", NULL,
......@@ -529,7 +522,7 @@ main (int argc, char **argv)
if (argc == 1) {
const gchar*** xpmp;
pixbuf = gdk_pixbuf_new_from_data (default_image, ART_PIX_RGB, FALSE,
pixbuf = gdk_pixbuf_new_from_data (default_image, GDK_COLORSPACE_RGB, FALSE, 8,
DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH * 3,
NULL, NULL);
new_testrgb_window (pixbuf, NULL);
......
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-06 Jonathan Blandford <jrb@redhat.com>
* gdk-pixbuf/testanimation.c (main): add more info to the
......
......@@ -144,25 +144,25 @@ DEPS = libgdk_pixbuf.la
INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
-I$(top_srcdir)/gdk-pixbuf \
-I$(top_builddir)/gdk-pixbuf \
$(GLIB_CFLAGS) $(LIBART_CFLAGS) $(GTK_CFLAGS)
$(GLIB_CFLAGS) $(GTK_CFLAGS)
AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(libexecdir)\""
LDADDS = libgdk_pixbuf.la $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS) $(STATIC_LIB_DEPS)
LDADDS = libgdk_pixbuf.la $(GLIB_LIBS) $(GTK_LIBS) $(STATIC_LIB_DEPS)
if INSIDE_GNOME_LIBS
testpixbuf_LDADD = $(LDADDS) $(LIBART_LIBS) -lgmodule
testpixbuf_LDADD = $(LDADDS) -lgmodule
testpixbuf_drawable_LDADD = $(LDADDS)
testpixbuf_scale_LDADD = $(LDADDS)
testanimation_LDADD = $(LDADDS) $(LIBART_LIBS) -lgmodule
testanimation_LDADD = $(LDADDS) -lgmodule
else
testpixbuf_LDADD = $(LDADDS) $(LIBART_LIBS) $(GNOME_LIBS) -lgmodule
testpixbuf_LDADD = $(LDADDS) $(GNOME_LIBS) -lgmodule
testpixbuf_drawable_LDADD = $(LDADDS) $(GNOME_LIBS)
testpixbuf_scale_LDADD = $(LDADDS) $(GNOME_LIBS)
testanimation_LDADD = $(LDADDS) $(LIBART_LIBS) $(GNOME_LIBS) -lgmodule
testanimation_LDADD = $(LDADDS) $(GNOME_LIBS) -lgmodule
endif
GDK_PIXBUF_LIBS = $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
GDK_PIXBUF_LIBS = $(GLIB_LIBS) $(GTK_LIBS)
#
# The GdkPixBuf library
......@@ -182,8 +182,8 @@ libgdk_pixbuf_la_SOURCES = \
gdk-pixbuf-util.c \
$(extra_sources)
libgdk_pixbuf_la_LDFLAGS = -version-info 1:0:0 $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
libgdk_pixbuf_la_LIBADD = pixops/libpixops.la
libgdk_pixbuf_la_LDFLAGS = -version-info 2:0:0 $(GLIB_LIBS) $(GTK_LIBS)
libgdk_pixbuf_la_LIBADD = pixops/libpixops.la
libgdk_pixbufinclude_HEADERS = \
gdk-pixbuf.h \
......@@ -191,6 +191,6 @@ libgdk_pixbufinclude_HEADERS = \
gdk-pixbuf-features.h \
$(CANVAS_PIXBUF_HEADERFILES)
noinst_HEADERS = \
gdk-pixbuf-io.h
noinst_HEADERS = \
gdk-pixbuf-io.h \
gdk-pixbuf-private.h
......@@ -23,6 +23,7 @@
#include <config.h>
#include "gdk-pixbuf-io.h"
#include "gdk-pixbuf-private.h"
......@@ -223,3 +224,85 @@ gdk_pixbuf_animation_get_frames (GdkPixbufAnimation *animation)
return animation->frames;
}
/**
* 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;
}
......@@ -22,48 +22,56 @@
#include <config.h>
#include "gdk-pixbuf.h"
#include "gdk-pixbuf-private.h"
/**
* gdk_pixbuf_new_from_data:
* @data: Image data in 8-bit/sample packed format.
* @format: Color format used for the data.
* @colorspace: Colorspace for the image data.
* @has_alpha: Whether the data has an opacity channel.
* @bits_per_sample: Number of bits per sample.
* @width: Width of the image in pixels.
* @height: Height of the image in pixels.
* @rowstride: Distance in bytes between rows.
* @dfunc: Function used to free the data when the pixbuf's reference count
* @destroy_fn: Function used to free the data when the pixbuf's reference count
* drops to zero, or NULL if the data should not be freed.
* @dfunc_data: Closure data to pass to the destroy notification function.
* @destroy_fn_data: Closure data to pass to the destroy notification function.
*
* Creates a new #GdkPixbuf out of in-memory RGB data.
* Creates a new #GdkPixbuf out of in-memory image data. Currently only RGB
* images with 8 bits per sample are supported.
*
* Return value: A newly-created #GdkPixbuf structure with a reference count of
* 1.
**/
GdkPixbuf *
gdk_pixbuf_new_from_data (const guchar *data, ArtPixFormat format, gboolean has_alpha,
int width, int height, int rowstride,
ArtDestroyNotify dfunc, gpointer dfunc_data)
gdk_pixbuf_new_from_data (const guchar *data, GdkColorspace colorspace, gboolean has_alpha,
int bits_per_sample, int width, int height, int rowstride,
GdkPixbufDestroyNotify destroy_fn, gpointer destroy_fn_data)
{
ArtPixBuf *art_pixbuf;
GdkPixbuf *pixbuf;
/* Only 8-bit/sample RGB buffers are supported for now */
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (format == ART_PIX_RGB, NULL);
g_return_val_if_fail (colorspace == GDK_COLORSPACE_RGB, NULL);
g_return_val_if_fail (bits_per_sample == 8, NULL);
g_return_val_if_fail (width > 0, NULL);
g_return_val_if_fail (height > 0, NULL);
if (has_alpha)
art_pixbuf = art_pixbuf_new_rgba_dnotify ((art_u8 *)data, width, height, rowstride,
dfunc_data, dfunc);
else
art_pixbuf = art_pixbuf_new_rgb_dnotify ((art_u8 *)data, width, height, rowstride,
dfunc_data, dfunc);
pixbuf = g_new (GdkPixbuf, 1);
pixbuf->ref_count = 1;
pixbuf->colorspace = colorspace;
pixbuf->n_channels = has_alpha ? 4 : 3;
pixbuf->bits_per_sample = bits_per_sample;
pixbuf->has_alpha = has_alpha ? TRUE : FALSE;
pixbuf->width = width;
pixbuf->height = height;
pixbuf->rowstride = rowstride;
pixbuf->pixels = (guchar *) data;
pixbuf->destroy_fn = destroy_fn;
pixbuf->destroy_fn_data = destroy_fn_data;
g_assert (art_pixbuf != NULL);
return gdk_pixbuf_new_from_art_pixbuf (art_pixbuf);
return pixbuf;
}
......@@ -24,6 +24,7 @@
#include <config.h>
#include <string.h>
#include <glib.h>
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
......
......@@ -27,6 +27,7 @@
#include <config.h>
#include <gtk/gtksignal.h>
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-loader.h"
#include "gdk-pixbuf-io.h"
......
/* GdkPixbuf library - Private declarations
*
* Copyright (C) 1999 The Free Software Foundation
*
* Authors: Mark Crichton <crichton@gimp.org>
* Miguel de Icaza <miguel@gnu.org>
* Federico Mena-Quintero <federico@gimp.org>
* Havoc Pennington <hp@redhat.com>