summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-04-11 07:03:25 +0000
committerFederico Mena Quintero <federico@src.gnome.org>2000-04-11 07:03:25 +0000
commit829ed02435b643c2b3da57dfc1f5abb8124e55cc (patch)
treef0d9b9a6c0c047d93f634bab8d22bced16be3253
parentdaaae930ad946e06f183794ffda8e17c4125b3d4 (diff)
downloadgdk-pixbuf-829ed02435b643c2b3da57dfc1f5abb8124e55cc.tar.gz
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.
-rw-r--r--demos/testanimation.c58
-rw-r--r--demos/testpixbuf-drawable.c24
-rw-r--r--demos/testpixbuf-scale.c34
-rw-r--r--demos/testpixbuf.c37
-rw-r--r--gdk-pixbuf/ChangeLog94
-rw-r--r--gdk-pixbuf/Makefile.am24
-rw-r--r--gdk-pixbuf/gdk-pixbuf-animation.c83
-rw-r--r--gdk-pixbuf/gdk-pixbuf-data.c44
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.c1
-rw-r--r--gdk-pixbuf/gdk-pixbuf-loader.c1
-rw-r--r--gdk-pixbuf/gdk-pixbuf-private.h99
-rw-r--r--gdk-pixbuf/gdk-pixbuf-scale.c147
-rw-r--r--gdk-pixbuf/gdk-pixbuf-util.c51
-rw-r--r--gdk-pixbuf/gdk-pixbuf-xform.c17
-rw-r--r--gdk-pixbuf/gdk-pixbuf.c165
-rw-r--r--gdk-pixbuf/gdk-pixbuf.h174
-rw-r--r--gdk-pixbuf/gnome-canvas-pixbuf.c80
-rw-r--r--gdk-pixbuf/io-bmp.c77
-rw-r--r--gdk-pixbuf/io-gif.c4
-rw-r--r--gdk-pixbuf/io-ico.c67
-rw-r--r--gdk-pixbuf/io-jpeg.c20
-rw-r--r--gdk-pixbuf/io-png.c26
-rw-r--r--gdk-pixbuf/io-pnm.c18
-rw-r--r--gdk-pixbuf/io-ras.c19
-rw-r--r--gdk-pixbuf/io-tiff.c4
-rw-r--r--gdk-pixbuf/io-xpm.c11
-rw-r--r--gdk-pixbuf/pixops/Makefile.am2
-rw-r--r--gdk-pixbuf/pixops/pixops-internal.h6
-rw-r--r--gdk-pixbuf/pixops/pixops.c282
-rw-r--r--gdk-pixbuf/pixops/pixops.h34
-rw-r--r--gdk-pixbuf/pixops/timescale.c26
-rw-r--r--gdk/gdkpixbuf-drawable.c79
-rw-r--r--gdk/gdkpixbuf-render.c105
-rw-r--r--gtk/gdk-pixbuf-loader.c1
34 files changed, 1127 insertions, 787 deletions
diff --git a/demos/testanimation.c b/demos/testanimation.c
index 0663ae2e5..66db24565 100644
--- a/demos/testanimation.c
+++ b/demos/testanimation.c
@@ -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;
diff --git a/demos/testpixbuf-drawable.c b/demos/testpixbuf-drawable.c
index a465aa4c8..c250f2dfb 100644
--- a/demos/testpixbuf-drawable.c
+++ b/demos/testpixbuf-drawable.c
@@ -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);
diff --git a/demos/testpixbuf-scale.c b/demos/testpixbuf-scale.c
index 2efafd6da..a99977fbd 100644
--- a/demos/testpixbuf-scale.c
+++ b/demos/testpixbuf-scale.c
@@ -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);
diff --git a/demos/testpixbuf.c b/demos/testpixbuf.c
index 423d7d330..fe031877f 100644
--- a/demos/testpixbuf.c
+++ b/demos/testpixbuf.c
@@ -1,4 +1,3 @@
-
/* 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);
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 20bb05992..2a1b8607f 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,97 @@
+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
diff --git a/gdk-pixbuf/Makefile.am b/gdk-pixbuf/Makefile.am
index 9e34123b3..64419f792 100644
--- a/gdk-pixbuf/Makefile.am
+++ b/gdk-pixbuf/Makefile.am
@@ -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
diff --git a/gdk-pixbuf/gdk-pixbuf-animation.c b/gdk-pixbuf/gdk-pixbuf-animation.c
index 09e21c459..b2fbbb8f4 100644
--- a/gdk-pixbuf/gdk-pixbuf-animation.c
+++ b/gdk-pixbuf/gdk-pixbuf-animation.c
@@ -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;
+}
diff --git a/gdk-pixbuf/gdk-pixbuf-data.c b/gdk-pixbuf/gdk-pixbuf-data.c
index 247a67e4f..e94aea7da 100644
--- a/gdk-pixbuf/gdk-pixbuf-data.c
+++ b/gdk-pixbuf/gdk-pixbuf-data.c
@@ -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;
}
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 491543a27..cb88dd2de 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -24,6 +24,7 @@
#include <config.h>
#include <string.h>
#include <glib.h>
+#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c
index 777b767d1..5648258aa 100644
--- a/gdk-pixbuf/gdk-pixbuf-loader.c
+++ b/gdk-pixbuf/gdk-pixbuf-loader.c
@@ -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"
diff --git a/gdk-pixbuf/gdk-pixbuf-private.h b/gdk-pixbuf/gdk-pixbuf-private.h
new file mode 100644
index 000000000..278298c23
--- /dev/null
+++ b/gdk-pixbuf/gdk-pixbuf-private.h
@@ -0,0 +1,99 @@
+/* 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>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef GDK_PIXBUF_PRIVATE_H
+#define GDK_PIXBUF_PRIVATE_H
+
+#include "gdk-pixbuf.h"
+
+
+
+/* Private part of the GdkPixbuf structure */
+struct _GdkPixbuf {
+ /* Reference count */
+ int ref_count;
+
+ /* Color space */
+ GdkColorspace colorspace;
+
+ /* Number of channels, alpha included */
+ int n_channels;
+
+ /* Bits per channel */
+ int bits_per_sample;
+
+ /* Size */
+ int width, height;
+
+ /* Offset between rows */
+ int rowstride;
+
+ /* The pixel array */
+ guchar *pixels;
+
+ /* Destroy notification function; it is supposed to free the pixel array */
+ GdkPixbufDestroyNotify destroy_fn;
+
+ /* User data for the destroy notification function */
+ gpointer destroy_fn_data;
+
+ /* Do we have an alpha channel? */
+ guint has_alpha : 1;
+};
+
+/* Private part of the GdkPixbufFrame structure */
+struct _GdkPixbufFrame {
+ /* The pixbuf with this frame's image data */
+ GdkPixbuf *pixbuf;
+
+ /* Offsets for overlaying onto the animation's area */
+ int x_offset;
+ int y_offset;
+
+ /* Frame duration in ms */
+ int delay_time;
+
+ /* Overlay mode */
+ GdkPixbufFrameAction action;
+};
+
+/* Private part of the GdkPixbufAnimation structure */
+struct _GdkPixbufAnimation {
+ /* Reference count */
+ int ref_count;
+
+ /* Number of frames */
+ int n_frames;
+
+ /* List of GdkPixbufFrame structures */
+ GList *frames;
+
+ /* bounding box size */
+ int width, height;
+};
+
+
+
+#endif
diff --git a/gdk-pixbuf/gdk-pixbuf-scale.c b/gdk-pixbuf/gdk-pixbuf-scale.c
index 0f621d1d6..8b5a159e4 100644
--- a/gdk-pixbuf/gdk-pixbuf-scale.c
+++ b/gdk-pixbuf/gdk-pixbuf-scale.c
@@ -1,6 +1,31 @@
-#include "gdk-pixbuf.h"
+/* GdkPixbuf library - Scaling and compositing functions
+ *
+ * Copyright (C) 1999 The Free Software Foundation
+ *
+ * Author: Owen Taylor <otaylor@redhat.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * 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>
+#include <math.h>
+#include "gdk-pixbuf-private.h"
#include "pixops/pixops.h"
-#include "math.h"
+
+
/**
* gdk_pixbuf_scale:
@@ -14,7 +39,7 @@
* @offset_y: the offset in the Y direction (currently rounded to an integer)
* @scale_x: the scale factor in the X direction
* @scale_y: the scale factor in the Y direction
- * @filter_level: the filter quality for the transformation.
+ * @interp_type: the interpolation type for the transformation.
*
* Transforms the image by source image by scaling by @scale_x and @scale_y then
* translating by @offset_x and @offset_y, then renders the rectangle
@@ -32,17 +57,22 @@ gdk_pixbuf_scale (const GdkPixbuf *src,
double offset_y,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level)
+ GdkInterpType interp_type)
{
+ g_return_if_fail (src != NULL);
+ g_return_if_fail (dest != NULL);
+ g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width);
+ g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height);
+
offset_x = floor (offset_x + 0.5);
offset_y = floor (offset_y + 0.5);
- pixops_scale (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
+ pixops_scale (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels,
-offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
- dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
- src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
- src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
- scale_x, scale_y, filter_level);
+ dest->rowstride, dest->n_channels, dest->has_alpha,
+ src->pixels, src->width, src->height,
+ src->rowstride, src->n_channels, src->has_alpha,
+ scale_x, scale_y, interp_type);
}
/**
@@ -57,7 +87,7 @@ gdk_pixbuf_scale (const GdkPixbuf *src,
* @offset_y: the offset in the Y direction (currently rounded to an integer)
* @scale_x: the scale factor in the X direction
* @scale_y: the scale factor in the Y direction
- * @filter_level: the filter quality for the transformation.
+ * @interp_type: the interpolation type for the transformation.
* @overall_alpha: overall alpha for source image (0..255)
*
* Transforms the image by source image by scaling by @scale_x and @scale_y then
@@ -76,17 +106,23 @@ gdk_pixbuf_composite (const GdkPixbuf *src,
double offset_y,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha)
{
+ g_return_if_fail (src != NULL);
+ g_return_if_fail (dest != NULL);
+ g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width);
+ g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height);
+ g_return_if_fail (overall_alpha >= 0 && overall_alpha <= 255);
+
offset_x = floor (offset_x + 0.5);
offset_y = floor (offset_y + 0.5);
- pixops_composite (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
+ pixops_composite (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels,
-offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
- dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
- src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
- src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
- scale_x, scale_y, filter_level, overall_alpha);
+ dest->rowstride, dest->n_channels, dest->has_alpha,
+ src->pixels, src->width, src->height,
+ src->rowstride, src->n_channels, src->has_alpha,
+ scale_x, scale_y, interp_type, overall_alpha);
}
/**
@@ -101,7 +137,7 @@ gdk_pixbuf_composite (const GdkPixbuf *src,
* @offset_y: the offset in the Y direction (currently rounded to an integer)
* @scale_x: the scale factor in the X direction
* @scale_y: the scale factor in the Y direction
- * @filter_level: the filter quality for the transformation.
+ * @interp_type: the interpolation type for the transformation.
* @overall_alpha: overall alpha for source image (0..255)
* @check_x: the X offset for the checkboard (origin of checkboard is at -@check_x, -@check_y)
* @check_y: the Y offset for the checkboard
@@ -126,23 +162,30 @@ gdk_pixbuf_composite_color (const GdkPixbuf *src,
double offset_y,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha,
int check_x,
int check_y,
int check_size,
- art_u32 color1,
- art_u32 color2)
+ guint32 color1,
+ guint32 color2)
{
+ g_return_if_fail (src != NULL);
+ g_return_if_fail (dest != NULL);
+ g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width);
+ g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height);
+ g_return_if_fail (overall_alpha >= 0 && overall_alpha <= 255);
+
offset_x = floor (offset_x + 0.5);
offset_y = floor (offset_y + 0.5);
- pixops_composite_color (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
+ pixops_composite_color (dest->pixels + dest_y * dest->rowstride + dest_x * dest->n_channels,
-offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
- dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
- src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
- src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
- scale_x, scale_y, filter_level, overall_alpha, check_x, check_y, check_size, color1, color2);
+ dest->rowstride, dest->n_channels, dest->has_alpha,
+ src->pixels, src->width, src->height,
+ src->rowstride, src->n_channels, src->has_alpha,
+ scale_x, scale_y, interp_type, overall_alpha, check_x, check_y,
+ check_size, color1, color2);
}
/**
@@ -150,25 +193,34 @@ gdk_pixbuf_composite_color (const GdkPixbuf *src,
* @src: a #GdkPixbuf
* @dest_width: the width of destination image
* @dest_height: the height of destination image
- * @filter_level: the filter quality for the transformation.
+ * @interp_type: the interpolation type for the transformation.
*
* Scale the #GdkPixbuf @src to @dest_width x @dest_height and render the result into
* a new #GdkPixbuf.
*
- * Return value: the new #GdkPixbuf
+ * Return value: the new #GdkPixbuf, or NULL if not enough memory could be
+ * allocated for it.
**/
GdkPixbuf *
gdk_pixbuf_scale_simple (const GdkPixbuf *src,
int dest_width,
int dest_height,
- ArtFilterLevel filter_level)
+ GdkInterpType interp_type)
{
- GdkPixbuf *dest = gdk_pixbuf_new (ART_PIX_RGB, src->art_pixbuf->has_alpha, 8, dest_width, dest_height);
+ GdkPixbuf *dest;
+
+ g_return_val_if_fail (src != NULL, NULL);
+ g_return_val_if_fail (dest_width > 0, NULL);
+ g_return_val_if_fail (dest_height > 0, NULL);
+
+ dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, src->has_alpha, 8, dest_width, dest_height);
+ if (!dest)
+ return NULL;
gdk_pixbuf_scale (src, dest, 0, 0, dest_width, dest_height, 0, 0,
- (double)dest_width / src->art_pixbuf->width,
- (double)dest_height / src->art_pixbuf->height,
- filter_level);
+ (double) dest_width / src->width,
+ (double) dest_height / src->height,
+ interp_type);
return dest;
}
@@ -178,7 +230,7 @@ gdk_pixbuf_scale_simple (const GdkPixbuf *src,
* @src: a #GdkPixbuf
* @dest_width: the width of destination image
* @dest_height: the height of destination image
- * @filter_level: the filter quality for the transformation.
+ * @interp_type: the interpolation type for the transformation.
* @overall_alpha: overall alpha for source image (0..255)
* @check_size: the size of checks in the checkboard (must be a power of two)
* @color1: the color of check at upper left
@@ -188,27 +240,34 @@ gdk_pixbuf_scale_simple (const GdkPixbuf *src,
* a checkboard of colors @color1 and @color2 and render the result into
* a new #GdkPixbuf.
*
- * Return value: the new #GdkPixbuf
+ * Return value: the new #GdkPixbuf, or NULL if not enough memory could be
+ * allocated for it.
**/
GdkPixbuf *
gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
int dest_width,
int dest_height,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha,
int check_size,
- art_u32 color1,
- art_u32 color2)
+ guint32 color1,
+ guint32 color2)
{
- GdkPixbuf *dest = gdk_pixbuf_new (ART_PIX_RGB, src->art_pixbuf->has_alpha, 8, dest_width, dest_height);
+ GdkPixbuf *dest;
+
+ g_return_val_if_fail (src != NULL, NULL);
+ g_return_val_if_fail (dest_width > 0, NULL);
+ g_return_val_if_fail (dest_height > 0, NULL);
+ g_return_val_if_fail (overall_alpha >= 0 && overall_alpha <= 255, NULL);
+
+ dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, src->has_alpha, 8, dest_width, dest_height);
+ if (!dest)
+ return NULL;
gdk_pixbuf_composite_color (src, dest, 0, 0, dest_width, dest_height, 0, 0,
- (double)dest_width / src->art_pixbuf->width,
- (double)dest_height / src->art_pixbuf->height,
- filter_level, overall_alpha, 0, 0, check_size, color1, color2);
+ (double) dest_width / src->width,
+ (double) dest_height / src->height,
+ interp_type, overall_alpha, 0, 0, check_size, color1, color2);
return dest;
}
-
-
-
diff --git a/gdk-pixbuf/gdk-pixbuf-util.c b/gdk-pixbuf/gdk-pixbuf-util.c
index 96a8ca49b..ece50afac 100644
--- a/gdk-pixbuf/gdk-pixbuf-util.c
+++ b/gdk-pixbuf/gdk-pixbuf-util.c
@@ -22,7 +22,7 @@
*/
#include <config.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
@@ -45,42 +45,37 @@
* Return value: A newly-created pixbuf with a reference count of 1.
**/
GdkPixbuf *
-gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color, guchar r, guchar g, guchar b)
+gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf,
+ gboolean substitute_color, guchar r, guchar g, guchar b)
{
- ArtPixBuf *apb;
- ArtPixBuf *new_apb;
GdkPixbuf *new_pixbuf;
int x, y;
g_return_val_if_fail (pixbuf != NULL, NULL);
+ g_return_val_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB, NULL);
+ g_return_val_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4, NULL);
+ g_return_val_if_fail (pixbuf->bits_per_sample == 8, NULL);
- apb = pixbuf->art_pixbuf;
- g_return_val_if_fail (apb->format == ART_PIX_RGB, NULL);
- g_return_val_if_fail (apb->n_channels == 3 || apb->n_channels == 4, NULL);
- g_return_val_if_fail (apb->bits_per_sample == 8, NULL);
-
- if (apb->has_alpha) {
- new_apb = art_pixbuf_duplicate (apb);
- if (!new_apb)
+ if (pixbuf->has_alpha) {
+ new_pixbuf = gdk_pixbuf_copy (pixbuf);
+ if (!new_pixbuf)
return NULL;
- return gdk_pixbuf_new_from_art_pixbuf (new_apb);
+ return new_pixbuf;
}
- new_pixbuf = gdk_pixbuf_new (ART_PIX_RGB, TRUE, 8, apb->width, apb->height);
+ new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf->width, pixbuf->height);
if (!new_pixbuf)
return NULL;
- new_apb = new_pixbuf->art_pixbuf;
-
- for (y = 0; y < apb->height; y++) {
+ for (y = 0; y < pixbuf->height; y++) {
guchar *src, *dest;
guchar tr, tg, tb;
- src = apb->pixels + y * apb->rowstride;
- dest = new_apb->pixels + y * new_apb->rowstride;
+ src = pixbuf->pixels + y * pixbuf->rowstride;
+ dest = new_pixbuf->pixels + y * new_pixbuf->rowstride;
- for (x = 0; x < apb->width; x++) {
+ for (x = 0; x < pixbuf->width; x++) {
tr = *dest++ = *src++;
tg = *dest++ = *src++;
tb = *dest++ = *src++;
@@ -116,20 +111,14 @@ gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
GdkPixbuf *dest_pixbuf,
int dest_x, int dest_y)
{
- const ArtPixBuf *src_apb;
- ArtPixBuf *dest_apb;
-
g_return_if_fail (src_pixbuf != NULL);
g_return_if_fail (dest_pixbuf != NULL);
- src_apb = src_pixbuf->art_pixbuf;
- dest_apb = dest_pixbuf->art_pixbuf;
-
- g_return_if_fail (src_x >= 0 && src_x + width <= src_apb->width);
- g_return_if_fail (src_y >= 0 && src_y + height <= src_apb->height);
+ g_return_if_fail (src_x >= 0 && src_x + width <= src_pixbuf->width);
+ g_return_if_fail (src_y >= 0 && src_y + height <= src_pixbuf->height);
- g_return_if_fail (dest_x >= 0 && dest_x + width <= dest_apb->width);
- g_return_if_fail (dest_y >= 0 && dest_y + height <= dest_apb->height);
+ g_return_if_fail (dest_x >= 0 && dest_x + width <= dest_pixbuf->width);
+ g_return_if_fail (dest_y >= 0 && dest_y + height <= dest_pixbuf->height);
/* This will perform format conversions automatically */
@@ -140,5 +129,5 @@ gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
(double) (dest_x - src_x),
(double) (dest_y - src_y),
1.0, 1.0,
- ART_FILTER_NEAREST);
+ GDK_INTERP_NEAREST);
}
diff --git a/gdk-pixbuf/gdk-pixbuf-xform.c b/gdk-pixbuf/gdk-pixbuf-xform.c
index f118d9234..1ca70cd60 100644
--- a/gdk-pixbuf/gdk-pixbuf-xform.c
+++ b/gdk-pixbuf/gdk-pixbuf-xform.c
@@ -1,7 +1,16 @@
+/* FIXME FIXME FIXME
+ *
+ * This file is not being used. The gdk_pixbuf_scale() here is not useful
+ * anymore, since we have the new functions in gdk-pixbuf-scale.c.
+ *
+ * The rotation function needs to be implemented without libart if it is
+ * to go inside the GdkPixbuf library.
+ */
+
GdkPixbuf *
gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
{
- art_u8 *pixels;
+ guchar *pixels;
gint rowstride;
double affine[6];
ArtAlphaGamma *alphagamma;
@@ -12,10 +21,10 @@ gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
affine[1] = affine[2] = affine[4] = affine[5] = 0;
- affine[0] = w / (double)(pixbuf->art_pixbuf->width);
- affine[3] = h / (double)(pixbuf->art_pixbuf->height);
+ affine[0] = w / (double)(pixbuf->width);
+ affine[3] = h / (double)(pixbuf->height);
- /* rowstride = w * pixbuf->art_pixbuf->n_channels; */
+ /* rowstride = w * pixbuf->n_channels; */
rowstride = w * 3;
pixels = art_alloc (h * rowstride);
diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c
index 1c7162267..be67197bc 100644
--- a/gdk-pixbuf/gdk-pixbuf.c
+++ b/gdk-pixbuf/gdk-pixbuf.c
@@ -24,12 +24,9 @@
#include <config.h>
#include <math.h>
-#include <libart_lgpl/art_misc.h>
-#include <libart_lgpl/art_affine.h>
-#include <libart_lgpl/art_pixbuf.h>
-#include <libart_lgpl/art_rgb_pixbuf_affine.h>
-#include <libart_lgpl/art_alphagamma.h>
+#include <stdlib.h>
#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
@@ -58,7 +55,7 @@ gdk_pixbuf_ref (GdkPixbuf *pixbuf)
* gdk_pixbuf_unref:
* @pixbuf: A pixbuf.
*
- * Removes a reference from a pixbuf. It will be destroyed when the reference
+ * Removes a reference from a pixbuf, which will be destroyed when the reference
* count drops to zero.
**/
void
@@ -70,53 +67,25 @@ gdk_pixbuf_unref (GdkPixbuf *pixbuf)
pixbuf->ref_count--;
if (pixbuf->ref_count == 0) {
- art_pixbuf_free (pixbuf->art_pixbuf);
- pixbuf->art_pixbuf = NULL;
+ if (pixbuf->destroy_fn)
+ (* pixbuf->destroy_fn) (pixbuf->pixels, pixbuf->destroy_fn_data);
+
g_free (pixbuf);
}
}
-/* Wrap a libart pixbuf */
-
-/**
- * gdk_pixbuf_new_from_art_pixbuf:
- * @art_pixbuf: A libart pixbuf.
- *
- * Creates a #GdkPixbuf by wrapping a libart pixbuf.
- *
- * Return value: A newly-created #GdkPixbuf structure with a reference count of
- * 1.
- **/
-GdkPixbuf *
-gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf)
-{
- GdkPixbuf *pixbuf;
-
- g_return_val_if_fail (art_pixbuf != NULL, NULL);
-
- pixbuf = g_new (GdkPixbuf, 1);
- pixbuf->ref_count = 1;
- pixbuf->art_pixbuf = art_pixbuf;
-
- return pixbuf;
-}
-
-/* Destroy notification function for gdk_pixbuf_new() */
+/* Used as the destroy notification function for gdk_pixbuf_new() */
static void
-free_buffer (gpointer user_data, gpointer data)
+free_buffer (guchar *pixels, gpointer data)
{
- free (data);
+ free (pixels);
}
-
-
-/* Create an empty pixbuf */
-
/**
* gdk_pixbuf_new:
- * @format: Image format.
+ * @colorspace: Color space for image.
* @has_alpha: Whether the image should have transparency information.
* @bits_per_sample: Number of bits per color sample.
* @width: Width of image in pixels.
@@ -124,20 +93,20 @@ free_buffer (gpointer user_data, gpointer data)
*
* Creates a new #GdkPixbuf structure and allocates a buffer for it. The buffer
* has an optimal rowstride. Note that the buffer is not cleared; you will have
- * to fill it completely.
+ * to fill it completely yourself.
*
* Return value: A newly-created #GdkPixbuf with a reference count of 1, or NULL
* if not enough memory could be allocated for the image buffer.
**/
GdkPixbuf *
-gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
+gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
int width, int height)
{
guchar *buf;
int channels;
int rowstride;
- 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);
@@ -151,29 +120,70 @@ gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
if (!buf)
return NULL;
- return gdk_pixbuf_new_from_data (buf, format, has_alpha, width, height, rowstride,
+ return gdk_pixbuf_new_from_data (buf, colorspace, has_alpha, bits_per_sample,
+ width, height, rowstride,
free_buffer, NULL);
}
+/**
+ * gdk_pixbuf_copy:
+ * @pixbuf: A pixbuf.
+ *
+ * Creates a new #GdkPixbuf with a copy of the information in the specified
+ * @pixbuf.
+ *
+ * Return value: A newly-created pixbuf with a reference count of 1, or NULL if
+ * not enough memory could be allocated.
+ **/
+GdkPixbuf *
+gdk_pixbuf_copy (const GdkPixbuf *pixbuf)
+{
+ guchar *buf;
+ int size;
+
+ g_return_val_if_fail (pixbuf != NULL, NULL);
+
+ /* Calculate a semi-exact size. Here we copy with full rowstrides;
+ * maybe we should copy each row individually with the minimum
+ * rowstride?
+ */
+
+ size = ((pixbuf->height - 1) * pixbuf->rowstride +
+ pixbuf->width * ((pixbuf->n_channels * pixbuf->bits_per_sample + 7) / 8));
+
+ buf = malloc (size * sizeof (guchar));
+ if (!buf)
+ return NULL;
+
+ memcpy (buf, pixbuf->pixels, size);
+
+ return gdk_pixbuf_new_from_data (buf,
+ pixbuf->colorspace, pixbuf->has_alpha,
+ pixbuf->bits_per_sample,
+ pixbuf->width, pixbuf->height,
+ pixbuf->rowstride,
+ free_buffer,
+ NULL);
+}
+
-/* Convenience functions */
+/* Accessors */
/**
- * gdk_pixbuf_get_format:
+ * gdk_pixbuf_get_colorspace:
* @pixbuf: A pixbuf.
*
- * Queries the image format (color model) of a pixbuf.
+ * Queries the color space of a pixbuf.
*
- * Return value: Image format.
+ * Return value: Color space.
**/
-ArtPixFormat
-gdk_pixbuf_get_format (GdkPixbuf *pixbuf)
+GdkColorspace
+gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf)
{
- g_return_val_if_fail (pixbuf != NULL, ART_PIX_RGB);
- g_assert (pixbuf->art_pixbuf != NULL);
+ g_return_val_if_fail (pixbuf != NULL, GDK_COLORSPACE_RGB);
- return pixbuf->art_pixbuf->format;
+ return pixbuf->colorspace;
}
/**
@@ -185,12 +195,11 @@ gdk_pixbuf_get_format (GdkPixbuf *pixbuf)
* Return value: Number of channels.
**/
int
-gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf)
+gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf)
{
g_return_val_if_fail (pixbuf != NULL, -1);
- g_assert (pixbuf->art_pixbuf != NULL);
- return pixbuf->art_pixbuf->n_channels;
+ return pixbuf->n_channels;
}
/**
@@ -202,12 +211,11 @@ gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf)
* Return value: TRUE if it has an alpha channel, FALSE otherwise.
**/
gboolean
-gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf)
+gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf)
{
g_return_val_if_fail (pixbuf != NULL, -1);
- g_assert (pixbuf->art_pixbuf != NULL);
- return pixbuf->art_pixbuf->has_alpha;
+ return pixbuf->has_alpha ? TRUE : FALSE;
}
/**
@@ -219,12 +227,11 @@ gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf)
* Return value: Number of bits per color sample.
**/
int
-gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf)
+gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf)
{
g_return_val_if_fail (pixbuf != NULL, -1);
- g_assert (pixbuf->art_pixbuf != NULL);
- return pixbuf->art_pixbuf->bits_per_sample;
+ return pixbuf->bits_per_sample;
}
/**
@@ -236,12 +243,11 @@ gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf)
* Return value: A pointer to the pixbuf's pixel data.
**/
guchar *
-gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf)
+gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf)
{
g_return_val_if_fail (pixbuf != NULL, NULL);
- g_assert (pixbuf->art_pixbuf != NULL);
- return pixbuf->art_pixbuf->pixels;
+ return pixbuf->pixels;
}
/**
@@ -253,12 +259,11 @@ gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf)
* Return value: Width in pixels.
**/
int
-gdk_pixbuf_get_width (GdkPixbuf *pixbuf)
+gdk_pixbuf_get_width (const GdkPixbuf *pixbuf)
{
g_return_val_if_fail (pixbuf != NULL, -1);
- g_assert (pixbuf->art_pixbuf != NULL);
- return pixbuf->art_pixbuf->width;
+ return pixbuf->width;
}
/**
@@ -270,46 +275,44 @@ gdk_pixbuf_get_width (GdkPixbuf *pixbuf)
* Return value: Height in pixels.
**/
int
-gdk_pixbuf_get_height (GdkPixbuf *pixbuf)
+gdk_pixbuf_get_height (const GdkPixbuf *pixbuf)
{
g_return_val_if_fail (pixbuf != NULL, -1);
- g_assert (pixbuf->art_pixbuf != NULL);
- return pixbuf->art_pixbuf->height;
+ return pixbuf->height;
}
/**
* gdk_pixbuf_get_rowstride:
* @pixbuf: A pixbuf.
*
- * Queries the rowstride of a pixbuf, or the number of bytes between rows.
+ * Queries the rowstride of a pixbuf, which is the number of bytes between rows.
*
* Return value: Number of bytes between rows.
**/
int
-gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf)
+gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf)
{
g_return_val_if_fail (pixbuf != NULL, -1);
- g_assert (pixbuf->art_pixbuf != NULL);
- return pixbuf->art_pixbuf->rowstride;
+ return pixbuf->rowstride;
}
/* General initialization hooks */
-const guint gdk_pixbuf_major_version=GDK_PIXBUF_MAJOR,
- gdk_pixbuf_minor_version=GDK_PIXBUF_MINOR,
- gdk_pixbuf_micro_version=GDK_PIXBUF_MICRO;
+const guint gdk_pixbuf_major_version = GDK_PIXBUF_MAJOR;
+const guint gdk_pixbuf_minor_version = GDK_PIXBUF_MINOR;
+const guint gdk_pixbuf_micro_version = GDK_PIXBUF_MICRO;
const char *gdk_pixbuf_version = GDK_PIXBUF_VERSION;
void
-gdk_pixbuf_preinit(gpointer app, gpointer modinfo)
+gdk_pixbuf_preinit (gpointer app, gpointer modinfo)
{
}
void
-gdk_pixbuf_postinit(gpointer app, gpointer modinfo)
+gdk_pixbuf_postinit (gpointer app, gpointer modinfo)
{
}
diff --git a/gdk-pixbuf/gdk-pixbuf.h b/gdk-pixbuf/gdk-pixbuf.h
index aca5ab36b..5b82e086b 100644
--- a/gdk-pixbuf/gdk-pixbuf.h
+++ b/gdk-pixbuf/gdk-pixbuf.h
@@ -5,6 +5,7 @@
* Authors: Mark Crichton <crichton@gimp.org>
* Miguel de Icaza <miguel@gnu.org>
* Federico Mena-Quintero <federico@gimp.org>
+ * Havoc Pennington <hp@redhat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -25,9 +26,6 @@
#ifndef GDK_PIXBUF_H
#define GDK_PIXBUF_H
-#include <libart_lgpl/art_misc.h>
-#include <libart_lgpl/art_pixbuf.h>
-#include <libart_lgpl/art_filterlevel.h>
#include <gdk/gdk.h>
#ifdef __cplusplus
@@ -36,98 +34,76 @@ extern "C" {
#include <gdk-pixbuf/gdk-pixbuf-features.h>
-/* GdkPixbuf structures */
-typedef struct _GdkPixbuf GdkPixbuf;
-typedef struct _GdkPixbufFrame GdkPixbufFrame;
-typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
-
-struct _GdkPixbuf {
- /* Reference count */
- int ref_count;
-
- /* Libart pixbuf */
- ArtPixBuf *art_pixbuf;
-};
+
-/* GIF-like animation overlay modes for frames */
+/* Color spaces; right now only RGB is supported */
typedef enum {
- GDK_PIXBUF_FRAME_RETAIN,
- GDK_PIXBUF_FRAME_DISPOSE,
- GDK_PIXBUF_FRAME_REVERT
-} GdkPixbufFrameAction;
-
-struct _GdkPixbufFrame {
- /* The pixbuf with this frame's image data */
- GdkPixbuf *pixbuf;
-
- /* Offsets for overlaying onto the animation's area */
- int x_offset;
- int y_offset;
-
- /* Frame duration in ms */
- int delay_time;
-
- /* Overlay mode */
- GdkPixbufFrameAction action;
-};
-
-struct _GdkPixbufAnimation {
- /* Reference count */
- int ref_count;
+ GDK_COLORSPACE_RGB
+} GdkColorspace;
- /* Number of frames */
- int n_frames;
-
- /* List of GdkPixbufFrame structures */
- GList *frames;
+/* All of these are opaque structures */
+typedef struct _GdkPixbuf GdkPixbuf;
+typedef struct _GdkPixbufFrame GdkPixbufFrame;
+typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
- /* bounding box size */
- int width, height;
-};
+typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data);
-/* Convenience functions */
-
-ArtPixFormat gdk_pixbuf_get_format (GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_n_channels (GdkPixbuf *pixbuf);
-gboolean gdk_pixbuf_get_has_alpha (GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_bits_per_sample (GdkPixbuf *pixbuf);
-guchar *gdk_pixbuf_get_pixels (GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_width (GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_height (GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_rowstride (GdkPixbuf *pixbuf);
-
/* Reference counting */
GdkPixbuf *gdk_pixbuf_ref (GdkPixbuf *pixbuf);
void gdk_pixbuf_unref (GdkPixbuf *pixbuf);
-/* Wrap a libart pixbuf */
-GdkPixbuf *gdk_pixbuf_new_from_art_pixbuf (ArtPixBuf *art_pixbuf);
+/* GdkPixbuf accessors */
+
+GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
+int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
+gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
+int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
+guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
+int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
+int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
+int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
+
+
/* Create a blank pixbuf with an optimal rowstride and a new buffer */
-GdkPixbuf *gdk_pixbuf_new (ArtPixFormat format, gboolean has_alpha, int bits_per_sample,
+GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
int width, int height);
+/* Copy a pixbuf */
+
+GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
+
/* Simple loading */
GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename);
GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
- ArtPixFormat format,
+ GdkColorspace colorspace,
gboolean has_alpha,
+ int bits_per_sample,
int width, int height,
int rowstride,
- ArtDestroyNotify dfunc,
- gpointer dfunc_data);
+ GdkPixbufDestroyNotify destroy_fn,
+ gpointer destroy_fn_data);
GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
/* Adding an alpha channel */
-GdkPixbuf *gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color,
+GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color,
guchar r, guchar g, guchar b);
+/* Copy an area of a pixbuf onto another one */
+void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
+ int src_x, int src_y,
+ int width, int height,
+ GdkPixbuf *dest_pixbuf,
+ int dest_x, int dest_y);
+
+
+
/* Rendering to a drawable */
/* Alpha compositing mode */
@@ -159,26 +135,29 @@ void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawab
GdkRgbDither dither,
int x_dither, int y_dither);
-void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
- GdkPixmap **pixmap_return, GdkBitmap **mask_return,
- int alpha_threshold);
+void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
+ GdkPixmap **pixmap_return, GdkBitmap **mask_return,
+ int alpha_threshold);
/* Fetching a region from a drawable */
-GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
- GdkDrawable *src, GdkColormap *cmap,
- int src_x, int src_y,
- int dest_x, int dest_y,
- int width, int height);
+GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
+ GdkDrawable *src, GdkColormap *cmap,
+ int src_x, int src_y,
+ int dest_x, int dest_y,
+ int width, int height);
-/* Copy an area of a pixbuf onto another one */
-void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
- int src_x, int src_y,
- int width, int height,
- GdkPixbuf *dest_pixbuf,
- int dest_x, int dest_y);
+
/* Scaling */
+/* Interpolation modes */
+typedef enum {
+ GDK_INTERP_NEAREST,
+ GDK_INTERP_TILES,
+ GDK_INTERP_BILINEAR,
+ GDK_INTERP_HYPER
+} GdkInterpType;
+
void gdk_pixbuf_scale (const GdkPixbuf *src,
GdkPixbuf *dest,
int dest_x,
@@ -189,7 +168,7 @@ void gdk_pixbuf_scale (const GdkPixbuf *src,
double offset_y,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level);
+ GdkInterpType interp_type);
void gdk_pixbuf_composite (const GdkPixbuf *src,
GdkPixbuf *dest,
int dest_x,
@@ -200,7 +179,7 @@ void gdk_pixbuf_composite (const GdkPixbuf *src,
double offset_y,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha);
void gdk_pixbuf_composite_color (const GdkPixbuf *src,
GdkPixbuf *dest,
@@ -212,29 +191,39 @@ void gdk_pixbuf_composite_color (const GdkPixbuf *src,
double offset_y,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha,
int check_x,
int check_y,
int check_size,
- art_u32 color1,
- art_u32 color2);
+ guint32 color1,
+ guint32 color2);
GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
int dest_width,
int dest_height,
- ArtFilterLevel filter_level);
+ GdkInterpType interp_type);
+
GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
int dest_width,
int dest_height,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha,
int check_size,
- art_u32 color1,
- art_u32 color2);
+ guint32 color1,
+ guint32 color2);
+
+
/* Animation support */
+/* GIF-like animation overlay modes for frames */
+typedef enum {
+ GDK_PIXBUF_FRAME_RETAIN,
+ GDK_PIXBUF_FRAME_DISPOSE,
+ GDK_PIXBUF_FRAME_REVERT
+} GdkPixbufFrameAction;
+
GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename);
GdkPixbufAnimation *gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation);
@@ -245,6 +234,15 @@ int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *an
GList *gdk_pixbuf_animation_get_frames (GdkPixbufAnimation *animation);
int gdk_pixbuf_animation_get_num_frames (GdkPixbufAnimation *animation);
+/* Frame accessors */
+
+GdkPixbuf *gdk_pixbuf_frame_get_pixbuf (GdkPixbufFrame *frame);
+int gdk_pixbuf_frame_get_x_offset (GdkPixbufFrame *frame);
+int gdk_pixbuf_frame_get_y_offset (GdkPixbufFrame *frame);
+int gdk_pixbuf_frame_get_delay_time (GdkPixbufFrame *frame);
+GdkPixbufFrameAction gdk_pixbuf_frame_get_action (GdkPixbufFrame *frame);
+
+
/* General (presently empty) initialization hooks, primarily for gnome-libs */
void gdk_pixbuf_preinit (gpointer app, gpointer modinfo);
void gdk_pixbuf_postinit (gpointer app, gpointer modinfo);
diff --git a/gdk-pixbuf/gnome-canvas-pixbuf.c b/gdk-pixbuf/gnome-canvas-pixbuf.c
index e9410558e..ed6368ad5 100644
--- a/gdk-pixbuf/gnome-canvas-pixbuf.c
+++ b/gdk-pixbuf/gnome-canvas-pixbuf.c
@@ -24,8 +24,9 @@
#include <math.h>
#include <libgnomeui/gnome-canvas.h>
#include <libgnomeui/gnome-canvas-util.h>
-#include "gdk-pixbuf.h"
-#include <libart_lgpl/art_rgb_pixbuf_affine.h>
+#include <libart_lgpl/art_rgb_affine.h>
+#include <libart_lgpl/art_rgb_rgba_affine.h>
+#include "gdk-pixbuf-private.h"
#include "gnome-canvas-pixbuf.h"
@@ -242,10 +243,9 @@ gnome_canvas_pixbuf_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
pixbuf = GTK_VALUE_POINTER (*arg);
if (pixbuf != priv->pixbuf) {
if (pixbuf) {
- g_return_if_fail (pixbuf->art_pixbuf->format == ART_PIX_RGB);
- g_return_if_fail (pixbuf->art_pixbuf->n_channels == 3
- || pixbuf->art_pixbuf->n_channels == 4);
- g_return_if_fail (pixbuf->art_pixbuf->bits_per_sample == 8);
+ g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
+ g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
+ g_return_if_fail (pixbuf->bits_per_sample == 8);
gdk_pixbuf_ref (pixbuf);
}
@@ -451,12 +451,12 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double
if (priv->width_set)
w = priv->width;
else
- w = priv->pixbuf->art_pixbuf->width;
+ w = priv->pixbuf->width;
if (priv->height_set)
h = priv->height;
else
- h = priv->pixbuf->art_pixbuf->height;
+ h = priv->pixbuf->height;
/* Convert i_len and j_len into scaling factors */
@@ -468,7 +468,7 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double
} else
si_len = 1.0;
- si_len *= w / priv->pixbuf->art_pixbuf->width;
+ si_len *= w / priv->pixbuf->width;
if (priv->height_in_pixels) {
if (j_len > GNOME_CANVAS_EPSILON)
@@ -478,7 +478,7 @@ compute_viewport_affine (GnomeCanvasPixbuf *gcp, double *viewport_affine, double
} else
sj_len = 1.0;
- sj_len *= h / priv->pixbuf->art_pixbuf->height;
+ sj_len *= h / priv->pixbuf->height;
/* Calculate translation offsets */
@@ -544,10 +544,10 @@ recompute_bounding_box (GnomeCanvasPixbuf *gcp)
}
rect.x0 = 0.0;
- rect.x1 = priv->pixbuf->art_pixbuf->width;
+ rect.x1 = priv->pixbuf->width;
rect.y0 = 0.0;
- rect.y1 = priv->pixbuf->art_pixbuf->height;
+ rect.y1 = priv->pixbuf->height;
gnome_canvas_item_i2c_affine (item, i2c);
compute_render_affine (gcp, render_affine, i2c);
@@ -611,7 +611,6 @@ static void
transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstride,
GdkPixbuf *pixbuf, double *affine)
{
- ArtPixBuf *apb;
int xx, yy;
double inv[6];
guchar *src, *d;
@@ -620,8 +619,6 @@ transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstri
int src_x, src_y;
int i;
- apb = pixbuf->art_pixbuf;
-
art_affine_invert (inv, affine);
for (yy = 0; yy < height; yy++) {
@@ -630,7 +627,7 @@ transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstri
run_x1 = x;
run_x2 = x + width;
art_rgb_affine_run (&run_x1, &run_x2, yy + y,
- apb->width, apb->height,
+ pixbuf->width, pixbuf->height,
inv);
d = dest + yy * rowstride + (run_x1 - x) * 4;
@@ -641,12 +638,12 @@ transform_pixbuf (guchar *dest, int x, int y, int width, int height, int rowstri
src_x = floor (src_p.x);
src_y = floor (src_p.y);
- src = apb->pixels + src_y * apb->rowstride + src_x * apb->n_channels;
+ src = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * pixbuf->n_channels;
- for (i = 0; i < apb->n_channels; i++)
+ for (i = 0; i < pixbuf->n_channels; i++)
*d++ = *src++;
- if (!apb->has_alpha)
+ if (!pixbuf->has_alpha)
*d++ = 255; /* opaque */
}
}
@@ -702,7 +699,7 @@ gnome_canvas_pixbuf_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
w * 4,
priv->pixbuf, render_affine);
- pixbuf = gdk_pixbuf_new_from_data (buf, ART_PIX_RGB, TRUE, w, h, w * 4, NULL, NULL);
+ pixbuf = gdk_pixbuf_new_from_data (buf, GDK_COLORSPACE_RGB, TRUE, 8, w, h, w * 4, NULL, NULL);
gdk_pixbuf_render_to_drawable_alpha (pixbuf, drawable,
0, 0,
@@ -735,14 +732,28 @@ gnome_canvas_pixbuf_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
compute_render_affine (gcp, render_affine, i2c);
gnome_canvas_buf_ensure_buf (buf);
- art_rgb_pixbuf_affine (buf->buf,
- buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1,
- buf->buf_rowstride,
- priv->pixbuf->art_pixbuf,
- render_affine,
- ART_FILTER_NEAREST, NULL);
-
- buf->is_bg = 0;
+ if (priv->pixbuf->has_alpha)
+ art_rgb_rgba_affine (buf->buf,
+ buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1,
+ buf->buf_rowstride,
+ priv->pixbuf->pixels,
+ priv->pixbuf->width, priv->pixbuf->height,
+ priv->pixbuf->rowstride,
+ render_affine,
+ ART_FILTER_NEAREST,
+ NULL);
+ else
+ art_rgb_affine (buf->buf,
+ buf->rect.x0, buf->rect.y0, buf->rect.x1, buf->rect.y1,
+ buf->buf_rowstride,
+ priv->pixbuf->pixels,
+ priv->pixbuf->width, priv->pixbuf->height,
+ priv->pixbuf->rowstride,
+ render_affine,
+ ART_FILTER_NEAREST,
+ NULL);
+
+ buf->is_bg = FALSE;
}
@@ -758,7 +769,6 @@ gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, in
ArtPoint c, p;
int px, py;
double no_hit;
- ArtPixBuf *apb;
guchar *src;
gcp = GNOME_CANVAS_PIXBUF (item);
@@ -771,8 +781,6 @@ gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, in
if (!priv->pixbuf)
return no_hit;
- apb = priv->pixbuf->art_pixbuf;
-
gnome_canvas_item_i2c_affine (item, i2c);
compute_render_affine (gcp, render_affine, i2c);
art_affine_invert (inv, render_affine);
@@ -783,13 +791,13 @@ gnome_canvas_pixbuf_point (GnomeCanvasItem *item, double x, double y, int cx, in
px = p.x;
py = p.y;
- if (px < 0 || px >= apb->width || py < 0 || py >= apb->height)
+ if (px < 0 || px >= priv->pixbuf->width || py < 0 || py >= priv->pixbuf->height)
return no_hit;
- if (!apb->has_alpha)
+ if (!priv->pixbuf->has_alpha)
return 0.0;
- src = apb->pixels + py * apb->rowstride + px * apb->n_channels;
+ src = priv->pixbuf->pixels + py * priv->pixbuf->rowstride + px * priv->pixbuf->n_channels;
if (src[3] < 128)
return no_hit;
@@ -817,10 +825,10 @@ gnome_canvas_pixbuf_bounds (GnomeCanvasItem *item, double *x1, double *y1, doubl
}
rect.x0 = 0.0;
- rect.x1 = priv->pixbuf->art_pixbuf->width;
+ rect.x1 = priv->pixbuf->width;
rect.y0 = 0.0;
- rect.y1 = priv->pixbuf->art_pixbuf->height;
+ rect.y1 = priv->pixbuf->height;
gnome_canvas_item_i2c_affine (item, i2c);
compute_viewport_affine (gcp, viewport_affine, i2c);
diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c
index 2aa4fb4f3..cf451241d 100644
--- a/gdk-pixbuf/io-bmp.c
+++ b/gdk-pixbuf/io-bmp.c
@@ -35,12 +35,10 @@ Known bugs:
#include <stdio.h>
#include <unistd.h>
#include <string.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk-pixbuf/gdk-pixbuf-io.h>
-
-
-
+#include "gdk-pixbuf-private.h"
+#include "gdk-pixbuf-io.h"
+
/*
@@ -287,12 +285,12 @@ static void DecodeHeader(unsigned char *BFH, unsigned char *BIH,
if (State->pixbuf == NULL) {
if (State->Type == 32)
State->pixbuf =
- gdk_pixbuf_new(ART_PIX_RGB, TRUE, 8,
+ gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
(gint) State->Header.width,
(gint) State->Header.height);
else
State->pixbuf =
- gdk_pixbuf_new(ART_PIX_RGB, FALSE, 8,
+ gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
(gint) State->Header.width,
(gint) State->Header.height);
@@ -387,14 +385,13 @@ static void OneLine32(struct bmp_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Header.height - context->Lines - 1));
else
- Pixels =
- context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- context->Lines;
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ context->Lines);
while (X < context->Header.width) {
Pixels[X * 4 + 0] = context->LineBuf[X * 4 + 2];
Pixels[X * 4 + 1] = context->LineBuf[X * 4 + 1];
@@ -412,14 +409,13 @@ static void OneLine24(struct bmp_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Header.height - context->Lines - 1));
else
- Pixels =
- context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- context->Lines;
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ context->Lines);
while (X < context->Header.width) {
Pixels[X * 3 + 0] = context->LineBuf[X * 3 + 2];
Pixels[X * 3 + 1] = context->LineBuf[X * 3 + 1];
@@ -436,14 +432,13 @@ static void OneLine8(struct bmp_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Header.height - context->Lines - 1));
else
- Pixels =
- context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- context->Lines;
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ context->Lines);
while (X < context->Header.width) {
Pixels[X * 3 + 0] =
context->HeaderBuf[4 * context->LineBuf[X] + 56];
@@ -462,14 +457,13 @@ static void OneLine4(struct bmp_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Header.height - context->Lines - 1));
else
- Pixels =
- context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- context->Lines;
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ context->Lines);
while (X < context->Header.width) {
guchar Pix;
@@ -504,14 +498,13 @@ static void OneLine1(struct bmp_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Header.height - context->Lines - 1));
else
- Pixels =
- context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- context->Lines;
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ context->Lines);
while (X < context->Header.width) {
gint Bit;
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index 926871a3d..4f3bc8878 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -59,7 +59,7 @@
#include <config.h>
#include <stdio.h>
#include <string.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
@@ -666,7 +666,7 @@ gif_get_lzw (GifContext *context)
gint v;
if (context->pixbuf == NULL) {
- context->pixbuf = gdk_pixbuf_new (ART_PIX_RGB,
+ context->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
context->gif89.transparent != -1,
8,
context->frame_len,
diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c
index 4cb699576..aa78665c7 100644
--- a/gdk-pixbuf/io-ico.c
+++ b/gdk-pixbuf/io-ico.c
@@ -37,11 +37,10 @@ Known bugs:
#include <stdio.h>
#include <unistd.h>
#include <string.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
-
-
+
/*
@@ -345,7 +344,7 @@ static void DecodeHeader(guchar *Data, gint Bytes,
if (State->pixbuf == NULL) {
State->pixbuf =
- gdk_pixbuf_new(ART_PIX_RGB, TRUE, 8,
+ gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
(gint) State->Header.width,
(gint) State->Header.height);
@@ -433,13 +432,13 @@ static void OneLine24(struct ico_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Header.height - context->Lines - 1));
else
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- context->Lines;
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ context->Lines);
while (X < context->Header.width) {
Pixels[X * 4 + 0] = context->LineBuf[X * 3 + 2];
Pixels[X * 4 + 1] = context->LineBuf[X * 3 + 1];
@@ -456,13 +455,13 @@ static void OneLine8(struct ico_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Header.height - context->Lines - 1));
else
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- context->Lines;
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ context->Lines);
while (X < context->Header.width) {
/* The joys of having a BGR byteorder */
Pixels[X * 4 + 0] =
@@ -481,13 +480,13 @@ static void OneLine4(struct ico_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Header.height - context->Lines - 1));
else
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- context->Lines;
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ context->Lines);
while (X < context->Header.width) {
guchar Pix;
@@ -522,13 +521,13 @@ static void OneLine1(struct ico_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Header.height - context->Lines - 1));
else
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- context->Lines;
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ context->Lines);
while (X < context->Header.width) {
int Bit;
@@ -549,13 +548,13 @@ static void OneLineTransp(struct ico_progressive_state *context)
X = 0;
if (context->Header.Negative == 0)
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (2*context->Header.height - context->Lines - 1);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (2*context->Header.height - context->Lines - 1));
else
- Pixels = context->pixbuf->art_pixbuf->pixels +
- gdk_pixbuf_get_rowstride(context->pixbuf) *
- (context->Lines-context->Header.height);
+ Pixels = (context->pixbuf->pixels +
+ context->pixbuf->rowstride *
+ (context->Lines-context->Header.height));
while (X < context->Header.width) {
int Bit;
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
index 0845a3dc3..0a2126925 100644
--- a/gdk-pixbuf/io-jpeg.c
+++ b/gdk-pixbuf/io-jpeg.c
@@ -47,7 +47,7 @@
#include <string.h>
#include <setjmp.h>
#include <jpeglib.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
@@ -111,11 +111,11 @@ fatal_error_handler (j_common_ptr cinfo)
return;
}
-/* Destroy notification function for the libart pixbuf */
+/* Destroy notification function for the pixbuf */
static void
-free_buffer (gpointer user_data, gpointer data)
+free_buffer (guchar *pixels, gpointer data)
{
- free (data);
+ free (pixels);
}
@@ -215,7 +215,7 @@ gdk_pixbuf__jpeg_image_load (FILE *f)
jpeg_finish_decompress (&cinfo);
jpeg_destroy_decompress (&cinfo);
- return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, FALSE,
+ return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, FALSE, 8,
w, h, w * 3,
free_buffer, NULL);
}
@@ -451,8 +451,8 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data, guchar *buf, guint size)
return FALSE;
}
#endif
- context->pixbuf = gdk_pixbuf_new(ART_PIX_RGB,
- /*have_alpha*/ FALSE,
+ context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
+ FALSE,
8,
cinfo->image_width,
cinfo->image_height);
@@ -463,7 +463,7 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data, guchar *buf, guint size)
}
/* Use pixbuf buffer to store decompressed data */
- context->dptr = context->pixbuf->art_pixbuf->pixels;
+ context->dptr = context->pixbuf->pixels;
/* Notify the client that we are ready to go */
(* context->prepared_func) (context->pixbuf,
@@ -497,7 +497,7 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data, guchar *buf, guint size)
rowptr = context->dptr;
for (i=0; i < cinfo->rec_outbuf_height; i++) {
*lptr++ = rowptr;
- rowptr += context->pixbuf->art_pixbuf->rowstride;
+ rowptr += context->pixbuf->rowstride;
}
nlines = jpeg_read_scanlines (cinfo, lines,
@@ -509,7 +509,7 @@ gdk_pixbuf__jpeg_image_load_increment (gpointer data, guchar *buf, guint size)
if (cinfo->output_components == 1)
explode_gray_into_buf (cinfo, lines);
- context->dptr += nlines * context->pixbuf->art_pixbuf->rowstride;
+ context->dptr += nlines * context->pixbuf->rowstride;
/* send updated signal */
(* context->updated_func) (context->pixbuf,
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c
index 3ad9bb3fd..451419484 100644
--- a/gdk-pixbuf/io-png.c
+++ b/gdk-pixbuf/io-png.c
@@ -24,8 +24,9 @@
#include <config.h>
#include <stdio.h>
+#include <stdlib.h>
#include <png.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
@@ -139,11 +140,11 @@ setup_png_transformations(png_structp png_read_ptr, png_infop png_info_ptr,
#endif
}
-/* Destroy notification function for the libart pixbuf */
+/* Destroy notification function for the pixbuf */
static void
-free_buffer (gpointer user_data, gpointer data)
+free_buffer (guchar *pixels, gpointer data)
{
- free (data);
+ free (pixels);
}
/* Shared library entry point */
@@ -210,11 +211,11 @@ gdk_pixbuf__png_image_load (FILE *f)
g_free (rows);
if (ctype & PNG_COLOR_MASK_ALPHA)
- return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, TRUE,
+ return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8,
w, h, w * 4,
free_buffer, NULL);
else
- return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, FALSE,
+ return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, FALSE, 8,
w, h, w * 3,
free_buffer, NULL);
}
@@ -371,7 +372,7 @@ gdk_pixbuf__png_image_load_increment(gpointer context, guchar *buf, guint size)
/* start and end row were in the same pass */
(lc->update_func)(lc->pixbuf, 0,
lc->first_row_seen_in_chunk,
- lc->pixbuf->art_pixbuf->width,
+ lc->pixbuf->width,
(lc->last_row_seen_in_chunk -
lc->first_row_seen_in_chunk) + 1,
lc->notify_user_data);
@@ -383,14 +384,14 @@ gdk_pixbuf__png_image_load_increment(gpointer context, guchar *buf, guint size)
/* first row to end */
(lc->update_func)(lc->pixbuf, 0,
lc->first_row_seen_in_chunk,
- lc->pixbuf->art_pixbuf->width,
+ lc->pixbuf->width,
(lc->max_row_seen_in_chunk -
lc->first_row_seen_in_chunk) + 1,
lc->notify_user_data);
/* top to last row */
(lc->update_func)(lc->pixbuf,
0, 0,
- lc->pixbuf->art_pixbuf->width,
+ lc->pixbuf->width,
lc->last_row_seen_in_chunk + 1,
lc->notify_user_data);
} else {
@@ -398,7 +399,7 @@ gdk_pixbuf__png_image_load_increment(gpointer context, guchar *buf, guint size)
whole image */
(lc->update_func)(lc->pixbuf,
0, 0,
- lc->pixbuf->art_pixbuf->width,
+ lc->pixbuf->width,
lc->max_row_seen_in_chunk + 1,
lc->notify_user_data);
}
@@ -439,7 +440,7 @@ png_info_callback (png_structp png_read_ptr,
if (color_type & PNG_COLOR_MASK_ALPHA)
have_alpha = TRUE;
- lc->pixbuf = gdk_pixbuf_new(ART_PIX_RGB, have_alpha, 8, width, height);
+ lc->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, have_alpha, 8, width, height);
if (lc->pixbuf == NULL) {
/* Failed to allocate memory */
@@ -480,7 +481,7 @@ png_row_callback (png_structp png_read_ptr,
lc->last_row_seen_in_chunk = row_num;
lc->last_pass_seen_in_chunk = pass_num;
- old_row = lc->pixbuf->art_pixbuf->pixels + (row_num * lc->pixbuf->art_pixbuf->rowstride);
+ old_row = lc->pixbuf->pixels + (row_num * lc->pixbuf->rowstride);
png_progressive_combine_row(lc->png_read_ptr, old_row, new_row);
}
@@ -521,4 +522,3 @@ png_warning_callback(png_structp png_read_ptr,
fprintf(stderr, "Warning loading PNG: %s\n", warning_msg);
}
-
diff --git a/gdk-pixbuf/io-pnm.c b/gdk-pixbuf/io-pnm.c
index c3ac215fa..7f18b1952 100644
--- a/gdk-pixbuf/io-pnm.c
+++ b/gdk-pixbuf/io-pnm.c
@@ -26,7 +26,7 @@
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
@@ -87,11 +87,11 @@ gboolean gdk_pixbuf__pnm_image_load_increment(gpointer context, guchar *buf, gui
static void explode_bitmap_into_buf (PnmLoaderContext *context);
static void explode_gray_into_buf (PnmLoaderContext *context);
-/* Destroy notification function for the libart pixbuf */
+/* Destroy notification function for the pixbuf */
static void
-free_buffer (gpointer user_data, gpointer data)
+free_buffer (guchar *pixels, gpointer data)
{
- free (data);
+ free (pixels);
}
@@ -675,7 +675,7 @@ gdk_pixbuf__pnm_image_load (FILE *f)
break;
}
- return gdk_pixbuf_new_from_data (context.pixels, ART_PIX_RGB, FALSE,
+ return gdk_pixbuf_new_from_data (context.pixels, GDK_COLORSPACE_RGB, FALSE, 8,
context.width, context.height,
context.width * 3, free_buffer, NULL);
@@ -807,8 +807,8 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data, guchar *buf, guint size)
context->output_row = 0;
context->output_col = 0;
- context->pixbuf = gdk_pixbuf_new(ART_PIX_RGB,
- /*have_alpha*/ FALSE,
+ context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
+ FALSE,
8,
context->width,
context->height);
@@ -818,8 +818,8 @@ gdk_pixbuf__pnm_image_load_increment (gpointer data, guchar *buf, guint size)
g_error ("Couldn't allocate gdkpixbuf");
}
- context->pixels = context->pixbuf->art_pixbuf->pixels;
- context->rowstride = context->pixbuf->art_pixbuf->rowstride;
+ context->pixels = context->pixbuf->pixels;
+ context->rowstride = context->pixbuf->rowstride;
/* Notify the client that we are ready to go */
(* context->prepared_func) (context->pixbuf,
diff --git a/gdk-pixbuf/io-ras.c b/gdk-pixbuf/io-ras.c
index f14fea339..b019a5ebb 100644
--- a/gdk-pixbuf/io-ras.c
+++ b/gdk-pixbuf/io-ras.c
@@ -34,12 +34,11 @@ Known bugs:
#include <stdio.h>
#include <unistd.h>
#include <string.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
-
/*
Header structure for sunras files.
All values are in big-endian order on disk
@@ -171,7 +170,7 @@ static void RAS2State(struct rasterfile *RAS,
if (State->pixbuf == NULL) {
if (State->RasType == 32)
- State->pixbuf = gdk_pixbuf_new(ART_PIX_RGB, TRUE,
+ State->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE,
8,
(gint)
State->Header.width,
@@ -180,7 +179,7 @@ static void RAS2State(struct rasterfile *RAS,
height);
else
State->pixbuf =
- gdk_pixbuf_new(ART_PIX_RGB, FALSE, 8,
+ gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
(gint) State->Header.width,
(gint) State->Header.height);
if (State->prepared_func != NULL)
@@ -278,8 +277,7 @@ static void OneLine32(struct ras_progressive_state *context)
guchar *Pixels;
X = 0;
- Pixels = context->pixbuf->art_pixbuf->pixels +
- context->pixbuf->art_pixbuf->rowstride * context->Lines;
+ Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
while (X < context->Header.width) {
/* The joys of having a BGR byteorder */
Pixels[X * 4 + 0] = context->LineBuf[X * 4 + 2];
@@ -296,8 +294,7 @@ static void OneLine24(struct ras_progressive_state *context)
guchar *Pixels;
X = 0;
- Pixels = context->pixbuf->art_pixbuf->pixels +
- context->pixbuf->art_pixbuf->rowstride * context->Lines;
+ Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
while (X < context->Header.width) {
/* The joys of having a BGR byteorder */
Pixels[X * 3 + 0] = context->LineBuf[X * 3 + 2];
@@ -314,8 +311,7 @@ static void OneLine8(struct ras_progressive_state *context)
guchar *Pixels;
X = 0;
- Pixels = context->pixbuf->art_pixbuf->pixels +
- context->pixbuf->art_pixbuf->rowstride * context->Lines;
+ Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
while (X < context->Header.width) {
/* The joys of having a BGR byteorder */
Pixels[X * 3 + 0] =
@@ -334,8 +330,7 @@ static void OneLine1(struct ras_progressive_state *context)
guchar *Pixels;
X = 0;
- Pixels = context->pixbuf->art_pixbuf->pixels +
- context->pixbuf->art_pixbuf->rowstride * context->Lines;
+ Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
while (X < context->Header.width) {
int Bit;
diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c
index 587ecf855..602adb846 100644
--- a/gdk-pixbuf/io-tiff.c
+++ b/gdk-pixbuf/io-tiff.c
@@ -30,7 +30,7 @@
#include <string.h>
#include <unistd.h>
#include <tiffio.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
@@ -68,7 +68,7 @@ gdk_pixbuf__tiff_image_load_real (FILE *f, TiffData *context)
TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &h);
num_pixs = w * h;
- pixbuf = gdk_pixbuf_new (ART_PIX_RGB, TRUE, 8, w, h);
+ pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w, h);
if (context)
(* context->prepare_func) (pixbuf, context->user_data);
diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c
index f6fd6a9be..e6b80dab8 100644
--- a/gdk-pixbuf/io-xpm.c
+++ b/gdk-pixbuf/io-xpm.c
@@ -24,10 +24,11 @@
#include <config.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gdk/gdk.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
@@ -309,11 +310,11 @@ mem_buffer (enum buf_op op, gpointer handle)
return NULL;
}
-/* Destroy notification function for the libart pixbuf */
+/* Destroy notification function for the pixbuf */
static void
-free_buffer (gpointer user_data, gpointer data)
+free_buffer (guchar *pixels, gpointer data)
{
- free (data);
+ free (pixels);
}
/* This function does all the work. */
@@ -429,7 +430,7 @@ pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handl
g_free (colors);
g_free (name_buf);
- return gdk_pixbuf_new_from_data (pixels, ART_PIX_RGB, is_trans,
+ return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, is_trans, 8,
w, h, is_trans ? (w * 4) : (w * 3),
free_buffer, NULL);
}
diff --git a/gdk-pixbuf/pixops/Makefile.am b/gdk-pixbuf/pixops/Makefile.am
index 9cdb3b319..3d5bce8a8 100644
--- a/gdk-pixbuf/pixops/Makefile.am
+++ b/gdk-pixbuf/pixops/Makefile.am
@@ -1,6 +1,6 @@
noinst_LTLIBRARIES = libpixops.la
-INCLUDES = $(GLIB_CFLAGS) $(LIBART_CFLAGS)
+INCLUDES = $(GLIB_CFLAGS) $(LIBART_CFLAGS) -I$(top_srcdir)/gdk-pixbuf
noinst_PROGRAMS = timescale
diff --git a/gdk-pixbuf/pixops/pixops-internal.h b/gdk-pixbuf/pixops/pixops-internal.h
index b6ed3c059..bb0440f5a 100644
--- a/gdk-pixbuf/pixops/pixops-internal.h
+++ b/gdk-pixbuf/pixops/pixops-internal.h
@@ -1,7 +1,7 @@
#ifdef USE_MMX
-art_u8 *pixops_scale_line_22_33_mmx (art_u32 weights[16][8], art_u8 *p, art_u8 *q1, art_u8 *q2, int x_step, art_u8 *p_stop, int x_init);
-art_u8 *pixops_composite_line_22_4a4_mmx (art_u32 weights[16][8], art_u8 *p, art_u8 *q1, art_u8 *q2, int x_step, art_u8 *p_stop, int x_init);
-art_u8 *pixops_composite_line_color_22_4a4_mmx (art_u32 weights[16][8], art_u8 *p, art_u8 *q1, art_u8 *q2, int x_step, art_u8 *p_stop, int x_init, int dest_x, int check_shift, int *colors);
+guchar *pixops_scale_line_22_33_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init);
+guchar *pixops_composite_line_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init);
+guchar *pixops_composite_line_color_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init, int dest_x, int check_shift, int *colors);
int pixops_have_mmx (void);
#endif
diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
index 78bf44eda..040f1df6d 100644
--- a/gdk-pixbuf/pixops/pixops.c
+++ b/gdk-pixbuf/pixops/pixops.c
@@ -21,15 +21,15 @@ struct _PixopsFilter
double y_offset;
};
-typedef art_u8 *(*PixopsLineFunc) (int *weights, int n_x, int n_y,
- art_u8 *dest, int dest_x, art_u8 *dest_end, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+typedef guchar *(*PixopsLineFunc) (int *weights, int n_x, int n_y,
+ guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_init, int x_step, int src_width,
- int check_size, art_u32 color1, art_u32 color2);
+ int check_size, guint32 color1, guint32 color2);
-typedef void (*PixopsPixelFunc) (art_u8 *dest, int dest_x, int dest_channels, int dest_has_alpha,
- int src_has_alpha, int check_size, art_u32 color1,
- art_u32 color2,
+typedef void (*PixopsPixelFunc) (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha,
+ int src_has_alpha, int check_size, guint32 color1,
+ guint32 color2,
int r, int g, int b, int a);
static int
@@ -48,20 +48,20 @@ get_check_shift (int check_size)
}
static void
-pixops_scale_nearest (art_u8 *dest_buf,
+pixops_scale_nearest (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
int render_y1,
int dest_rowstride,
int dest_channels,
- art_boolean dest_has_alpha,
- const art_u8 *src_buf,
+ gboolean dest_has_alpha,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
int src_channels,
- art_boolean src_has_alpha,
+ gboolean src_has_alpha,
double scale_x,
double scale_y)
{
@@ -73,7 +73,7 @@ pixops_scale_nearest (art_u8 *dest_buf,
#define INNER_LOOP(SRC_CHANNELS,DEST_CHANNELS) \
for (j=0; j < (render_x1 - render_x0); j++) \
{ \
- const art_u8 *p = src + (x >> SCALE_SHIFT) * SRC_CHANNELS; \
+ const guchar *p = src + (x >> SCALE_SHIFT) * SRC_CHANNELS; \
\
dest[0] = p[0]; \
dest[1] = p[1]; \
@@ -93,8 +93,8 @@ pixops_scale_nearest (art_u8 *dest_buf,
for (i = 0; i < (render_y1 - render_y0); i++)
{
- const art_u8 *src = src_buf + ((i * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
- art_u8 *dest = dest_buf + i * dest_rowstride;
+ const guchar *src = src_buf + ((i * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
+ guchar *dest = dest_buf + i * dest_rowstride;
x = render_x0 * x_step + x_step / 2;
@@ -119,34 +119,36 @@ pixops_scale_nearest (art_u8 *dest_buf,
{
for (j=0; j < (render_x1 - render_x0); j++)
{
- const art_u8 *p = src + (x >> SCALE_SHIFT) * 4;
+ const guchar *p = src + (x >> SCALE_SHIFT) * 4;
+ guint32 *p32;
+
+ p32 = (guint32 *) dest;
+ *p32 = *((guint32 *) p);
- *(art_u32 *)dest = *(art_u32 *)p;
-
dest += 4;
x += x_step;
}
}
}
}
-#undef INNER_LOOP
+#undef INNER_LOOP
}
static void
-pixops_composite_nearest (art_u8 *dest_buf,
+pixops_composite_nearest (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
int render_y1,
int dest_rowstride,
int dest_channels,
- art_boolean dest_has_alpha,
- const art_u8 *src_buf,
+ gboolean dest_has_alpha,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
int src_channels,
- art_boolean src_has_alpha,
+ gboolean src_has_alpha,
double scale_x,
double scale_y,
int overall_alpha)
@@ -158,14 +160,14 @@ pixops_composite_nearest (art_u8 *dest_buf,
for (i = 0; i < (render_y1 - render_y0); i++)
{
- const art_u8 *src = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
- art_u8 *dest = dest_buf + i * dest_rowstride + render_x0 * dest_channels;
+ const guchar *src = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
+ guchar *dest = dest_buf + i * dest_rowstride + render_x0 * dest_channels;
x = render_x0 * x_step + x_step / 2;
for (j=0; j < (render_x1 - render_x0); j++)
{
- const art_u8 *p = src + (x >> SCALE_SHIFT) * src_channels;
+ const guchar *p = src + (x >> SCALE_SHIFT) * src_channels;
unsigned int a0;
if (src_has_alpha)
@@ -210,28 +212,28 @@ pixops_composite_nearest (art_u8 *dest_buf,
}
static void
-pixops_composite_color_nearest (art_u8 *dest_buf,
+pixops_composite_color_nearest (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
int render_y1,
int dest_rowstride,
int dest_channels,
- art_boolean dest_has_alpha,
- const art_u8 *src_buf,
+ gboolean dest_has_alpha,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
int src_channels,
- art_boolean src_has_alpha,
+ gboolean src_has_alpha,
double scale_x,
double scale_y,
int overall_alpha,
int check_x,
int check_y,
int check_size,
- art_u32 color1,
- art_u32 color2)
+ guint32 color1,
+ guint32 color2)
{
int i, j;
int x;
@@ -242,8 +244,8 @@ pixops_composite_color_nearest (art_u8 *dest_buf,
for (i = 0; i < (render_y1 - render_y0); i++)
{
- const art_u8 *src = src_buf + (((i + render_y0) * y_step + y_step/2) >> SCALE_SHIFT) * src_rowstride;
- art_u8 *dest = dest_buf + i * dest_rowstride;
+ const guchar *src = src_buf + (((i + render_y0) * y_step + y_step/2) >> SCALE_SHIFT) * src_rowstride;
+ guchar *dest = dest_buf + i * dest_rowstride;
x = render_x0 * x_step + x_step / 2;
@@ -270,7 +272,7 @@ pixops_composite_color_nearest (art_u8 *dest_buf,
for (j=0 ; j < (render_x1 - render_x0); j++)
{
- const art_u8 *p = src + (x >> SCALE_SHIFT) * src_channels;
+ const guchar *p = src + (x >> SCALE_SHIFT) * src_channels;
unsigned int a0;
if (src_has_alpha)
@@ -301,8 +303,8 @@ pixops_composite_color_nearest (art_u8 *dest_buf,
}
static void
-composite_pixel (art_u8 *dest, int dest_x, int dest_channels, int dest_has_alpha,
- int src_has_alpha, int check_size, art_u32 color1, art_u32 color2,
+composite_pixel (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha,
+ int src_has_alpha, int check_size, guint32 color1, guint32 color2,
int r, int g, int b, int a)
{
if (dest_has_alpha)
@@ -333,12 +335,12 @@ composite_pixel (art_u8 *dest, int dest_x, int dest_channels, int dest_has_alpha
}
}
-static art_u8 *
+static guchar *
composite_line (int *weights, int n_x, int n_y,
- art_u8 *dest, int dest_x, art_u8 *dest_end, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+ guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_init, int x_step, int src_width,
- int check_size, art_u32 color1, art_u32 color2)
+ int check_size, guint32 color1, guint32 color2)
{
int x = x_init;
int i, j;
@@ -353,7 +355,7 @@ composite_line (int *weights, int n_x, int n_y,
for (i=0; i<n_y; i++)
{
- art_u8 *q = src[i] + x_scaled * src_channels;
+ guchar *q = src[i] + x_scaled * src_channels;
int *line_weights = pixel_weights + n_x * i;
for (j=0; j<n_x; j++)
@@ -408,16 +410,16 @@ composite_line (int *weights, int n_x, int n_y,
return dest;
}
-static art_u8 *
+static guchar *
composite_line_22_4a4 (int *weights, int n_x, int n_y,
- art_u8 *dest, int dest_x, art_u8 *dest_end, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+ guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_init, int x_step, int src_width,
- int check_size, art_u32 color1, art_u32 color2)
+ int check_size, guint32 color1, guint32 color2)
{
int x = x_init;
- art_u8 *src0 = src[0];
- art_u8 *src1 = src[1];
+ guchar *src0 = src[0];
+ guchar *src1 = src[1];
g_return_val_if_fail (src_channels != 3, dest);
g_return_val_if_fail (src_has_alpha, dest);
@@ -427,7 +429,7 @@ composite_line_22_4a4 (int *weights, int n_x, int n_y,
int x_scaled = x >> SCALE_SHIFT;
unsigned int r, g, b, a, ta;
int *pixel_weights;
- art_u8 *q0, *q1;
+ guchar *q0, *q1;
int w1, w2, w3, w4;
q0 = src0 + x_scaled * 4;
@@ -476,14 +478,14 @@ composite_line_22_4a4 (int *weights, int n_x, int n_y,
}
#ifdef USE_MMX
-static art_u8 *
+static guchar *
composite_line_22_4a4_mmx_stub (int *weights, int n_x, int n_y,
- art_u8 *dest, int dest_x, art_u8 *dest_end, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+ guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_init, int x_step, int src_width,
- int check_size, art_u32 color1, art_u32 color2)
+ int check_size, guint32 color1, guint32 color2)
{
- art_u32 mmx_weights[16][8];
+ guint32 mmx_weights[16][8];
int j;
for (j=0; j<16; j++)
@@ -503,8 +505,8 @@ composite_line_22_4a4_mmx_stub (int *weights, int n_x, int n_y,
#endif /* USE_MMX */
static void
-composite_pixel_color (art_u8 *dest, int dest_x, int dest_channels, int dest_has_alpha,
- int src_has_alpha, int check_size, art_u32 color1, art_u32 color2,
+composite_pixel_color (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha,
+ int src_has_alpha, int check_size, guint32 color1, guint32 color2,
int r, int g, int b, int a)
{
int dest_r, dest_g, dest_b;
@@ -533,12 +535,12 @@ composite_pixel_color (art_u8 *dest, int dest_x, int dest_channels, int dest_has
dest[3] = a >> 16;
}
-static art_u8 *
+static guchar *
composite_line_color (int *weights, int n_x, int n_y,
- art_u8 *dest, int dest_x, art_u8 *dest_end, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+ guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_init, int x_step, int src_width,
- int check_size, art_u32 color1, art_u32 color2)
+ int check_size, guint32 color1, guint32 color2)
{
int x = x_init;
int i, j;
@@ -566,7 +568,7 @@ composite_line_color (int *weights, int n_x, int n_y,
for (i=0; i<n_y; i++)
{
- art_u8 *q = src[i] + x_scaled * src_channels;
+ guchar *q = src[i] + x_scaled * src_channels;
int *line_weights = pixel_weights + n_x * i;
for (j=0; j<n_x; j++)
@@ -614,14 +616,14 @@ composite_line_color (int *weights, int n_x, int n_y,
}
#ifdef USE_MMX
-static art_u8 *
+static guchar *
composite_line_color_22_4a4_mmx_stub (int *weights, int n_x, int n_y,
- art_u8 *dest, int dest_x, art_u8 *dest_end, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+ guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_init, int x_step, int src_width,
- int check_size, art_u32 color1, art_u32 color2)
+ int check_size, guint32 color1, guint32 color2)
{
- art_u32 mmx_weights[16][8];
+ guint32 mmx_weights[16][8];
int check_shift = get_check_shift (check_size);
int colors[4];
int j;
@@ -649,8 +651,8 @@ composite_line_color_22_4a4_mmx_stub (int *weights, int n_x, int n_y,
#endif /* USE_MMX */
static void
-scale_pixel (art_u8 *dest, int dest_x, int dest_channels, int dest_has_alpha,
- int src_has_alpha, int check_size, art_u32 color1, art_u32 color2,
+scale_pixel (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha,
+ int src_has_alpha, int check_size, guint32 color1, guint32 color2,
int r, int g, int b, int a)
{
if (src_has_alpha)
@@ -681,12 +683,12 @@ scale_pixel (art_u8 *dest, int dest_x, int dest_channels, int dest_has_alpha,
}
}
-static art_u8 *
+static guchar *
scale_line (int *weights, int n_x, int n_y,
- art_u8 *dest, int dest_x, art_u8 *dest_end, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+ guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_init, int x_step, int src_width,
- int check_size, art_u32 color1, art_u32 color2)
+ int check_size, guint32 color1, guint32 color2)
{
int x = x_init;
int i, j;
@@ -703,7 +705,7 @@ scale_line (int *weights, int n_x, int n_y,
unsigned int r = 0, g = 0, b = 0, a = 0;
for (i=0; i<n_y; i++)
{
- art_u8 *q = src[i] + x_scaled * src_channels;
+ guchar *q = src[i] + x_scaled * src_channels;
int *line_weights = pixel_weights + n_x * i;
for (j=0; j<n_x; j++)
@@ -740,7 +742,7 @@ scale_line (int *weights, int n_x, int n_y,
unsigned int r = 0, g = 0, b = 0;
for (i=0; i<n_y; i++)
{
- art_u8 *q = src[i] + x_scaled * src_channels;
+ guchar *q = src[i] + x_scaled * src_channels;
int *line_weights = pixel_weights + n_x * i;
for (j=0; j<n_x; j++)
@@ -772,14 +774,14 @@ scale_line (int *weights, int n_x, int n_y,
}
#ifdef USE_MMX
-static art_u8 *
+static guchar *
scale_line_22_33_mmx_stub (int *weights, int n_x, int n_y,
- art_u8 *dest, int dest_x, art_u8 *dest_end, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+ guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_init, int x_step, int src_width,
- int check_size, art_u32 color1, art_u32 color2)
+ int check_size, guint32 color1, guint32 color2)
{
- art_u32 mmx_weights[16][8];
+ guint32 mmx_weights[16][8];
int j;
for (j=0; j<16; j++)
@@ -798,23 +800,23 @@ scale_line_22_33_mmx_stub (int *weights, int n_x, int n_y,
}
#endif /* USE_MMX */
-static art_u8 *
+static guchar *
scale_line_22_33 (int *weights, int n_x, int n_y,
- art_u8 *dest, art_u8 *dest_end, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+ guchar *dest, guchar *dest_end, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_init, int x_step, int src_width,
- int check_size, art_u32 color1, art_u32 color2)
+ int check_size, guint32 color1, guint32 color2)
{
int x = x_init;
- art_u8 *src0 = src[0];
- art_u8 *src1 = src[1];
+ guchar *src0 = src[0];
+ guchar *src1 = src[1];
while (dest < dest_end)
{
unsigned int r, g, b;
int x_scaled = x >> SCALE_SHIFT;
int *pixel_weights;
- art_u8 *q0, *q1;
+ guchar *q0, *q1;
int w1, w2, w3, w4;
q0 = src0 + x_scaled * 3;
@@ -857,10 +859,10 @@ scale_line_22_33 (int *weights, int n_x, int n_y,
static void
process_pixel (int *weights, int n_x, int n_y,
- art_u8 *dest, int dest_x, int dest_channels, int dest_has_alpha,
- art_u8 **src, int src_channels, art_boolean src_has_alpha,
+ guchar *dest, int dest_x, int dest_channels, int dest_has_alpha,
+ guchar **src, int src_channels, gboolean src_has_alpha,
int x_start, int src_width,
- int check_size, art_u32 color1, art_u32 color2,
+ int check_size, guint32 color1, guint32 color2,
PixopsPixelFunc pixel_func)
{
unsigned int r = 0, g = 0, b = 0, a = 0;
@@ -873,7 +875,7 @@ process_pixel (int *weights, int n_x, int n_y,
for (j=0; j<n_x; j++)
{
unsigned int ta;
- art_u8 *q;
+ guchar *q;
if (x_start + j < 0)
q = src[i];
@@ -898,34 +900,34 @@ process_pixel (int *weights, int n_x, int n_y,
}
static void
-pixops_process (art_u8 *dest_buf,
+pixops_process (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
int render_y1,
int dest_rowstride,
int dest_channels,
- art_boolean dest_has_alpha,
- const art_u8 *src_buf,
+ gboolean dest_has_alpha,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
int src_channels,
- art_boolean src_has_alpha,
+ gboolean src_has_alpha,
double scale_x,
double scale_y,
int check_x,
int check_y,
int check_size,
- art_u32 color1,
- art_u32 color2,
+ guint32 color1,
+ guint32 color2,
PixopsFilter *filter,
PixopsLineFunc line_func,
PixopsPixelFunc pixel_func)
{
int i, j;
int x, y;
- art_u8 **line_bufs = g_new (art_u8 *, filter->n_y);
+ guchar **line_bufs = g_new (guchar *, filter->n_y);
int x_step = (1 << SCALE_SHIFT) / scale_x;
int y_step = (1 << SCALE_SHIFT) / scale_y;
@@ -942,11 +944,11 @@ pixops_process (art_u8 *dest_buf,
int y_start = y >> SCALE_SHIFT;
int x_start;
int *run_weights = filter->weights + ((y >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * filter->n_x * filter->n_y * SUBSAMPLE;
- art_u8 *new_outbuf;
- art_u32 tcolor1, tcolor2;
+ guchar *new_outbuf;
+ guint32 tcolor1, tcolor2;
- art_u8 *outbuf = dest_buf + dest_rowstride * i;
- art_u8 *outbuf_end = outbuf + dest_channels * (render_x1 - render_x0);
+ guchar *outbuf = dest_buf + dest_rowstride * i;
+ guchar *outbuf_end = outbuf + dest_channels * (render_x1 - render_x0);
if (((i + check_y) >> check_shift) & 1)
{
@@ -962,11 +964,11 @@ pixops_process (art_u8 *dest_buf,
for (j=0; j<filter->n_y; j++)
{
if (y_start < 0)
- line_bufs[j] = (art_u8 *)src_buf;
+ line_bufs[j] = (guchar *)src_buf;
else if (y_start < src_height)
- line_bufs[j] = (art_u8 *)src_buf + src_rowstride * y_start;
+ line_bufs[j] = (guchar *)src_buf + src_rowstride * y_start;
else
- line_bufs[j] = (art_u8 *)src_buf + src_rowstride * (src_height - 1);
+ line_bufs[j] = (guchar *)src_buf + src_rowstride * (src_height - 1);
y_start++;
}
@@ -1288,35 +1290,35 @@ bilinear_make_weights (PixopsFilter *filter, double x_scale, double y_scale, dou
}
void
-pixops_composite_color (art_u8 *dest_buf,
+pixops_composite_color (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
int render_y1,
int dest_rowstride,
int dest_channels,
- art_boolean dest_has_alpha,
- const art_u8 *src_buf,
+ gboolean dest_has_alpha,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
int src_channels,
- art_boolean src_has_alpha,
+ gboolean src_has_alpha,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha,
int check_x,
int check_y,
int check_size,
- art_u32 color1,
- art_u32 color2)
+ guint32 color1,
+ guint32 color2)
{
PixopsFilter filter;
PixopsLineFunc line_func;
#ifdef USE_MMX
- art_boolean found_mmx = pixops_have_mmx();
+ gboolean found_mmx = pixops_have_mmx();
#endif
g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
@@ -1329,11 +1331,11 @@ pixops_composite_color (art_u8 *dest_buf,
pixops_scale (dest_buf, render_x0, render_y0, render_x1, render_y1,
dest_rowstride, dest_channels, dest_has_alpha,
src_buf, src_width, src_height, src_rowstride, src_channels,
- src_has_alpha, scale_x, scale_y, filter_level);
+ src_has_alpha, scale_x, scale_y, interp_type);
- switch (filter_level)
+ switch (interp_type)
{
- case ART_FILTER_NEAREST:
+ case GDK_INTERP_NEAREST:
pixops_composite_color_nearest (dest_buf, render_x0, render_y0, render_x1, render_y1,
dest_rowstride, dest_channels, dest_has_alpha,
src_buf, src_width, src_height, src_rowstride, src_channels, src_has_alpha,
@@ -1341,15 +1343,15 @@ pixops_composite_color (art_u8 *dest_buf,
check_x, check_y, check_size, color1, color2);
return;
- case ART_FILTER_TILES:
+ case GDK_INTERP_TILES:
tile_make_weights (&filter, scale_x, scale_y, overall_alpha / 255.);
break;
- case ART_FILTER_BILINEAR:
+ case GDK_INTERP_BILINEAR:
bilinear_make_fast_weights (&filter, scale_x, scale_y, overall_alpha / 255.);
break;
- case ART_FILTER_HYPER:
+ case GDK_INTERP_HYPER:
bilinear_make_weights (&filter, scale_x, scale_y, overall_alpha / 255.);
break;
}
@@ -1372,30 +1374,30 @@ pixops_composite_color (art_u8 *dest_buf,
}
void
-pixops_composite (art_u8 *dest_buf,
+pixops_composite (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
int render_y1,
int dest_rowstride,
int dest_channels,
- art_boolean dest_has_alpha,
- const art_u8 *src_buf,
+ gboolean dest_has_alpha,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
int src_channels,
- art_boolean src_has_alpha,
+ gboolean src_has_alpha,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha)
{
PixopsFilter filter;
PixopsLineFunc line_func;
#ifdef USE_MMX
- art_boolean found_mmx = pixops_have_mmx();
+ gboolean found_mmx = pixops_have_mmx();
#endif
g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
@@ -1408,26 +1410,26 @@ pixops_composite (art_u8 *dest_buf,
pixops_scale (dest_buf, render_x0, render_y0, render_x1, render_y1,
dest_rowstride, dest_channels, dest_has_alpha,
src_buf, src_width, src_height, src_rowstride, src_channels,
- src_has_alpha, scale_x, scale_y, filter_level);
+ src_has_alpha, scale_x, scale_y, interp_type);
- switch (filter_level)
+ switch (interp_type)
{
- case ART_FILTER_NEAREST:
+ case GDK_INTERP_NEAREST:
pixops_composite_nearest (dest_buf, render_x0, render_y0, render_x1, render_y1,
dest_rowstride, dest_channels, dest_has_alpha,
src_buf, src_width, src_height, src_rowstride, src_channels,
src_has_alpha, scale_x, scale_y, overall_alpha);
return;
- case ART_FILTER_TILES:
+ case GDK_INTERP_TILES:
tile_make_weights (&filter, scale_x, scale_y, overall_alpha / 255.);
break;
- case ART_FILTER_BILINEAR:
+ case GDK_INTERP_BILINEAR:
bilinear_make_fast_weights (&filter, scale_x, scale_y, overall_alpha / 255.);
break;
- case ART_FILTER_HYPER:
+ case GDK_INTERP_HYPER:
bilinear_make_weights (&filter, scale_x, scale_y, overall_alpha / 255.);
break;
}
@@ -1455,29 +1457,29 @@ pixops_composite (art_u8 *dest_buf,
}
void
-pixops_scale (art_u8 *dest_buf,
+pixops_scale (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
int render_y1,
int dest_rowstride,
int dest_channels,
- art_boolean dest_has_alpha,
- const art_u8 *src_buf,
+ gboolean dest_has_alpha,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
int src_channels,
- art_boolean src_has_alpha,
+ gboolean src_has_alpha,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level)
+ GdkInterpType interp_type)
{
PixopsFilter filter;
PixopsLineFunc line_func;
#ifdef USE_MMX
- art_boolean found_mmx = pixops_have_mmx();
+ gboolean found_mmx = pixops_have_mmx();
#endif
g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
@@ -1487,24 +1489,24 @@ pixops_scale (art_u8 *dest_buf,
if (scale_x == 0 || scale_y == 0)
return;
- switch (filter_level)
+ switch (interp_type)
{
- case ART_FILTER_NEAREST:
+ case GDK_INTERP_NEAREST:
pixops_scale_nearest (dest_buf, render_x0, render_y0, render_x1, render_y1,
dest_rowstride, dest_channels, dest_has_alpha,
src_buf, src_width, src_height, src_rowstride, src_channels, src_has_alpha,
scale_x, scale_y);
return;
- case ART_FILTER_TILES:
+ case GDK_INTERP_TILES:
tile_make_weights (&filter, scale_x, scale_y, 1.0);
break;
- case ART_FILTER_BILINEAR:
+ case GDK_INTERP_BILINEAR:
bilinear_make_fast_weights (&filter, scale_x, scale_y, 1.0);
break;
- case ART_FILTER_HYPER:
+ case GDK_INTERP_HYPER:
bilinear_make_weights (&filter, scale_x, scale_y, 1.0);
break;
}
diff --git a/gdk-pixbuf/pixops/pixops.h b/gdk-pixbuf/pixops/pixops.h
index 193d65918..8aa06b630 100644
--- a/gdk-pixbuf/pixops/pixops.h
+++ b/gdk-pixbuf/pixops/pixops.h
@@ -1,12 +1,17 @@
-#include <libart_lgpl/art_misc.h>
-#include <libart_lgpl/art_filterlevel.h>
+#ifndef PIXOPS_H
+#define PIXOPS_H
+
+#include <glib.h>
+#include "gdk-pixbuf.h"
+
+
/* Scale src_buf from src_width / src_height by factors scale_x, scale_y
* and composite the portion corresponding to
* render_x, render_y, render_width, render_height in the new
* coordinate system into dest_buf starting at 0, 0
*/
-void pixops_composite (art_u8 *dest_buf,
+void pixops_composite (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
@@ -14,7 +19,7 @@ void pixops_composite (art_u8 *dest_buf,
int dest_rowstride,
int dest_channels,
int dest_has_alpha,
- const art_u8 *src_buf,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
@@ -22,7 +27,7 @@ void pixops_composite (art_u8 *dest_buf,
int src_has_alpha,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha);
/* Scale src_buf from src_width / src_height by factors scale_x, scale_y
@@ -31,7 +36,7 @@ void pixops_composite (art_u8 *dest_buf,
* coordinate system against a checkboard with checks of size check_size
* of the colors color1 and color2 into dest_buf starting at 0, 0
*/
-void pixops_composite_color (art_u8 *dest_buf,
+void pixops_composite_color (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
@@ -39,7 +44,7 @@ void pixops_composite_color (art_u8 *dest_buf,
int dest_rowstride,
int dest_channels,
int dest_has_alpha,
- const art_u8 *src_buf,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
@@ -47,20 +52,20 @@ void pixops_composite_color (art_u8 *dest_buf,
int src_has_alpha,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level,
+ GdkInterpType interp_type,
int overall_alpha,
int check_x,
int check_y,
int check_size,
- art_u32 color1,
- art_u32 color2);
+ guint32 color1,
+ guint32 color2);
/* Scale src_buf from src_width / src_height by factors scale_x, scale_y
* and composite the portion corresponding to
* render_x, render_y, render_width, render_height in the new
* coordinate system into dest_buf starting at 0, 0
*/
-void pixops_scale (art_u8 *dest_buf,
+void pixops_scale (guchar *dest_buf,
int render_x0,
int render_y0,
int render_x1,
@@ -68,7 +73,7 @@ void pixops_scale (art_u8 *dest_buf,
int dest_rowstride,
int dest_channels,
int dest_has_alpha,
- const art_u8 *src_buf,
+ const guchar *src_buf,
int src_width,
int src_height,
int src_rowstride,
@@ -76,5 +81,8 @@ void pixops_scale (art_u8 *dest_buf,
int src_has_alpha,
double scale_x,
double scale_y,
- ArtFilterLevel filter_level);
+ GdkInterpType interp_type);
+
+
+#endif
diff --git a/gdk-pixbuf/pixops/timescale.c b/gdk-pixbuf/pixops/timescale.c
index d0ea25748..b835ff542 100644
--- a/gdk-pixbuf/pixops/timescale.c
+++ b/gdk-pixbuf/pixops/timescale.c
@@ -76,16 +76,16 @@ dump_array (double times[3][3][4])
switch (j)
{
- case ART_FILTER_NEAREST:
+ case GDK_INTERP_NEAREST:
printf (" NEAREST\n");
break;
- case ART_FILTER_TILES:
+ case GDK_INTERP_TILES:
printf (" TILES\n");
break;
- case ART_FILTER_BILINEAR:
+ case GDK_INTERP_BILINEAR:
printf (" BILINEAR\n");
break;
- case ART_FILTER_HYPER:
+ case GDK_INTERP_HYPER:
printf (" HYPER\n");
break;
}
@@ -152,24 +152,24 @@ int main (int argc, char **argv)
dest_buf = malloc(dest_rowstride * dest_height);
memset (dest_buf, 0x80, dest_rowstride * dest_height);
- for (filter_level = ART_FILTER_NEAREST ; filter_level <= ART_FILTER_HYPER; filter_level++)
+ for (filter_level = GDK_INTERP_NEAREST ; filter_level <= GDK_INTERP_HYPER; filter_level++)
{
printf ("src_channels = %d (%s); dest_channels = %d (%s); filter_level=",
src_channels, src_has_alpha ? "alpha" : "no alpha",
dest_channels, dest_has_alpha ? "alpha" : "no alpha");
switch (filter_level)
{
- case ART_FILTER_NEAREST:
- printf ("ART_FILTER_NEAREST\n");
+ case GDK_INTERP_NEAREST:
+ printf ("GDK_INTERP_NEAREST\n");
break;
- case ART_FILTER_TILES:
- printf ("ART_FILTER_TILES\n");
+ case GDK_INTERP_TILES:
+ printf ("GDK_INTERP_TILES\n");
break;
- case ART_FILTER_BILINEAR:
- printf ("ART_FILTER_BILINEAR\n");
+ case GDK_INTERP_BILINEAR:
+ printf ("GDK_INTERP_BILINEAR\n");
break;
- case ART_FILTER_HYPER:
- printf ("ART_FILTER_HYPER\n");
+ case GDK_INTERP_HYPER:
+ printf ("GDK_INTERP_HYPER\n");
break;
}
diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c
index d4834a827..d49d744d3 100644
--- a/gdk/gdkpixbuf-drawable.c
+++ b/gdk/gdkpixbuf-drawable.c
@@ -26,7 +26,7 @@
#include <config.h>
#include <stdio.h>
#include <string.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
#define LITTLE
@@ -54,7 +54,7 @@ static guint32 mask_table[] = {
no alpha
*/
static void
-rgb1 (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb1 (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -93,7 +93,7 @@ rgb1 (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
with alpha
*/
static void
-rgb1a (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb1a (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -145,7 +145,7 @@ rgb1a (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
no alpha
*/
static void
-rgb8 (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb8 (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -183,7 +183,7 @@ rgb8 (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
with alpha
*/
static void
-rgb8a (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb8a (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -235,7 +235,7 @@ rgb8a (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
data in lsb format
*/
static void
-rgb565lsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb565lsb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -300,7 +300,7 @@ rgb565lsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap
data in msb format
*/
static void
-rgb565msb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb565msb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -365,7 +365,7 @@ rgb565msb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap
data in lsb format
*/
static void
-rgb565alsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb565alsb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -418,7 +418,7 @@ rgb565alsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colorma
data in msb format
*/
static void
-rgb565amsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb565amsb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -467,7 +467,7 @@ rgb565amsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colorma
data in lsb format
*/
static void
-rgb555lsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb555lsb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -532,7 +532,7 @@ rgb555lsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap
data in msb format
*/
static void
-rgb555msb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb555msb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -593,7 +593,7 @@ rgb555msb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap
data in lsb format
*/
static void
-rgb555alsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb555alsb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -646,7 +646,7 @@ rgb555alsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colorma
data in msb format
*/
static void
-rgb555amsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb555amsb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -695,7 +695,7 @@ rgb555amsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colorma
static void
-rgb888alsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb888alsb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -728,7 +728,7 @@ rgb888alsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colorma
}
static void
-rgb888lsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb888lsb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -758,7 +758,7 @@ rgb888lsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap
}
static void
-rgb888amsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb888amsb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -806,7 +806,7 @@ rgb888amsb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colorma
}
static void
-rgb888msb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap)
+rgb888msb (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *colormap)
{
int xx, yy;
int width, height;
@@ -841,7 +841,7 @@ rgb888msb (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *colormap
run quite slow
*/
static void
-convert_real_slow (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *cmap, int alpha)
+convert_real_slow (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *cmap, int alpha)
{
int xx, yy;
int width, height;
@@ -899,7 +899,7 @@ convert_real_slow (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *
}
}
-typedef void (* cfunc) (GdkImage *image, art_u8 *pixels, int rowstride, GdkColormap *cmap);
+typedef void (* cfunc) (GdkImage *image, guchar *pixels, int rowstride, GdkColormap *cmap);
static cfunc convert_map[] = {
rgb1,rgb1,rgb1a,rgb1a,
@@ -917,7 +917,7 @@ static cfunc convert_map[] = {
conversion function.
*/
static void
-rgbconvert (GdkImage *image, art_u8 *pixels, int rowstride, int alpha, GdkColormap *cmap)
+rgbconvert (GdkImage *image, guchar *pixels, int rowstride, int alpha, GdkColormap *cmap)
{
int index = (image->byte_order == GDK_MSB_FIRST) | (alpha != 0) << 1;
int bank=5; /* default fallback converter */
@@ -1020,7 +1020,9 @@ rgbconvert (GdkImage *image, art_u8 *pixels, int rowstride, int alpha, GdkColorm
* be undefined.
*
* Return value: The same pixbuf as @dest if it was non-NULL, or a newly-created
- * pixbuf with a reference count of 1 if no destination pixbuf was specified.
+ * pixbuf with a reference count of 1 if no destination pixbuf was specified; in
+ * the latter case, NULL will be returned if not enough memory could be
+ * allocated for the pixbuf to be created.
**/
GdkPixbuf *
gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
@@ -1031,7 +1033,6 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
{
GdkWindowType window_type;
int src_width, src_height;
- ArtPixBuf *apb = NULL;
GdkImage *image;
int rowstride, bpp, alpha;
@@ -1054,11 +1055,9 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
if (!dest)
g_return_val_if_fail (dest_x == 0 && dest_y == 0, NULL);
else {
- apb = dest->art_pixbuf;
-
- g_return_val_if_fail (apb->format == ART_PIX_RGB, NULL);
- g_return_val_if_fail (apb->n_channels == 3 || apb->n_channels == 4, NULL);
- g_return_val_if_fail (apb->bits_per_sample == 8, NULL);
+ g_return_val_if_fail (dest->colorspace == GDK_COLORSPACE_RGB, NULL);
+ g_return_val_if_fail (dest->n_channels == 3 || dest->n_channels == 4, NULL);
+ g_return_val_if_fail (dest->bits_per_sample == 8, NULL);
}
/* Coordinate sanity checks */
@@ -1070,8 +1069,8 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
if (dest) {
g_return_val_if_fail (dest_x >= 0 && dest_y >= 0, NULL);
- g_return_val_if_fail (dest_x + width <= apb->width, NULL);
- g_return_val_if_fail (dest_y + height <= apb->height, NULL);
+ g_return_val_if_fail (dest_x + width <= dest->width, NULL);
+ g_return_val_if_fail (dest_y + height <= dest->height, NULL);
}
if (window_type != GDK_WINDOW_PIXMAP) {
@@ -1096,33 +1095,31 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
/* Get Image in ZPixmap format (packed bits). */
image = gdk_image_get (src, src_x, src_y, width, height);
- g_return_val_if_fail( image != NULL, NULL);
+ g_return_val_if_fail (image != NULL, NULL);
/* Create the pixbuf if needed */
if (!dest) {
- dest = gdk_pixbuf_new (ART_PIX_RGB, FALSE, 8, width, height);
+ dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
if (!dest) {
gdk_image_destroy(image);
return NULL;
}
-
- apb = dest->art_pixbuf;
}
/* Get the colormap if needed */
if (window_type != GDK_WINDOW_PIXMAP)
cmap = gdk_window_get_colormap (src);
- alpha = gdk_pixbuf_get_has_alpha(dest);
- rowstride = gdk_pixbuf_get_rowstride(dest);
- bpp = alpha?4:3;
+ alpha = dest->has_alpha;
+ rowstride = dest->rowstride;
+ bpp = alpha ? 4 : 3;
/* we offset into the image data based on the position we are retrieving from */
- rgbconvert(image, gdk_pixbuf_get_pixels(dest) +
- (dest_y * rowstride) + (dest_x * bpp),
- rowstride,
- alpha,
- cmap);
+ rgbconvert (image, dest->pixels +
+ (dest_y * rowstride) + (dest_x * bpp),
+ rowstride,
+ alpha,
+ cmap);
gdk_image_destroy(image);
diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c
index 19bf30dea..706d43b59 100644
--- a/gdk/gdkpixbuf-render.c
+++ b/gdk/gdkpixbuf-render.c
@@ -22,8 +22,7 @@
#include <config.h>
#include <gdk/gdk.h>
-#include <libart_lgpl/art_rect.h>
-#include "gdk-pixbuf.h"
+#include "gdk-pixbuf-private.h"
@@ -52,7 +51,6 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
int width, int height,
int alpha_threshold)
{
- ArtPixBuf *apb;
GdkGC *gc;
GdkColor color;
int x, y;
@@ -61,16 +59,14 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
int status;
g_return_if_fail (pixbuf != NULL);
- apb = pixbuf->art_pixbuf;
-
- g_return_if_fail (apb->format == ART_PIX_RGB);
- g_return_if_fail (apb->n_channels == 3 || apb->n_channels == 4);
- g_return_if_fail (apb->bits_per_sample == 8);
+ g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
+ g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
+ g_return_if_fail (pixbuf->bits_per_sample == 8);
g_return_if_fail (bitmap != NULL);
g_return_if_fail (width >= 0 && height >= 0);
- g_return_if_fail (src_x >= 0 && src_x + width <= apb->width);
- g_return_if_fail (src_y >= 0 && src_y + height <= apb->height);
+ g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
+ g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
g_return_if_fail (alpha_threshold >= 0 && alpha_threshold <= 255);
@@ -79,7 +75,7 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
gc = gdk_gc_new (bitmap);
- if (!apb->has_alpha) {
+ if (!pixbuf->has_alpha) {
color.pixel = (alpha_threshold == 255) ? 0 : 1;
gdk_gc_set_foreground (gc, &color);
gdk_draw_rectangle (bitmap, gc, TRUE, dest_x, dest_y, width, height);
@@ -95,8 +91,8 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
gdk_gc_set_foreground (gc, &color);
for (y = 0; y < height; y++) {
- p = (apb->pixels + (y + src_y) * apb->rowstride + src_x * apb->n_channels
- + apb->n_channels - 1);
+ p = (pixbuf->pixels + (y + src_y) * pixbuf->rowstride + src_x * pixbuf->n_channels
+ + pixbuf->n_channels - 1);
start = 0;
start_status = *p < alpha_threshold;
@@ -114,7 +110,7 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
start_status = status;
}
- p += apb->n_channels;
+ p += pixbuf->n_channels;
}
if (!start_status)
@@ -130,24 +126,24 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, GdkBitmap *bitmap,
/* Creates a buffer by stripping the alpha channel of a pixbuf */
static guchar *
-remove_alpha (ArtPixBuf *apb, int x, int y, int width, int height, int *rowstride)
+remove_alpha (GdkPixbuf *pixbuf, int x, int y, int width, int height, int *rowstride)
{
guchar *buf;
int xx, yy;
guchar *src, *dest;
- g_assert (apb->n_channels == 4);
- g_assert (apb->has_alpha);
+ g_assert (pixbuf->n_channels == 4);
+ g_assert (pixbuf->has_alpha);
g_assert (width > 0 && height > 0);
- g_assert (x >= 0 && x + width <= apb->width);
- g_assert (y >= 0 && y + height <= apb->height);
+ g_assert (x >= 0 && x + width <= pixbuf->width);
+ g_assert (y >= 0 && y + height <= pixbuf->height);
*rowstride = 4 * ((width * 3 + 3) / 4);
buf = g_new (guchar, *rowstride * height);
for (yy = 0; yy < height; yy++) {
- src = apb->pixels + apb->rowstride * (yy + y) + x * apb->n_channels;
+ src = pixbuf->pixels + pixbuf->rowstride * (yy + y) + x * pixbuf->n_channels;
dest = buf + *rowstride * yy;
for (xx = 0; xx < width; xx++) {
@@ -198,37 +194,34 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
GdkRgbDither dither,
int x_dither, int y_dither)
{
- ArtPixBuf *apb;
guchar *buf;
int rowstride;
g_return_if_fail (pixbuf != NULL);
- apb = pixbuf->art_pixbuf;
-
- g_return_if_fail (apb->format == ART_PIX_RGB);
- g_return_if_fail (apb->n_channels == 3 || apb->n_channels == 4);
- g_return_if_fail (apb->bits_per_sample == 8);
+ g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
+ g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
+ g_return_if_fail (pixbuf->bits_per_sample == 8);
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
g_return_if_fail (width >= 0 && height >= 0);
- g_return_if_fail (src_x >= 0 && src_x + width <= apb->width);
- g_return_if_fail (src_y >= 0 && src_y + height <= apb->height);
+ g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
+ g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
if (width == 0 || height == 0)
return;
- /* This will have to be modified once libart supports other image types.
+ /* This will have to be modified once we support other image types.
* Also, GdkRGB does not have gdk_draw_rgb_32_image_dithalign(), so we
- * have to pack the buffer first.
+ * have to pack the buffer first. Sigh.
*/
- if (apb->has_alpha)
- buf = remove_alpha (apb, src_x, src_y, width, height, &rowstride);
+ if (pixbuf->has_alpha)
+ buf = remove_alpha (pixbuf, src_x, src_y, width, height, &rowstride);
else {
- buf = apb->pixels + src_y * apb->rowstride + src_x * 3;
- rowstride = apb->rowstride;
+ buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 3;
+ rowstride = pixbuf->rowstride;
}
gdk_draw_rgb_image_dithalign (drawable, gc,
@@ -238,7 +231,7 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
buf, rowstride,
x_dither, y_dither);
- if (apb->has_alpha)
+ if (pixbuf->has_alpha)
g_free (buf);
}
@@ -284,28 +277,25 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
GdkRgbDither dither,
int x_dither, int y_dither)
{
- ArtPixBuf *apb;
GdkBitmap *bitmap = NULL;
GdkGC *gc;
g_return_if_fail (pixbuf != NULL);
- apb = pixbuf->art_pixbuf;
-
- g_return_if_fail (apb->format == ART_PIX_RGB);
- g_return_if_fail (apb->n_channels == 3 || apb->n_channels == 4);
- g_return_if_fail (apb->bits_per_sample == 8);
+ g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
+ g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
+ g_return_if_fail (pixbuf->bits_per_sample == 8);
g_return_if_fail (drawable != NULL);
g_return_if_fail (width >= 0 && height >= 0);
- g_return_if_fail (src_x >= 0 && src_x + width <= apb->width);
- g_return_if_fail (src_y >= 0 && src_y + height <= apb->height);
+ g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
+ g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
if (width == 0 || height == 0)
return;
gc = gdk_gc_new (drawable);
- if (apb->has_alpha) {
+ if (pixbuf->has_alpha) {
/* Right now we only support GDK_PIXBUF_ALPHA_BILEVEL, so we
* unconditionally create the clipping mask.
*/
@@ -330,12 +320,13 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
if (bitmap)
gdk_bitmap_unref (bitmap);
+
gdk_gc_unref (gc);
}
/**
* gdk_pixbuf_render_pixmap_and_mask:
- * @pixbuf: A pixbuf
+ * @pixbuf: A pixbuf.
* @pixmap_return: Return value for the created pixmap.
* @mask_return: Return value for the created mask.
* @alpha_threshold: Threshold value for opacity values.
@@ -346,37 +337,39 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
* function; applications that need to render pixbufs with dither offsets or to
* given drawables should use gdk_pixbuf_render_to_drawable_alpha() or
* gdk_pixbuf_render_to_drawable(), and gdk_pixbuf_render_threshold_alpha().
+ *
+ * If the pixbuf does not have an alpha channel, then *@mask_return will be set
+ * to NULL.
**/
void
gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
GdkPixmap **pixmap_return, GdkBitmap **mask_return,
int alpha_threshold)
{
- ArtPixBuf *apb;
-
g_return_if_fail (pixbuf != NULL);
- apb = pixbuf->art_pixbuf;
-
if (pixmap_return) {
GdkGC *gc;
- *pixmap_return = gdk_pixmap_new (NULL, apb->width, apb->height,
+ *pixmap_return = gdk_pixmap_new (NULL, pixbuf->width, pixbuf->height,
gdk_rgb_get_visual ()->depth);
gc = gdk_gc_new (*pixmap_return);
gdk_pixbuf_render_to_drawable (pixbuf, *pixmap_return, gc,
0, 0, 0, 0,
- apb->width, apb->height,
+ pixbuf->width, pixbuf->height,
GDK_RGB_DITHER_NORMAL,
0, 0);
gdk_gc_unref (gc);
}
if (mask_return) {
- *mask_return = gdk_pixmap_new (NULL, apb->width, apb->height, 1);
- gdk_pixbuf_render_threshold_alpha (pixbuf, *mask_return,
- 0, 0, 0, 0,
- apb->width, apb->height,
- alpha_threshold);
+ if (pixbuf->has_alpha) {
+ *mask_return = gdk_pixmap_new (NULL, pixbuf->width, pixbuf->height, 1);
+ gdk_pixbuf_render_threshold_alpha (pixbuf, *mask_return,
+ 0, 0, 0, 0,
+ pixbuf->width, pixbuf->height,
+ alpha_threshold);
+ } else
+ *mask_return = NULL;
}
}
diff --git a/gtk/gdk-pixbuf-loader.c b/gtk/gdk-pixbuf-loader.c
index 777b767d1..5648258aa 100644
--- a/gtk/gdk-pixbuf-loader.c
+++ b/gtk/gdk-pixbuf-loader.c
@@ -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"