[gthumb] print: use cairo_surfaces only without converting to/from GdkPixbufs



commit 6c644dda954ef291d1471fbbb70c6e95a2ff4bc7
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Aug 19 09:33:20 2012 +0200

    print: use cairo_surfaces only without converting to/from GdkPixbufs

 extensions/image_print/actions.c                  |    6 +-
 extensions/image_print/gth-image-info.c           |   74 +++---
 extensions/image_print/gth-image-info.h           |   64 ++--
 extensions/image_print/gth-image-print-job.c      |  337 +++++++++------------
 extensions/image_print/gth-image-print-job.h      |    2 +-
 extensions/image_print/gth-load-image-info-task.c |   12 +-
 gthumb/cairo-utils.c                              |   53 ++++
 gthumb/cairo-utils.h                              |    6 +-
 gthumb/pixbuf-utils.c                             |   78 -----
 gthumb/pixbuf-utils.h                             |    8 +-
 10 files changed, 276 insertions(+), 364 deletions(-)
---
diff --git a/extensions/image_print/actions.c b/extensions/image_print/actions.c
index 67f2b3d..507e596 100644
--- a/extensions/image_print/actions.c
+++ b/extensions/image_print/actions.c
@@ -37,7 +37,7 @@ gth_browser_activate_action_file_print (GtkAction  *action,
 	items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
 	file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);
 	if (file_list != NULL) {
-		GdkPixbuf        *current_image;
+		cairo_surface_t  *current_image;
 		GtkWidget        *viewer_page;
 		GthImagePrintJob *print_job;
 		GError           *error = NULL;
@@ -51,14 +51,14 @@ gth_browser_activate_action_file_print (GtkAction  *action,
 			GtkWidget *viewer;
 
 			viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-			current_image = gth_image_viewer_get_current_pixbuf (GTH_IMAGE_VIEWER (viewer));
+			current_image = gth_image_viewer_get_current_image (GTH_IMAGE_VIEWER (viewer));
 		}
 		print_job = gth_image_print_job_new (file_list,
 						     gth_browser_get_current_file (browser),
 						     current_image,
 						     g_file_info_get_display_name (gth_browser_get_location_data (browser)->info),
 						     &error);
-		_g_object_unref (current_image);
+		cairo_surface_destroy (current_image);
 
 		if (print_job != NULL) {
 			gth_image_print_job_run (print_job,
diff --git a/extensions/image_print/gth-image-info.c b/extensions/image_print/gth-image-info.c
index fd92be4..a2cb85b 100644
--- a/extensions/image_print/gth-image-info.c
+++ b/extensions/image_print/gth-image-info.c
@@ -45,7 +45,7 @@ gth_image_info_new (GthFileData *file_data)
 	image_info = g_new0 (GthImageInfo, 1);
 	image_info->ref_count = 1;
 	image_info->file_data = g_object_ref (file_data);
-	image_info->pixbuf = NULL;
+	image_info->image = NULL;
 	image_info->thumbnail_original = NULL;
 	image_info->thumbnail = NULL;
 	image_info->thumbnail_active = NULL;
@@ -57,10 +57,10 @@ gth_image_info_new (GthFileData *file_data)
 	image_info->page = -1;
 	image_info->active = FALSE;
 	image_info->reset = TRUE;
-	gth_rectangle_init (&image_info->boundary);
-	gth_rectangle_init (&image_info->maximized);
-	gth_rectangle_init (&image_info->image);
-	gth_rectangle_init (&image_info->comment);
+	gth_rectangle_init (&image_info->boundary_box);
+	gth_rectangle_init (&image_info->maximized_box);
+	gth_rectangle_init (&image_info->image_box);
+	gth_rectangle_init (&image_info->comment_box);
 
 	return image_info;
 }
@@ -85,43 +85,43 @@ gth_image_info_unref (GthImageInfo *image_info)
 		return;
 
 	_g_object_unref (image_info->file_data);
-	_g_object_unref (image_info->pixbuf);
-	_g_object_unref (image_info->thumbnail_original);
-	_g_object_unref (image_info->thumbnail);
-	_g_object_unref (image_info->thumbnail_active);
+	cairo_surface_destroy (image_info->image);
+	cairo_surface_destroy (image_info->thumbnail_original);
+	cairo_surface_destroy (image_info->thumbnail);
+	cairo_surface_destroy (image_info->thumbnail_active);
 	g_free (image_info->comment_text);
 	g_free (image_info);
 }
 
 
 void
-gth_image_info_set_pixbuf (GthImageInfo *image_info,
-			   GdkPixbuf    *pixbuf)
+gth_image_info_set_image  (GthImageInfo    *image_info,
+			   cairo_surface_t *image)
 {
 	int thumb_w;
 	int thumb_h;
 
-	g_return_if_fail (pixbuf != NULL);
+	g_return_if_fail (image != NULL);
 
-	_g_clear_object (&image_info->pixbuf);
-	_g_clear_object (&image_info->thumbnail_original);
-	_g_clear_object (&image_info->thumbnail);
-	_g_clear_object (&image_info->thumbnail_active);
+	_cairo_clear_surface (&image_info->image);
+	_cairo_clear_surface (&image_info->thumbnail_original);
+	_cairo_clear_surface (&image_info->thumbnail);
+	_cairo_clear_surface (&image_info->thumbnail_active);
 
-	image_info->pixbuf = g_object_ref (pixbuf);
-	thumb_w = image_info->original_width = image_info->pixbuf_width = gdk_pixbuf_get_width (pixbuf);
-	thumb_h = image_info->original_height = image_info->pixbuf_height = gdk_pixbuf_get_height (pixbuf);
+	image_info->image = cairo_surface_reference (image);
+	thumb_w = image_info->original_width = image_info->image_width = cairo_image_surface_get_width (image);
+	thumb_h = image_info->original_height = image_info->image_height = cairo_image_surface_get_height (image);
 	if (scale_keeping_ratio (&thumb_w, &thumb_h, THUMBNAIL_SIZE, THUMBNAIL_SIZE, FALSE))
-		image_info->thumbnail_original = gdk_pixbuf_scale_simple (pixbuf,
-									  thumb_w,
-									  thumb_h,
-									  GDK_INTERP_BILINEAR);
+		image_info->thumbnail_original = _cairo_image_surface_scale (image,
+								 	     thumb_w,
+								 	     thumb_h,
+								 	     SCALE_FILTER_BEST,
+								 	     NULL);
 	else
-		image_info->thumbnail_original = g_object_ref (image_info->pixbuf);
+		image_info->thumbnail_original = cairo_surface_reference (image_info->image);
 
-	image_info->thumbnail = g_object_ref (image_info->thumbnail_original);
-	image_info->thumbnail_active = gdk_pixbuf_copy (image_info->thumbnail);
-	_gdk_pixbuf_colorshift (image_info->thumbnail_active, image_info->thumbnail_active, 30);
+	image_info->thumbnail = cairo_surface_reference (image_info->thumbnail_original);
+	image_info->thumbnail_active = _cairo_image_surface_color_shift (image_info->thumbnail, 30);
 }
 
 
@@ -152,22 +152,20 @@ gth_image_info_rotate (GthImageInfo *image_info,
 		break;
 	}
 
-	_g_clear_object (&image_info->thumbnail);
+	_cairo_clear_surface (&image_info->thumbnail);
 	if (image_info->thumbnail_original != NULL)
-		image_info->thumbnail = _gdk_pixbuf_transform (image_info->thumbnail_original, image_info->rotation);
+		image_info->thumbnail = _cairo_image_surface_transform (image_info->thumbnail_original, image_info->rotation);
 
-	_g_clear_object (&image_info->thumbnail_active);
-	if (image_info->thumbnail != NULL) {
-		image_info->thumbnail_active = gdk_pixbuf_copy (image_info->thumbnail);
-		_gdk_pixbuf_colorshift (image_info->thumbnail_active, image_info->thumbnail_active, 30);
-	}
+	_cairo_clear_surface (&image_info->thumbnail_active);
+	if (image_info->thumbnail != NULL)
+		image_info->thumbnail_active = _cairo_image_surface_color_shift (image_info->thumbnail, 30);
 
 	if ((angle == 90) || (angle == 270)) {
-		image_info->pixbuf_width = image_info->original_height;
-		image_info->pixbuf_height = image_info->original_width;
+		image_info->image_width = image_info->original_height;
+		image_info->image_height = image_info->original_width;
 	}
 	else {
-		image_info->pixbuf_width = image_info->original_width;
-		image_info->pixbuf_height = image_info->original_height;
+		image_info->image_width = image_info->original_width;
+		image_info->image_height = image_info->original_height;
 	}
 }
diff --git a/extensions/image_print/gth-image-info.h b/extensions/image_print/gth-image-info.h
index f6774e1..42da954 100644
--- a/extensions/image_print/gth-image-info.h
+++ b/extensions/image_print/gth-image-info.h
@@ -35,40 +35,40 @@ typedef struct {
 } GthRectangle;
 
 typedef struct {
-	int           ref_count;
-	GthFileData  *file_data;
-	int           original_width;
-	int           original_height;
-	int           pixbuf_width;
-	int           pixbuf_height;
-	GdkPixbuf    *pixbuf;
-	GdkPixbuf    *thumbnail_original;
-	GdkPixbuf    *thumbnail;
-	GdkPixbuf    *thumbnail_active;
-	int           page;
-	int           row;
-	int           col;
-	GthTransform  rotation;
-	double        zoom;
-	GthRectangle  transformation;
-	gboolean      active;
-	gboolean      reset;
-	gboolean      print_comment;
-	char         *comment_text;
-	GthRectangle  boundary;
-	GthRectangle  maximized;
-	GthRectangle  image;
-	GthRectangle  comment;
+	int              ref_count;
+	GthFileData     *file_data;
+	int              original_width;
+	int              original_height;
+	int              image_width;
+	int              image_height;
+	cairo_surface_t *image;
+	cairo_surface_t *thumbnail_original;
+	cairo_surface_t *thumbnail;
+	cairo_surface_t *thumbnail_active;
+	int              page;
+	int              row;
+	int              col;
+	GthTransform     rotation;
+	double           zoom;
+	GthRectangle     transformation;
+	gboolean         active;
+	gboolean         reset;
+	gboolean         print_comment;
+	char            *comment_text;
+	GthRectangle     boundary_box;
+	GthRectangle     maximized_box;
+	GthRectangle     image_box;
+	GthRectangle     comment_box;
 } GthImageInfo;
 
-GthImageInfo *  gth_image_info_new        (GthFileData  *file_data);
-GthImageInfo *  gth_image_info_ref        (GthImageInfo *image_info);
-void            gth_image_info_unref      (GthImageInfo *image_info);
-void            gth_image_info_set_pixbuf (GthImageInfo *image_info,
-					   GdkPixbuf    *pixbuf);
-void            gth_image_info_reset      (GthImageInfo *image_info);
-void            gth_image_info_rotate     (GthImageInfo *image_info,
-				           int           angle);
+GthImageInfo *  gth_image_info_new        (GthFileData     *file_data);
+GthImageInfo *  gth_image_info_ref        (GthImageInfo    *image_info);
+void            gth_image_info_unref      (GthImageInfo    *image_info);
+void            gth_image_info_set_image  (GthImageInfo    *image_info,
+					   cairo_surface_t *image);
+void            gth_image_info_reset      (GthImageInfo    *image_info);
+void            gth_image_info_rotate     (GthImageInfo    *image_info,
+				           int              angle);
 
 G_END_DECLS
 
diff --git a/extensions/image_print/gth-image-print-job.c b/extensions/image_print/gth-image-print-job.c
index 8de4206..3880858 100644
--- a/extensions/image_print/gth-image-print-job.c
+++ b/extensions/image_print/gth-image-print-job.c
@@ -420,24 +420,24 @@ gth_image_print_job_update_image_layout (GthImagePrintJob    *self,
 	if (self->priv->selected == NULL)
 		self->priv->selected = image_info;
 
-	image_info->boundary.x = (image_info->col - 1) * (self->priv->max_image_width + self->priv->x_padding);
-	image_info->boundary.y = (image_info->row - 1) * (self->priv->max_image_height + self->priv->y_padding);
+	image_info->boundary_box.x = (image_info->col - 1) * (self->priv->max_image_width + self->priv->x_padding);
+	image_info->boundary_box.y = (image_info->row - 1) * (self->priv->max_image_height + self->priv->y_padding);
 	if (self->priv->header_rectangle.height > 0)
-		image_info->boundary.y += self->priv->header_rectangle.height + self->priv->y_padding;
-	image_info->boundary.width = self->priv->max_image_width;
-	image_info->boundary.height = self->priv->max_image_height;
+		image_info->boundary_box.y += self->priv->header_rectangle.height + self->priv->y_padding;
+	image_info->boundary_box.width = self->priv->max_image_width;
+	image_info->boundary_box.height = self->priv->max_image_height;
 
-	max_image_width = image_info->boundary.width;
-	max_image_height = image_info->boundary.height;
+	max_image_width = image_info->boundary_box.width;
+	max_image_height = image_info->boundary_box.height;
 
 	image_info->print_comment = FALSE;
 	g_free (image_info->comment_text);
 	image_info->comment_text = NULL;
 
-	image_info->comment.x = 0.0;
-	image_info->comment.y = 0.0;
-	image_info->comment.width = 0.0;
-	image_info->comment.height = 0.0;
+	image_info->comment_box.x = 0.0;
+	image_info->comment_box.y = 0.0;
+	image_info->comment_box.width = 0.0;
+	image_info->comment_box.height = 0.0;
 
 	if (strcmp (self->priv->caption_attributes, "") != 0) {
 		gboolean  comment_present = FALSE;
@@ -469,54 +469,54 @@ gth_image_print_job_update_image_layout (GthImagePrintJob    *self,
 			pango_layout_set_width (pango_layout, max_image_width * self->priv->scale_factor * PANGO_SCALE);
 			pango_layout_get_pixel_extents (pango_layout, NULL, &logical_rect);
 
-			image_info->comment.x = 0;
-			image_info->comment.y = 0;
-			image_info->comment.width = image_info->boundary.width;
-			image_info->comment.height = logical_rect.height / self->priv->scale_factor;
-			max_image_height -= image_info->comment.height;
+			image_info->comment_box.x = 0;
+			image_info->comment_box.y = 0;
+			image_info->comment_box.width = image_info->boundary_box.width;
+			image_info->comment_box.height = logical_rect.height / self->priv->scale_factor;
+			max_image_height -= image_info->comment_box.height;
 			if (max_image_height < 0) {
 				image_info->print_comment = FALSE;
-				max_image_height = image_info->boundary.height;
+				max_image_height = image_info->boundary_box.height;
 			}
 		}
 	}
 
-	factor = MIN (max_image_width / image_info->pixbuf_width, max_image_height / image_info->pixbuf_height);
-	image_info->maximized.width = (double) image_info->pixbuf_width * factor;
-	image_info->maximized.height = (double) image_info->pixbuf_height * factor;
-	image_info->maximized.x = image_info->boundary.x + ((max_image_width - image_info->maximized.width) / 2);
-	image_info->maximized.y = image_info->boundary.y + ((max_image_height - image_info->maximized.height) / 2);
+	factor = MIN (max_image_width / image_info->image_width, max_image_height / image_info->image_height);
+	image_info->maximized_box.width = (double) image_info->image_width * factor;
+	image_info->maximized_box.height = (double) image_info->image_height * factor;
+	image_info->maximized_box.x = image_info->boundary_box.x + ((max_image_width - image_info->maximized_box.width) / 2);
+	image_info->maximized_box.y = image_info->boundary_box.y + ((max_image_height - image_info->maximized_box.height) / 2);
 
 	if (image_info->reset) {
-		/* calculate the transformation to center the image */
-		image_info->transformation.x = (image_info->maximized.x - image_info->boundary.x) / self->priv->max_image_width;
-		image_info->transformation.y = (image_info->maximized.y - image_info->boundary.y) / self->priv->max_image_height;
+		/* calculate the transformation to center the image_box */
+		image_info->transformation.x = (image_info->maximized_box.x - image_info->boundary_box.x) / self->priv->max_image_width;
+		image_info->transformation.y = (image_info->maximized_box.y - image_info->boundary_box.y) / self->priv->max_image_height;
 		image_info->zoom = 1.0;
 		image_info->reset = FALSE;
 	}
 
-	image_info->image.x = image_info->boundary.x + (self->priv->max_image_width * image_info->transformation.x);
-	image_info->image.y = image_info->boundary.y + (self->priv->max_image_height * image_info->transformation.y);
-	image_info->image.width = image_info->maximized.width * image_info->zoom;
-	image_info->image.height = image_info->maximized.height * image_info->zoom;
+	image_info->image_box.x = image_info->boundary_box.x + (self->priv->max_image_width * image_info->transformation.x);
+	image_info->image_box.y = image_info->boundary_box.y + (self->priv->max_image_height * image_info->transformation.y);
+	image_info->image_box.width = image_info->maximized_box.width * image_info->zoom;
+	image_info->image_box.height = image_info->maximized_box.height * image_info->zoom;
 
 	/* check the limits */
 
-	if (image_info->image.x - image_info->boundary.x + image_info->image.width > image_info->boundary.width) {
-		image_info->image.x = image_info->boundary.x + image_info->boundary.width - image_info->image.width;
-		image_info->transformation.x = (image_info->image.x - image_info->boundary.x) / self->priv->max_image_width;
+	if (image_info->image_box.x - image_info->boundary_box.x + image_info->image_box.width > image_info->boundary_box.width) {
+		image_info->image_box.x = image_info->boundary_box.x + image_info->boundary_box.width - image_info->image_box.width;
+		image_info->transformation.x = (image_info->image_box.x - image_info->boundary_box.x) / self->priv->max_image_width;
 	}
 
-	if (image_info->image.y - image_info->boundary.y + image_info->image.height > image_info->boundary.height) {
-		image_info->image.y = image_info->boundary.y + image_info->boundary.height - image_info->image.height;
-		image_info->transformation.y = (image_info->image.y - image_info->boundary.y) / self->priv->max_image_height;
+	if (image_info->image_box.y - image_info->boundary_box.y + image_info->image_box.height > image_info->boundary_box.height) {
+		image_info->image_box.y = image_info->boundary_box.y + image_info->boundary_box.height - image_info->image_box.height;
+		image_info->transformation.y = (image_info->image_box.y - image_info->boundary_box.y) / self->priv->max_image_height;
 	}
 
-	/* the comment position */
+	/* the comment_box position */
 
 	if (image_info->print_comment) {
-		image_info->comment.x += image_info->boundary.x;
-		image_info->comment.y += image_info->image.y + image_info->image.height;
+		image_info->comment_box.x += image_info->boundary_box.x;
+		image_info->comment_box.y += image_info->image_box.y + image_info->image_box.height;
 	}
 }
 
@@ -586,20 +586,16 @@ gth_image_print_job_update_layout (GthImagePrintJob   *self,
 
 
 static void
-_cairo_paint_pixbuf (cairo_t   *cr,
-		     double     x,
-		     double     y,
-		     double     width,
-		     double     height,
-		     GdkPixbuf *original_pixbuf,
-		     int        dpi)
+_cairo_paint_image (cairo_t         *cr,
+		    double           x,
+		    double           y,
+		    double           width,
+		    double           height,
+		    cairo_surface_t *original_image,
+		    int              dpi)
 {
 	double            scale_factor;
-	GdkPixbuf        *pixbuf;
-	guchar		 *p;
-	int		  pw, ph, rs;
-	guchar           *np;
-	cairo_surface_t  *s;
+	cairo_surface_t  *scaled;
 	cairo_pattern_t	 *pattern;
 	cairo_matrix_t    matrix;
 
@@ -607,68 +603,15 @@ _cairo_paint_pixbuf (cairo_t   *cr,
 	   72 dpi unless we apply a scaling factor. This scaling boosts the output
 	   to 300 dpi (if required). */
 
-	scale_factor = MIN ((double) gdk_pixbuf_get_width (original_pixbuf) / width, (double) dpi / 72.0);
-	pixbuf = gdk_pixbuf_scale_simple (original_pixbuf,
-					  width * scale_factor,
-					  height * scale_factor,
-					  GDK_INTERP_BILINEAR);
-
-	p = gdk_pixbuf_get_pixels (pixbuf);
-	pw = gdk_pixbuf_get_width (pixbuf);
-	ph = gdk_pixbuf_get_height (pixbuf);
-	rs = gdk_pixbuf_get_rowstride (pixbuf);
-	if (gdk_pixbuf_get_has_alpha (pixbuf)) {
-		guchar *kk;
-		guchar *kp;
-		int     i;
-
-		np = g_malloc (pw*ph*4);
-		for (i=0; i<ph; i++) {
-			int j = 0;
-			kk = p + rs*i;
-			kp = np + pw*4*i;
-			for (j=0; j<pw; j++) {
-				if (kk[3] == 0) {
-					*((unsigned int *)kp) = 0;
-				}
-				else {
-					if (kk[3] != 0xff) {
-						int t = (kk[3] * kk[0]) + 0x80;
-						kk[0] = ((t+(t>>8))>>8);
-						t = (kk[3] * kk[1]) + 0x80;
-						kk[1] = ((t+(t>>8))>>8);
-						t = (kk[3] * kk[2]) + 0x80;
-						kk[2] = ((t+(t>>8))>>8);
-					}
-					*((unsigned int *)kp) = kk[2] + (kk[1] << 8) + (kk[0] << 16) + (kk[3] << 24);
-				}
-				kk += 4;
-				kp += 4;
-			}
-		}
-		s = cairo_image_surface_create_for_data (np, CAIRO_FORMAT_ARGB32, pw, ph, pw*4);
-	}
-	else {
-		guchar* kk;
-		guchar* kp;
-		int     i;
-
-		np = g_malloc (pw*ph*4);
-		for (i=0; i<ph; i++) {
-			int j = 0;
-			kk = p + rs*i;
-			kp = np + pw*4*i;
-			for (j=0; j<pw; j++) {
-				*((unsigned int *)kp) = kk[2] + (kk[1] << 8) + (kk[0] << 16);
-				kk += 3;
-				kp += 4;
-			}
-		}
-		s = cairo_image_surface_create_for_data (np, CAIRO_FORMAT_RGB24, pw, ph, pw*4);
-	}
+	scale_factor = MIN ((double) cairo_image_surface_get_width (original_image) / width, (double) dpi / 72.0);
+	scaled = _cairo_image_surface_scale (original_image,
+					     width * scale_factor,
+					     height * scale_factor,
+					     SCALE_FILTER_BEST,
+					     NULL);
 
 	cairo_save (cr);
-	pattern = cairo_pattern_create_for_surface (s);
+	pattern = cairo_pattern_create_for_surface (scaled);
 	cairo_matrix_init_translate (&matrix, -x * scale_factor, -y * scale_factor);
 	cairo_matrix_scale (&matrix, scale_factor, scale_factor);
 	cairo_pattern_set_matrix (pattern, &matrix);
@@ -679,9 +622,7 @@ _cairo_paint_pixbuf (cairo_t   *cr,
 	cairo_restore (cr);
 
 	cairo_pattern_destroy (pattern);
-	cairo_surface_destroy (s);
-	g_free (np);
-	g_object_unref (pixbuf);
+	cairo_surface_destroy (scaled);
 }
 
 
@@ -737,8 +678,8 @@ gth_image_print_job_paint (GthImagePrintJob *self,
 	gth_image_print_job_set_font_options (self, pango_layout, self->priv->caption_font_name, preview);
 
 	for (i = 0; i < self->priv->n_images; i++) {
-		GthImageInfo *image_info = self->priv->images[i];
-		GdkPixbuf    *fullsize_pixbuf;
+		GthImageInfo    *image_info = self->priv->images[i];
+		cairo_surface_t *fullsize_image;
 
 		if (image_info->page != page)
 			continue;
@@ -749,10 +690,10 @@ gth_image_print_job_paint (GthImagePrintJob *self,
 			cairo_set_line_width (cr, 0.5);
 			cairo_set_source_rgb (cr, 1.0, 0.0, 0.0);
 			cairo_rectangle (cr,
-					 x_offset + image_info->comment.x,
-					 y_offset + image_info->comment.y,
-					 image_info->comment.width,
-					 image_info->comment.height);
+					 x_offset + image_info->comment_box.x,
+					 y_offset + image_info->comment_box.y,
+					 image_info->comment_box.width,
+					 image_info->comment_box.height);
 			cairo_stroke (cr);
 			cairo_restore (cr);
 #endif
@@ -766,66 +707,68 @@ gth_image_print_job_paint (GthImagePrintJob *self,
 			else
 				cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
 			cairo_rectangle (cr,
-					 x_offset + image_info->boundary.x,
-					 y_offset + image_info->boundary.y,
-					 image_info->boundary.width,
-					 image_info->boundary.height);
+					 x_offset + image_info->boundary_box.x,
+					 y_offset + image_info->boundary_box.y,
+					 image_info->boundary_box.width,
+					 image_info->boundary_box.height);
 			cairo_stroke (cr);
 			cairo_restore (cr);
 		}
 
 		if (! preview) {
 			if (image_info->rotation != GTH_TRANSFORM_NONE)
-				fullsize_pixbuf = _gdk_pixbuf_transform (image_info->pixbuf, image_info->rotation);
+				fullsize_image = _cairo_image_surface_transform (image_info->image, image_info->rotation);
 			else
-				fullsize_pixbuf = g_object_ref (image_info->pixbuf);
+				fullsize_image = cairo_surface_reference (image_info->image);
 		}
 		else if (image_info->active)
-			fullsize_pixbuf = g_object_ref (image_info->thumbnail_active);
+			fullsize_image = cairo_surface_reference (image_info->thumbnail_active);
 		else
-			fullsize_pixbuf = g_object_ref (image_info->thumbnail);
+			fullsize_image = cairo_surface_reference (image_info->thumbnail);
 
-		if ((image_info->image.width >= 1.0) && (image_info->image.height >= 1.0)) {
+		if ((image_info->image_box.width >= 1.0) && (image_info->image_box.height >= 1.0)) {
 			if (preview) {
-				GdkPixbuf *pixbuf;
+				cairo_surface_t *scaled;
+
+				scaled = _cairo_image_surface_scale (fullsize_image,
+								     image_info->image_box.width,
+								     image_info->image_box.height,
+								     (preview ? SCALE_FILTER_FAST : SCALE_FILTER_BEST),
+								     NULL);
 
-				pixbuf = gdk_pixbuf_scale_simple (fullsize_pixbuf,
-								  image_info->image.width,
-								  image_info->image.height,
-								  preview ? GDK_INTERP_NEAREST : GDK_INTERP_BILINEAR);
 				cairo_save (cr);
-				gdk_cairo_set_source_pixbuf (cr,
-							     pixbuf,
-							     x_offset + image_info->image.x,
-							     y_offset + image_info->image.y);
+				cairo_set_source_surface (cr,
+							  scaled,
+							  x_offset + image_info->image_box.x,
+							  y_offset + image_info->image_box.y);
 				cairo_rectangle (cr,
-						 x_offset + image_info->image.x,
-						 y_offset + image_info->image.y,
-						 gdk_pixbuf_get_width (pixbuf),
-						 gdk_pixbuf_get_height (pixbuf));
+						 x_offset + image_info->image_box.x,
+						 y_offset + image_info->image_box.y,
+						 cairo_image_surface_get_width (scaled),
+						 cairo_image_surface_get_height (scaled));
 				cairo_clip (cr);
 				cairo_paint (cr);
 				cairo_restore (cr);
 
-				g_object_unref (pixbuf);
+				cairo_surface_destroy (scaled);
 			}
 			else
-				_cairo_paint_pixbuf (cr,
-						     x_offset + image_info->image.x,
-						     y_offset + image_info->image.y,
-						     image_info->image.width,
-						     image_info->image.height,
-						     fullsize_pixbuf,
+				_cairo_paint_image (cr,
+						     x_offset + image_info->image_box.x,
+						     y_offset + image_info->image_box.y,
+						     image_info->image_box.width,
+						     image_info->image_box.height,
+						     fullsize_image,
 						     self->priv->dpi);
 		}
 
 		if (image_info->print_comment) {
 			cairo_save (cr);
 
-			pango_layout_set_width (pango_layout, image_info->comment.width * self->priv->scale_factor * PANGO_SCALE);
+			pango_layout_set_width (pango_layout, image_info->comment_box.width * self->priv->scale_factor * PANGO_SCALE);
 			pango_layout_set_text (pango_layout, image_info->comment_text, -1);
 
-			cairo_move_to (cr, x_offset + image_info->comment.x, y_offset + image_info->comment.y);
+			cairo_move_to (cr, x_offset + image_info->comment_box.x, y_offset + image_info->comment_box.y);
 			if (preview)
 				cairo_scale (cr, 1.0 / self->priv->scale_factor, 1.0 / self->priv->scale_factor);
 
@@ -836,7 +779,7 @@ gth_image_print_job_paint (GthImagePrintJob *self,
 			cairo_restore (cr);
 		}
 
-		g_object_unref (fullsize_pixbuf);
+		cairo_surface_destroy (fullsize_image);
 	}
 }
 
@@ -923,31 +866,31 @@ gth_image_print_job_update_image_controls (GthImagePrintJob *self)
 
 	g_signal_handler_block (GET_WIDGET ("left_adjustment"), self->priv->left_adjustment_value_changed_event);
 	gtk_adjustment_set_lower (GTK_ADJUSTMENT (GET_WIDGET ("left_adjustment")), 0.0);
-	gtk_adjustment_set_upper (GTK_ADJUSTMENT (GET_WIDGET ("left_adjustment")), TO_UNIT (self->priv->selected->boundary.width - self->priv->selected->image.width));
-	gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("left_adjustment")), TO_UNIT (self->priv->selected->image.x - self->priv->selected->boundary.x));
+	gtk_adjustment_set_upper (GTK_ADJUSTMENT (GET_WIDGET ("left_adjustment")), TO_UNIT (self->priv->selected->boundary_box.width - self->priv->selected->image_box.width));
+	gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("left_adjustment")), TO_UNIT (self->priv->selected->image_box.x - self->priv->selected->boundary_box.x));
 	g_signal_handler_unblock (GET_WIDGET ("left_adjustment"), self->priv->left_adjustment_value_changed_event);
 
 	g_signal_handler_block (GET_WIDGET ("top_adjustment"), self->priv->top_adjustment_value_changed_event);
 	gtk_adjustment_set_lower (GTK_ADJUSTMENT (GET_WIDGET ("top_adjustment")), 0.0);
-	gtk_adjustment_set_upper (GTK_ADJUSTMENT (GET_WIDGET ("top_adjustment")), TO_UNIT (self->priv->selected->boundary.height - self->priv->selected->comment.height - self->priv->selected->image.height));
-	gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("top_adjustment")), TO_UNIT (self->priv->selected->image.y - self->priv->selected->boundary.y));
+	gtk_adjustment_set_upper (GTK_ADJUSTMENT (GET_WIDGET ("top_adjustment")), TO_UNIT (self->priv->selected->boundary_box.height - self->priv->selected->comment_box.height - self->priv->selected->image_box.height));
+	gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("top_adjustment")), TO_UNIT (self->priv->selected->image_box.y - self->priv->selected->boundary_box.y));
 	g_signal_handler_unblock (GET_WIDGET ("top_adjustment"), self->priv->top_adjustment_value_changed_event);
 
 	g_signal_handler_block (GET_WIDGET ("width_adjustment"), self->priv->width_adjustment_value_changed_event);
 	gtk_adjustment_set_lower (GTK_ADJUSTMENT (GET_WIDGET ("width_adjustment")), 0.0);
-	gtk_adjustment_set_upper (GTK_ADJUSTMENT (GET_WIDGET ("width_adjustment")), TO_UNIT (self->priv->selected->maximized.width));
-	gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("width_adjustment")), TO_UNIT (self->priv->selected->image.width));
+	gtk_adjustment_set_upper (GTK_ADJUSTMENT (GET_WIDGET ("width_adjustment")), TO_UNIT (self->priv->selected->maximized_box.width));
+	gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("width_adjustment")), TO_UNIT (self->priv->selected->image_box.width));
 	g_signal_handler_unblock (GET_WIDGET ("width_adjustment"), self->priv->width_adjustment_value_changed_event);
 
 	g_signal_handler_block (GET_WIDGET ("height_adjustment"), self->priv->height_adjustment_value_changed_event);
 	gtk_adjustment_set_lower (GTK_ADJUSTMENT (GET_WIDGET ("height_adjustment")), 0.0);
-	gtk_adjustment_set_upper (GTK_ADJUSTMENT (GET_WIDGET ("height_adjustment")), TO_UNIT (self->priv->selected->maximized.height));
-	gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("height_adjustment")), TO_UNIT (self->priv->selected->image.height));
+	gtk_adjustment_set_upper (GTK_ADJUSTMENT (GET_WIDGET ("height_adjustment")), TO_UNIT (self->priv->selected->maximized_box.height));
+	gtk_adjustment_set_value (GTK_ADJUSTMENT (GET_WIDGET ("height_adjustment")), TO_UNIT (self->priv->selected->image_box.height));
 	g_signal_handler_unblock (GET_WIDGET ("height_adjustment"), self->priv->height_adjustment_value_changed_event);
 
 	g_signal_handler_block (GET_WIDGET ("position_combobox"), self->priv->position_combobox_changed_event);
-	centered = (self->priv->selected->image.x == ((self->priv->selected->boundary.width - self->priv->selected->image.width) / 2.0))
-		    && (self->priv->selected->image.y == ((self->priv->selected->boundary.height - self->priv->selected->comment.height - self->priv->selected->image.height) / 2.0));
+	centered = (self->priv->selected->image_box.x == ((self->priv->selected->boundary_box.width - self->priv->selected->image_box.width) / 2.0))
+		    && (self->priv->selected->image_box.y == ((self->priv->selected->boundary_box.height - self->priv->selected->comment_box.height - self->priv->selected->image_box.height) / 2.0));
 	gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("position_combobox")), centered ? 0 : 1);
 	g_signal_handler_unblock (GET_WIDGET ("position_combobox"), self->priv->position_combobox_changed_event);
 }
@@ -1059,10 +1002,10 @@ preview_motion_notify_event_cb (GtkWidget      *widget,
 		if (image_info->page != self->priv->current_page)
 			continue;
 
-		if ((x >= image_info->boundary.x)
-		    && (x <= image_info->boundary.x + image_info->boundary.width)
-		    && (y >= image_info->boundary.y )
-		    && (y <= image_info->boundary.y + image_info->boundary.height))
+		if ((x >= image_info->boundary_box.x)
+		    && (x <= image_info->boundary_box.x + image_info->boundary_box.width)
+		    && (y >= image_info->boundary_box.y )
+		    && (y <= image_info->boundary_box.y + image_info->boundary_box.height))
 		{
 			if (! image_info->active) {
 				image_info->active = TRUE;
@@ -1127,10 +1070,10 @@ preview_button_press_event_cb (GtkWidget      *widget,
 		if (image_info->page != self->priv->current_page)
 			continue;
 
-		if ((x >= image_info->boundary.x)
-		    && (x <= image_info->boundary.x + image_info->boundary.width)
-		    && (y >= image_info->boundary.y )
-		    && (y <= image_info->boundary.y + image_info->boundary.height))
+		if ((x >= image_info->boundary_box.x)
+		    && (x <= image_info->boundary_box.x + image_info->boundary_box.width)
+		    && (y >= image_info->boundary_box.y )
+		    && (y <= image_info->boundary_box.y + image_info->boundary_box.height))
 		{
 			self->priv->selected = image_info;
 			gtk_widget_queue_draw (GET_WIDGET ("preview_drawingarea"));
@@ -1351,22 +1294,22 @@ gth_image_print_job_set_selected_zoom (GthImagePrintJob *self,
 	double x, y;
 
 	self->priv->selected->zoom = CLAMP (zoom, 0.0, 1.0);
-	self->priv->selected->image.width = self->priv->selected->maximized.width * self->priv->selected->zoom;
-	self->priv->selected->image.height = self->priv->selected->maximized.height * self->priv->selected->zoom;
-
-	x = self->priv->selected->image.x - self->priv->selected->boundary.x;
-	y = self->priv->selected->image.y - self->priv->selected->boundary.y;
-	if (x + self->priv->selected->image.width > self->priv->selected->boundary.width)
-		x = self->priv->selected->boundary.width - self->priv->selected->image.width;
-	if (x + self->priv->selected->image.width > self->priv->selected->boundary.width)
-		self->priv->selected->image.width = self->priv->selected->boundary.width - x;
-
-	if (y + self->priv->selected->image.height > self->priv->selected->boundary.height - self->priv->selected->comment.height)
-		y = self->priv->selected->boundary.height - self->priv->selected->comment.height - self->priv->selected->image.height;
-	if (y + self->priv->selected->image.height > self->priv->selected->boundary.height - self->priv->selected->comment.height)
-		self->priv->selected->image.height = self->priv->selected->boundary.height - self->priv->selected->comment.height - y;
-
-	self->priv->selected->zoom = MIN (self->priv->selected->image.width / self->priv->selected->maximized.width, self->priv->selected->image.height / self->priv->selected->maximized.height);
+	self->priv->selected->image_box.width = self->priv->selected->maximized_box.width * self->priv->selected->zoom;
+	self->priv->selected->image_box.height = self->priv->selected->maximized_box.height * self->priv->selected->zoom;
+
+	x = self->priv->selected->image_box.x - self->priv->selected->boundary_box.x;
+	y = self->priv->selected->image_box.y - self->priv->selected->boundary_box.y;
+	if (x + self->priv->selected->image_box.width > self->priv->selected->boundary_box.width)
+		x = self->priv->selected->boundary_box.width - self->priv->selected->image_box.width;
+	if (x + self->priv->selected->image_box.width > self->priv->selected->boundary_box.width)
+		self->priv->selected->image_box.width = self->priv->selected->boundary_box.width - x;
+
+	if (y + self->priv->selected->image_box.height > self->priv->selected->boundary_box.height - self->priv->selected->comment_box.height)
+		y = self->priv->selected->boundary_box.height - self->priv->selected->comment_box.height - self->priv->selected->image_box.height;
+	if (y + self->priv->selected->image_box.height > self->priv->selected->boundary_box.height - self->priv->selected->comment_box.height)
+		self->priv->selected->image_box.height = self->priv->selected->boundary_box.height - self->priv->selected->comment_box.height - y;
+
+	self->priv->selected->zoom = MIN (self->priv->selected->image_box.width / self->priv->selected->maximized_box.width, self->priv->selected->image_box.height / self->priv->selected->maximized_box.height);
 	self->priv->selected->transformation.x = x / self->priv->max_image_width;
 	self->priv->selected->transformation.y = y / self->priv->max_image_height;
 
@@ -1424,7 +1367,7 @@ width_adjustment_value_changed_cb (GtkAdjustment *adjustment,
 	if (self->priv->selected == NULL)
 		return;
 
-	gth_image_print_job_set_selected_zoom (self, TO_PIXELS (gtk_adjustment_get_value (adjustment)) / self->priv->selected->maximized.width);
+	gth_image_print_job_set_selected_zoom (self, TO_PIXELS (gtk_adjustment_get_value (adjustment)) / self->priv->selected->maximized_box.width);
 }
 
 
@@ -1437,7 +1380,7 @@ height_adjustment_value_changed_cb (GtkAdjustment *adjustment,
 	if (self->priv->selected == NULL)
 		return;
 
-	gth_image_print_job_set_selected_zoom (self, TO_PIXELS (gtk_adjustment_get_value (adjustment)) / self->priv->selected->maximized.height);
+	gth_image_print_job_set_selected_zoom (self, TO_PIXELS (gtk_adjustment_get_value (adjustment)) / self->priv->selected->maximized_box.height);
 }
 
 
@@ -1451,10 +1394,10 @@ position_combobox_changed_cb (GtkComboBox *combo_box,
 		return;
 
 	if (gtk_combo_box_get_active (combo_box) == 0) {
-		self->priv->selected->image.x = (self->priv->selected->boundary.width - self->priv->selected->image.width) / 2.0;
-		self->priv->selected->image.y = (self->priv->selected->boundary.height - self->priv->selected->comment.height - self->priv->selected->image.height) / 2.0;
-		self->priv->selected->transformation.x = self->priv->selected->image.x / self->priv->max_image_width;
-		self->priv->selected->transformation.y = self->priv->selected->image.y / self->priv->max_image_height;
+		self->priv->selected->image_box.x = (self->priv->selected->boundary_box.width - self->priv->selected->image_box.width) / 2.0;
+		self->priv->selected->image_box.y = (self->priv->selected->boundary_box.height - self->priv->selected->comment_box.height - self->priv->selected->image_box.height) / 2.0;
+		self->priv->selected->transformation.x = self->priv->selected->image_box.x / self->priv->max_image_width;
+		self->priv->selected->transformation.y = self->priv->selected->image_box.y / self->priv->max_image_height;
 		gth_image_print_job_update_preview (self);
 	}
 }
@@ -1757,11 +1700,11 @@ print_operation_done_cb (GtkPrintOperation       *operation,
 
 
 GthImagePrintJob *
-gth_image_print_job_new (GList        *file_data_list,
-			 GthFileData  *current,
-			 GdkPixbuf    *current_image,
-			 const char   *event_name,
-			 GError      **error)
+gth_image_print_job_new (GList            *file_data_list,
+			 GthFileData      *current,
+			 cairo_surface_t  *current_image,
+			 const char       *event_name,
+			 GError          **error)
 {
 	GthImagePrintJob *self;
 	GList            *scan;
@@ -1779,7 +1722,7 @@ gth_image_print_job_new (GList        *file_data_list,
 
 			image_info = gth_image_info_new (file_data);
 			if ((current_image != NULL) && g_file_equal (file_data->file, current->file))
-				gth_image_info_set_pixbuf (image_info, current_image);
+				gth_image_info_set_image  (image_info, current_image);
 
 			self->priv->images[n++] = image_info;
 		}
diff --git a/extensions/image_print/gth-image-print-job.h b/extensions/image_print/gth-image-print-job.h
index 4dce857..67a734c 100644
--- a/extensions/image_print/gth-image-print-job.h
+++ b/extensions/image_print/gth-image-print-job.h
@@ -50,7 +50,7 @@ struct _GthImagePrintJobClass {
 GType              gth_image_print_job_get_type (void);
 GthImagePrintJob * gth_image_print_job_new      (GList                    *file_data_list,
 						 GthFileData              *current,
-						 GdkPixbuf                *current_image,
+						 cairo_surface_t          *current_image,
 						 const char               *event_name,
 						 GError                  **error);
 void               gth_image_print_job_run      (GthImagePrintJob         *self,
diff --git a/extensions/image_print/gth-load-image-info-task.c b/extensions/image_print/gth-load-image-info-task.c
index a7d4711..5cdcbda 100644
--- a/extensions/image_print/gth-load-image-info-task.c
+++ b/extensions/image_print/gth-load-image-info-task.c
@@ -125,13 +125,13 @@ image_loader_ready_cb (GObject      *source_object,
 		g_cancellable_set_error_if_cancelled (gth_task_get_cancellable (GTH_TASK (self)), &error);
 
 	if (error == NULL) {
-		GdkPixbuf *pixbuf;
+		cairo_surface_t *surface;
 
 		image_info = self->priv->images[self->priv->current];
-		pixbuf = gth_image_get_pixbuf (image);
-		if (pixbuf != NULL) {
-			gth_image_info_set_pixbuf (image_info, pixbuf);
-			g_object_unref (pixbuf);
+		surface = gth_image_get_cairo_surface (image);
+		if (surface != NULL) {
+			gth_image_info_set_image  (image_info, surface);
+			cairo_surface_destroy (surface);
 		}
 	}
 	else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
@@ -168,7 +168,7 @@ load_current_image (GthLoadImageInfoTask *self)
 			   FALSE,
 			   ((double) self->priv->current + 0.5) / self->priv->n_images);
 
-	if (image_info->pixbuf == NULL)
+	if (image_info->image == NULL)
 		gth_image_loader_load (self->priv->loader,
 				       image_info->file_data,
 				       -1,
diff --git a/gthumb/cairo-utils.c b/gthumb/cairo-utils.c
index 02a07ba..a7fa1ae 100644
--- a/gthumb/cairo-utils.c
+++ b/gthumb/cairo-utils.c
@@ -506,6 +506,59 @@ _cairo_image_surface_transform (cairo_surface_t *source,
 }
 
 
+cairo_surface_t *
+_cairo_image_surface_color_shift (cairo_surface_t *image,
+				  int              shift)
+{
+	cairo_surface_t *shifted;
+	int              i, j;
+	int              width, height, src_stride, dest_stride;
+	guchar          *src_pixels, *src_row, *src_pixel;
+	guchar          *dest_pixels, *dest_row, *dest_pixel;
+	int              val;
+	guchar           r, g, b, a;
+
+	shifted = _cairo_image_surface_create_compatible (image);
+
+	width       = cairo_image_surface_get_width (image);
+	height      = cairo_image_surface_get_height (image);
+	src_stride  = cairo_image_surface_get_stride (image);
+	src_pixels  = cairo_image_surface_get_data (image);
+	dest_stride = cairo_image_surface_get_stride (shifted);
+	dest_pixels = cairo_image_surface_get_data (shifted);
+
+	src_row = src_pixels;
+	dest_row = dest_pixels;
+	for (i = 0; i < height; i++) {
+		src_pixel = src_row;
+		dest_pixel  = dest_row;
+
+		for (j = 0; j < width; j++) {
+			CAIRO_GET_RGBA (src_pixel, r, g, b, a);
+
+			val = r + shift;
+			r = CLAMP (val, 0, 255);
+
+			val = g + shift;
+			g = CLAMP (val, 0, 255);
+
+			val = b + shift;
+			b = CLAMP (val, 0, 255);
+
+			CAIRO_SET_RGBA (dest_pixel, r, g, b, a);
+
+			src_pixel += 4;
+			dest_pixel += 4;
+		}
+
+		src_row += src_stride;
+		dest_row += dest_stride;
+	}
+
+	return shifted;
+}
+
+
 void
 _cairo_copy_line_as_rgba (guchar *dest,
 			 guchar *src,
diff --git a/gthumb/cairo-utils.h b/gthumb/cairo-utils.h
index eba5161..44b8785 100644
--- a/gthumb/cairo-utils.h
+++ b/gthumb/cairo-utils.h
@@ -169,9 +169,11 @@ void               _cairo_image_surface_transform_get_steps (cairo_format_t
 							     int                   *line_start_p,
 							     int                   *line_step_p,
 							     int                   *pixel_step_p);
-cairo_surface_t *  _cairo_image_surface_transform           (cairo_surface_t       *surface,
+cairo_surface_t *  _cairo_image_surface_transform           (cairo_surface_t       *image,
 							     GthTransform           transform);
-void               _cairo_copy_line_as_rgba                  (guchar                *dest,
+cairo_surface_t *  _cairo_image_surface_color_shift         (cairo_surface_t       *image,
+							     int                    shift);
+void               _cairo_copy_line_as_rgba                 (guchar                *dest,
 							     guchar                *src,
 							     guint                  width,
 							     guint                  alpha);
diff --git a/gthumb/pixbuf-utils.c b/gthumb/pixbuf-utils.c
index 7809a60..54fac12 100644
--- a/gthumb/pixbuf-utils.c
+++ b/gthumb/pixbuf-utils.c
@@ -131,41 +131,6 @@ _gdk_pixbuf_scale_simple_safe (const GdkPixbuf *src,
 }
 
 
-GdkPixbuf *
-_gdk_pixbuf_scale_composite (const GdkPixbuf *src,
-			     int              dest_width,
-			     int              dest_height,
-			     GdkInterpType    interp_type)
-{
-	GdkPixbuf *dest;
-
-	if (! gdk_pixbuf_get_has_alpha (src))
-		return _gdk_pixbuf_scale_simple_safe (src, dest_width, dest_height, interp_type);
-
-	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, gdk_pixbuf_get_has_alpha (src), 8, dest_width, dest_height);
-	if (dest == NULL)
-		return NULL;
-
-	gdk_pixbuf_composite_color (src,
-				    dest,
-				    0, 0, dest_width, dest_height, 0, 0,
-				    (double) dest_width / gdk_pixbuf_get_width (src),
-				    (double) dest_height / gdk_pixbuf_get_height (src),
-				    interp_type,
-				    255,
-				    0, 0,
-				    200,
-				    0xFFFFFF,
-				    0xFFFFFF);
-
-	return dest;
-}
-
-
 /*
  * Returns a transformed image.
  */
@@ -218,49 +183,6 @@ _gdk_pixbuf_transform (GdkPixbuf    *src,
 }
 
 
-void
-_gdk_pixbuf_colorshift (GdkPixbuf *dest,
-			GdkPixbuf *src,
-			int        shift)
-{
-	int     i, j;
-	int     width, height, has_alpha, srcrowstride, destrowstride;
-	guchar *target_pixels;
-	guchar *original_pixels;
-	guchar *pixsrc;
-	guchar *pixdest;
-	int     val;
-	guchar  r,g,b;
-
-	has_alpha       = gdk_pixbuf_get_has_alpha (src);
-	width           = gdk_pixbuf_get_width (src);
-	height          = gdk_pixbuf_get_height (src);
-	srcrowstride    = gdk_pixbuf_get_rowstride (src);
-	destrowstride   = gdk_pixbuf_get_rowstride (dest);
-	target_pixels   = gdk_pixbuf_get_pixels (dest);
-	original_pixels = gdk_pixbuf_get_pixels (src);
-
-	for (i = 0; i < height; i++) {
-		pixdest = target_pixels + i*destrowstride;
-		pixsrc  = original_pixels + i*srcrowstride;
-		for (j = 0; j < width; j++) {
-			r            = *(pixsrc++);
-			g            = *(pixsrc++);
-			b            = *(pixsrc++);
-			val          = r + shift;
-			*(pixdest++) = CLAMP (val, 0, 255);
-			val          = g + shift;
-			*(pixdest++) = CLAMP (val, 0, 255);
-			val          = b + shift;
-			*(pixdest++) = CLAMP (val, 0, 255);
-
-			if (has_alpha)
-				*(pixdest++) = *(pixsrc++);
-		}
-	}
-}
-
-
 char *
 _gdk_pixbuf_get_type_from_mime_type (const char *mime_type)
 {
diff --git a/gthumb/pixbuf-utils.h b/gthumb/pixbuf-utils.h
index 19240cd..6d31a42 100644
--- a/gthumb/pixbuf-utils.h
+++ b/gthumb/pixbuf-utils.h
@@ -36,16 +36,10 @@ GdkPixbuf * _gdk_pixbuf_scale_simple_safe        (const GdkPixbuf *src,
 					          int              dest_width,
 					          int              dest_height,
 					          GdkInterpType    interp_type);
-GdkPixbuf * _gdk_pixbuf_scale_composite          (const GdkPixbuf *src,
-			     	     	          int              dest_width,
-			     	     	          int              dest_height,
-			     	     	          GdkInterpType    interp_type);
 GdkPixbuf * _gdk_pixbuf_transform                (GdkPixbuf       *src,
 					          GthTransform     transform);
-void        _gdk_pixbuf_colorshift               (GdkPixbuf       *dest,
-					          GdkPixbuf       *src,
-					          int              shift);
 char *      _gdk_pixbuf_get_type_from_mime_type  (const char      *mime_type);
+
 gboolean    scale_keeping_ratio_min              (int             *width,
 					          int             *height,
 					          int              min_width,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]