Commit 39d18967 authored by Darin Adler's avatar Darin Adler

Preparing for support for background images.

	* libnautilus/nautilus-background.h:
	* libnautilus/nautilus-background.c:
	Preparing for support for background images.

	* libnautilus/nautilus-background.c:
	* libnautilus/nautilus-debug.c:
	* libnautilus/nautilus-icon-canvas-item.c:
	* libnautilus/nautilus-icon-dnd.c:
	Add those braces that Maciej, John, and the style guide all prefer.

	* libnautilus/nautilus-file.c: (nautilus_file_set_metadata):
	A change to metadata is considered a change to the file.

	* libnautilus/nautilus-graphic-effects.c:
	* libnautilus/nautilus-graphic-effects.h:
	Added nautilus_ prefix to all the functions in here.

	* libnautilus/nautilus-gtk-extensions.c:
	* libnautilus/nautilus-gtk-extensions.h:
	(nautilus_point_in_allocation),	(nautilus_point_in_widget):
	Added hit testing help functions that check if a point is
	in a particular allocation/widget.

	* libnautilus/nautilus-icon-dnd.c: (get_gnome_icon_list_selection):
	Fixed a bug that happens when you get a 0-length piece of
	selection data.

	* libnautilus/nautilus-icon-dnd.h:
	Changed the icon list back to "x-gnome-icon-list".
	That's how the other GNOME folks want it, not "x-nautilus-icon-list".

	* src/nautilus-index-tabs.c:
	* src/nautilus-index-tabs.h:
	* src/nautilus-index-title.c:
	* src/nautilus-index-title.h:
	* src/ntl-index-panel.c:
	* src/ntl-index-panel.h:
	lite -> light, Other cleanup.

	* src/nautilus-index-title.c:
	* src/nautilus-index-title.h:
	(nautilus_index_title_hit_test_icon):
	* src/ntl-index-panel.c:
	(hit_test), (uri_is_local_image), (receive_dropped_uri_list),
	(receive_dropped_color):
	Added code needed to support dropping an image on the icon to set
	a custom icon. This doesn't yet update the icon in the panel itself,
	but I'll do that soon.
parent 66d503d1
2000-03-28 Darin Adler <darin@eazel.com>
* libnautilus/nautilus-background.h:
* libnautilus/nautilus-background.c:
Preparing for support for background images.
* libnautilus/nautilus-background.c:
* libnautilus/nautilus-debug.c:
* libnautilus/nautilus-icon-canvas-item.c:
* libnautilus/nautilus-icon-dnd.c:
Add those braces that Maciej, John, and the style guide all prefer.
* libnautilus/nautilus-file.c: (nautilus_file_set_metadata):
A change to metadata is considered a change to the file.
* libnautilus/nautilus-graphic-effects.c:
* libnautilus/nautilus-graphic-effects.h:
Added nautilus_ prefix to all the functions in here.
* libnautilus/nautilus-gtk-extensions.c:
* libnautilus/nautilus-gtk-extensions.h:
(nautilus_point_in_allocation), (nautilus_point_in_widget):
Added hit testing help functions that check if a point is
in a particular allocation/widget.
* libnautilus/nautilus-icon-dnd.c: (get_gnome_icon_list_selection):
Fixed a bug that happens when you get a 0-length piece of
selection data.
* libnautilus/nautilus-icon-dnd.h:
Changed the icon list back to "x-gnome-icon-list".
That's how the other GNOME folks want it, not "x-nautilus-icon-list".
* src/nautilus-index-tabs.c:
* src/nautilus-index-tabs.h:
* src/nautilus-index-title.c:
* src/nautilus-index-title.h:
* src/ntl-index-panel.c:
* src/ntl-index-panel.h:
lite -> light, Other cleanup.
* src/nautilus-index-title.c:
* src/nautilus-index-title.h:
(nautilus_index_title_hit_test_icon):
* src/ntl-index-panel.c:
(hit_test), (uri_is_local_image), (receive_dropped_uri_list),
(receive_dropped_color):
Added code needed to support dropping an image on the icon to set
a custom icon. This doesn't yet update the icon in the panel itself,
but I'll do that soon.
2000-03-28 John Sullivan <sullivan@eazel.com>
Maciej, Darin and I discussed the notify_title_change
......
......@@ -36,7 +36,6 @@ static void nautilus_background_initialize_class (gpointer klass);
static void nautilus_background_initialize (gpointer object,
gpointer klass);
static void nautilus_background_destroy (GtkObject *object);
static void nautilus_background_finalize (GtkObject *object);
static void nautilus_background_draw_flat_box (GtkStyle *style,
GdkWindow *window,
......@@ -59,7 +58,7 @@ enum {
static guint signals[LAST_SIGNAL];
struct _NautilusBackgroundDetails
struct NautilusBackgroundDetails
{
char *color;
char *tile_image_uri;
......@@ -84,7 +83,6 @@ nautilus_background_initialize_class (gpointer klass)
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
object_class->destroy = nautilus_background_destroy;
object_class->finalize = nautilus_background_finalize;
}
static void
......@@ -102,20 +100,10 @@ nautilus_background_destroy (GtkObject *object)
{
NautilusBackground *background;
background = NAUTILUS_BACKGROUND (object);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
static void
nautilus_background_finalize (GtkObject *object)
{
NautilusBackground *background;
background = NAUTILUS_BACKGROUND (object);
g_free (background->details);
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, finalize, (object));
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
NautilusBackground *
......@@ -171,14 +159,29 @@ nautilus_background_set_color (NautilusBackground *background,
gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]);
}
#if 0
void
nautilus_background_set_tile_image_uri (NautilusBackground *background,
const char *image_uri)
{
g_return_if_fail (NAUTILUS_IS_BACKGROUND (background));
g_free (background->details->color);
background->details->color = g_strdup (color);
gtk_signal_emit (GTK_OBJECT (background), signals[CHANGED]);
}
#endif
static GtkStyleClass *
nautilus_gtk_style_get_default_class (void)
{
static GtkStyleClass *default_class;
GtkStyle *style;
if (default_class == NULL) {
GtkStyle *style;
style = gtk_style_new ();
default_class = style->klass;
gtk_style_unref (style);
......@@ -194,12 +197,13 @@ nautilus_gdk_window_update_sizes (GdkWindow *window, int *width, int *height)
g_return_if_fail (width != NULL);
g_return_if_fail (height != NULL);
if (*width == -1 && *height == -1)
if (*width == -1 && *height == -1) {
gdk_window_get_size (window, width, height);
else if (*width == -1)
} else if (*width == -1) {
gdk_window_get_size (window, width, NULL);
else if (*height == -1)
} else if (*height == -1) {
gdk_window_get_size (window, NULL, height);
}
}
static void
......@@ -226,8 +230,9 @@ nautilus_background_draw_flat_box (GtkStyle *style,
if (state_type == GTK_STATE_NORMAL) {
background = nautilus_get_widget_background (widget);
if (background != NULL) {
if (nautilus_gradient_is_gradient (background->details->color))
if (nautilus_gradient_is_gradient (background->details->color)) {
call_parent = FALSE;
}
}
}
......@@ -405,7 +410,7 @@ nautilus_background_receive_dropped_color (NautilusBackground *background,
g_warning ("received invalid color data");
return;
}
channels = (guint16 *)selection_data->data;
channels = (guint16 *) selection_data->data;
color_spec = g_strdup_printf ("rgb:%04hX/%04hX/%04hX", channels[0], channels[1], channels[2]);
/* Figure out if the color was dropped close enough to an edge to create a gradient.
......@@ -416,16 +421,17 @@ nautilus_background_receive_dropped_color (NautilusBackground *background,
right_border = widget->allocation.width - 32;
top_border = 32;
bottom_border = widget->allocation.height - 32;
if (drop_location_x < left_border && drop_location_x <= right_border)
if (drop_location_x < left_border && drop_location_x <= right_border) {
new_gradient_spec = nautilus_gradient_set_left_color_spec (background->details->color, color_spec);
else if (drop_location_x >= left_border && drop_location_x > right_border)
} else if (drop_location_x >= left_border && drop_location_x > right_border) {
new_gradient_spec = nautilus_gradient_set_right_color_spec (background->details->color, color_spec);
else if (drop_location_y < top_border && drop_location_y <= bottom_border)
} else if (drop_location_y < top_border && drop_location_y <= bottom_border) {
new_gradient_spec = nautilus_gradient_set_top_color_spec (background->details->color, color_spec);
else if (drop_location_y >= top_border && drop_location_y > bottom_border)
} else if (drop_location_y >= top_border && drop_location_y > bottom_border) {
new_gradient_spec = nautilus_gradient_set_bottom_color_spec (background->details->color, color_spec);
else
} else {
new_gradient_spec = g_strdup (color_spec);
}
g_free (color_spec);
......
......@@ -43,8 +43,8 @@
#include <gdk/gdktypes.h>
#include <gtk/gtkwidget.h>
typedef struct _NautilusBackground NautilusBackground;
typedef struct _NautilusBackgroundClass NautilusBackgroundClass;
typedef struct NautilusBackground NautilusBackground;
typedef struct NautilusBackgroundClass NautilusBackgroundClass;
#define NAUTILUS_TYPE_BACKGROUND \
(nautilus_background_get_type ())
......@@ -87,15 +87,15 @@ void nautilus_background_receive_dropped_color (NautilusBackground *bac
/* Gets or creates a background so that it's attached to a widget. */
NautilusBackground *nautilus_get_widget_background (GtkWidget *widget);
typedef struct _NautilusBackgroundDetails NautilusBackgroundDetails;
typedef struct NautilusBackgroundDetails NautilusBackgroundDetails;
struct _NautilusBackground
struct NautilusBackground
{
GtkObject object;
NautilusBackgroundDetails *details;
};
struct _NautilusBackgroundClass
struct NautilusBackgroundClass
{
GtkObjectClass parent_class;
......
......@@ -75,8 +75,9 @@ nautilus_make_warnings_and_criticals_stop_in_debugger (const char *first_domain,
for (;;) {
domain = va_arg (domains, const char *);
if (domain == NULL)
if (domain == NULL) {
break;
}
nautilus_set_stop_after_default_log_handler (domain);
}
......
......@@ -63,7 +63,7 @@ char * nautilus_directory_get_file_metadata (NautilusDirectory *dire
const char *file_name,
const char *tag,
const char *default_metadata);
void nautilus_directory_set_file_metadata (NautilusDirectory *directory,
gboolean nautilus_directory_set_file_metadata (NautilusDirectory *directory,
const char *file_name,
const char *tag,
const char *default_metadata,
......
......@@ -1035,7 +1035,7 @@ nautilus_directory_get_file_metadata (NautilusDirectory *directory,
tag, default_metadata);
}
void
gboolean
nautilus_directory_set_file_metadata (NautilusDirectory *directory,
const char *file_name,
const char *tag,
......@@ -1048,9 +1048,9 @@ nautilus_directory_set_file_metadata (NautilusDirectory *directory,
const char *value;
xmlAttr *property_node;
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
g_return_if_fail (tag);
g_return_if_fail (tag[0]);
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
g_return_val_if_fail (tag != NULL, FALSE);
g_return_val_if_fail (tag[0] != '\0', FALSE);
/* If the data in the metafile is already correct, do nothing. */
old_metadata = nautilus_directory_get_file_metadata
......@@ -1058,7 +1058,7 @@ nautilus_directory_set_file_metadata (NautilusDirectory *directory,
old_metadata_matches = nautilus_strcmp (old_metadata, metadata) == 0;
g_free (old_metadata);
if (old_metadata_matches) {
return;
return FALSE;
}
/* Data that matches the default is represented in the tree by
......@@ -1084,6 +1084,8 @@ nautilus_directory_set_file_metadata (NautilusDirectory *directory,
/* Since we changed the tree, arrange for it to be written. */
nautilus_directory_request_write_metafile (directory);
return TRUE;
}
static int
......
......@@ -409,6 +409,7 @@ nautilus_file_set_metadata (NautilusFile *file,
tag,
default_metadata,
metadata);
nautilus_file_changed (file);
}
char *
......
......@@ -25,12 +25,7 @@
/* This file contains pixbuf manipulation routines used for graphical effects like pre-lighting
and selection hilighting */
#include <libgnome/gnome-defs.h>
#include <libgnomeui/gnome-canvas.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libart_lgpl/art_rgb_pixbuf_affine.h>
#include <libgnomeui/gnome-canvas-util.h>
#include <config.h>
#include "nautilus-graphic-effects.h"
/* shared utility to create a new pixbuf from the passed-in one */
......@@ -38,11 +33,17 @@
static GdkPixbuf *
create_new_pixbuf (GdkPixbuf *src)
{
g_return_val_if_fail (gdk_pixbuf_get_format (src) == ART_PIX_RGB, NULL);
g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 3)
|| (gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 4), NULL);
return gdk_pixbuf_new (gdk_pixbuf_get_format (src),
gdk_pixbuf_get_has_alpha (src),
gdk_pixbuf_get_bits_per_sample (src),
gdk_pixbuf_get_width (src),
gdk_pixbuf_get_height (src));
gdk_pixbuf_get_has_alpha (src),
gdk_pixbuf_get_bits_per_sample (src),
gdk_pixbuf_get_width (src),
gdk_pixbuf_get_height (src));
}
/* utility routine to bump the level of a color component with pinning */
......@@ -52,41 +53,47 @@ lighten_component (guchar cur_value)
{
int new_value = cur_value;
new_value += 24 + (new_value >> 3);
if (new_value > 255)
if (new_value > 255) {
new_value = 255;
}
return (guchar) new_value;
}
GdkPixbuf *
create_spotlight_pixbuf (GdkPixbuf* src)
nautilus_create_spotlight_pixbuf (GdkPixbuf* src)
{
int i, j;
int width, height, has_alpha, src_rowstride, dst_rowstride;
guchar *target_pixels;
guchar *original_pixels;
guchar *pixsrc;
guchar *pixdest;
GdkPixbuf *dest;
int i, j;
int width, height, has_alpha, src_row_stride, dst_row_stride;
guchar *target_pixels, *original_pixels;
guchar *pixsrc, *pixdest;
g_return_val_if_fail (gdk_pixbuf_get_format (src) == ART_PIX_RGB, NULL);
g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 3)
|| (gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 4), NULL);
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
dest = create_new_pixbuf (src);
has_alpha = gdk_pixbuf_get_has_alpha (src);
width = gdk_pixbuf_get_width (src);
height = gdk_pixbuf_get_height (src);
src_rowstride = gdk_pixbuf_get_rowstride (src);
dst_rowstride = gdk_pixbuf_get_rowstride (dest);
dst_row_stride = gdk_pixbuf_get_rowstride (dest);
src_row_stride = gdk_pixbuf_get_rowstride (src);
target_pixels = gdk_pixbuf_get_pixels (dest);
original_pixels = gdk_pixbuf_get_pixels (src);
for (i = 0; i < height; i++) {
pixdest = target_pixels + i*dst_rowstride;
pixsrc = original_pixels + i*src_rowstride;
pixdest = target_pixels + i * dst_row_stride;
pixsrc = original_pixels + i * src_row_stride;
for (j = 0; j < width; j++) {
*(pixdest++) = lighten_component(*(pixsrc++));
*(pixdest++) = lighten_component(*(pixsrc++));
*(pixdest++) = lighten_component(*(pixsrc++));
*pixdest++ = lighten_component (*pixsrc++);
*pixdest++ = lighten_component (*pixsrc++);
*pixdest++ = lighten_component (*pixsrc++);
if (has_alpha) {
*(pixdest++) = *(pixsrc++);
*pixdest++ = *pixsrc++;
}
}
}
......@@ -96,137 +103,155 @@ create_spotlight_pixbuf (GdkPixbuf* src)
/* the following routine was stolen from the panel to darken a pixbuf, by manipulating the saturation */
#define INTENSITY(r, g, b) (((r)*77 + (g)*150 + (b)*28)>>8)
/* saturation is 0-255, darken is 0-255 */
GdkPixbuf *
create_darkened_pixbuf (GdkPixbuf *src, int saturation, int darken)
nautilus_create_darkened_pixbuf (GdkPixbuf *src, int saturation, int darken)
{
gint i, j;
gint width, height, has_alpha, src_rowstride, dst_rowstride;
guchar *target_pixels;
guchar *original_pixels;
guchar *pixsrc;
guchar *pixdest;
gint width, height, src_row_stride, dest_row_stride;
gboolean has_alpha;
guchar *target_pixels, *original_pixels;
guchar *pixsrc, *pixdest;
guchar intensity;
guchar alpha;
guchar negalpha;
guchar r,g,b;
guchar r, g, b;
GdkPixbuf *dest;
g_return_val_if_fail (gdk_pixbuf_get_format (src) == ART_PIX_RGB, NULL);
g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 3)
|| (gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 4), NULL);
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
dest = create_new_pixbuf (src);
has_alpha = gdk_pixbuf_get_has_alpha (src);
width = gdk_pixbuf_get_width (src);
height = gdk_pixbuf_get_height (src);
src_rowstride = gdk_pixbuf_get_rowstride (src);
dst_rowstride = gdk_pixbuf_get_rowstride (dest);
dest_row_stride = gdk_pixbuf_get_rowstride (dest);
src_row_stride = gdk_pixbuf_get_rowstride (src);
target_pixels = gdk_pixbuf_get_pixels (dest);
original_pixels = gdk_pixbuf_get_pixels (src);
for (i = 0; i < height; i++) {
pixdest = target_pixels + i*dst_rowstride;
pixsrc = original_pixels + i*src_rowstride;
pixdest = target_pixels + i * dest_row_stride;
pixsrc = original_pixels + i * src_row_stride;
for (j = 0; j < width; j++) {
r = *(pixsrc++);
g = *(pixsrc++);
b = *(pixsrc++);
intensity = INTENSITY(r,g,b);
negalpha = ((255 - saturation)*darken)>>8;
alpha = (saturation*darken)>>8;
*(pixdest++) = (negalpha * intensity + alpha * r) >> 8;
*(pixdest++) = (negalpha * intensity + alpha * g) >> 8;
*(pixdest++) = (negalpha * intensity + alpha * b) >> 8;
if (has_alpha)
*(pixdest++) = *(pixsrc++);
r = *pixsrc++;
g = *pixsrc++;
b = *pixsrc++;
intensity = (r * 77 + g * 150 + b * 28) >> 8;
negalpha = ((255 - saturation) * darken) >> 8;
alpha = (saturation * darken) >> 8;
*pixdest++ = (negalpha * intensity + alpha * r) >> 8;
*pixdest++ = (negalpha * intensity + alpha * g) >> 8;
*pixdest++ = (negalpha * intensity + alpha * b) >> 8;
if (has_alpha) {
*pixdest++ = *pixsrc++;
}
}
}
return dest;
}
#undef INTENSITY
/* this routine colorizes the passed-in pixbuf by multiplying each pixel with the passed in color */
GdkPixbuf *
create_colorized_pixbuf(GdkPixbuf *src, int red_value, int green_value, int blue_value)
nautilus_create_colorized_pixbuf(GdkPixbuf *src,
int red_value,
int green_value,
int blue_value)
{
int i, j;
int width, height, has_alpha, src_rowstride, dst_rowstride;
int width, height, has_alpha, src_row_stride, dst_row_stride;
guchar *target_pixels;
guchar *original_pixels;
guchar *pixsrc;
guchar *pixdest;
GdkPixbuf *dest;
g_return_val_if_fail (gdk_pixbuf_get_format (src) == ART_PIX_RGB, NULL);
g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 3)
|| (gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 4), NULL);
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
g_return_val_if_fail (gdk_pixbuf_get_format (src) == ART_PIX_RGB, NULL);
g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 3)
|| (gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 4), NULL);
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
dest = create_new_pixbuf (src);
has_alpha = gdk_pixbuf_get_has_alpha (src);
width = gdk_pixbuf_get_width (src);
height = gdk_pixbuf_get_height (src);
src_rowstride = gdk_pixbuf_get_rowstride (src);
dst_rowstride = gdk_pixbuf_get_rowstride (dest);
src_row_stride = gdk_pixbuf_get_rowstride (src);
dst_row_stride = 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*dst_rowstride;
pixsrc = original_pixels + i*src_rowstride;
pixdest = target_pixels + i*dst_row_stride;
pixsrc = original_pixels + i*src_row_stride;
for (j = 0; j < width; j++) {
*(pixdest++) = (*(pixsrc++) * red_value) >> 8;
*(pixdest++) = (*(pixsrc++) * green_value) >> 8;
*(pixdest++) = (*(pixsrc++) * blue_value) >> 8;
*pixdest++ = (*pixsrc++ * red_value) >> 8;
*pixdest++ = (*pixsrc++ * green_value) >> 8;
*pixdest++ = (*pixsrc++ * blue_value) >> 8;
if (has_alpha) {
*(pixdest++) = *(pixsrc++);
*pixdest++ = *pixsrc++;
}
}
}
return dest;
}
/* this routine takes the source pixbuf and returns a new one that's semi-transparent, by
clearing every other pixel's alpha value in a checkerboard grip. We have to do the
checkerboard instead of reducing the alpha since it will be turned into an alpha-less
gdkpixmap and mask for the actual dragging */
GdkPixbuf *
make_semi_transparent(GdkPixbuf *source_pixbuf)
GdkPixbuf *
nautilus_make_semi_transparent (GdkPixbuf *src)
{
gint i, j, temp_alpha;
gint width, height, has_alpha, src_rowstride, dst_rowstride;
guchar *target_pixels;
guchar *original_pixels;
guchar *pixsrc;
guchar *pixdest;
gint width, height, has_alpha, src_row_stride, dst_row_stride;
guchar *target_pixels, *original_pixels;
guchar *pixsrc, *pixdest;
guchar alpha_value;
GdkPixbuf *dest_pixbuf;
guchar start_alpha_value;
has_alpha = gdk_pixbuf_get_has_alpha (source_pixbuf);
width = gdk_pixbuf_get_width (source_pixbuf);
height = gdk_pixbuf_get_height (source_pixbuf);
src_rowstride = gdk_pixbuf_get_rowstride (source_pixbuf);
/* allocate the destination pixbuf to be a clone of the source */
dest_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_format (source_pixbuf),
TRUE,
gdk_pixbuf_get_bits_per_sample (source_pixbuf),
width,
height);
dst_rowstride = gdk_pixbuf_get_rowstride (dest_pixbuf);
g_return_val_if_fail (gdk_pixbuf_get_format (src) == ART_PIX_RGB, NULL);
g_return_val_if_fail ((!gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 3)
|| (gdk_pixbuf_get_has_alpha (src)
&& gdk_pixbuf_get_n_channels (src) == 4), NULL);
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (src) == 8, NULL);
dest_pixbuf = create_new_pixbuf (src);
has_alpha = gdk_pixbuf_get_has_alpha (src);
width = gdk_pixbuf_get_width (src);
height = gdk_pixbuf_get_height (src);
src_row_stride = gdk_pixbuf_get_rowstride (src);
dst_row_stride = gdk_pixbuf_get_rowstride (dest_pixbuf);
/* set up pointers to the actual pixels */
target_pixels = gdk_pixbuf_get_pixels (dest_pixbuf);
original_pixels = gdk_pixbuf_get_pixels (source_pixbuf);
original_pixels = gdk_pixbuf_get_pixels (src);
/* loop through the pixels to do the actual work, copying from the source to the destination */
start_alpha_value = ~0;
for (i = 0; i < height; i++) {