summaryrefslogtreecommitdiff
path: root/src/tools/marco-grayscale.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/marco-grayscale.c')
-rw-r--r--src/tools/marco-grayscale.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tools/marco-grayscale.c b/src/tools/marco-grayscale.c
index 8da539b5..7eb3e2b7 100644
--- a/src/tools/marco-grayscale.c
+++ b/src/tools/marco-grayscale.c
@@ -1,8 +1,8 @@
/* Hack for grayscaling an image */
-/*
+/*
* Copyright (C) 2002 Red Hat Inc.
- *
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
@@ -12,7 +12,7 @@
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
@@ -36,15 +36,15 @@ grayscale_pixbuf (GdkPixbuf *pixbuf)
int row;
int n_rows;
int width;
-
+
gray = gdk_pixbuf_copy (pixbuf);
rowstride = gdk_pixbuf_get_rowstride (gray);
pixstride = gdk_pixbuf_get_has_alpha (gray) ? 4 : 3;
-
+
pixels = gdk_pixbuf_get_pixels (gray);
n_rows = gdk_pixbuf_get_height (gray);
width = gdk_pixbuf_get_width (gray);
-
+
row = 0;
while (row < n_rows)
{
@@ -58,13 +58,13 @@ grayscale_pixbuf (GdkPixbuf *pixbuf)
p[0] = (guchar) v;
p[1] = (guchar) v;
p[2] = (guchar) v;
-
+
p += pixstride;
}
-
+
++row;
}
-
+
return gray;
}
@@ -74,7 +74,7 @@ main (int argc, char **argv)
GdkPixbuf *pixbuf;
GdkPixbuf *gray;
GError *err;
-
+
if (argc != 2)
{
g_printerr ("specify a single image on the command line\n");
@@ -82,7 +82,7 @@ main (int argc, char **argv)
}
g_type_init ();
-
+
err = NULL;
pixbuf = gdk_pixbuf_new_from_file (argv[1], &err);
if (err != NULL)
@@ -93,7 +93,7 @@ main (int argc, char **argv)
}
gray = grayscale_pixbuf (pixbuf);
-
+
err = NULL;
gdk_pixbuf_save (gray, "grayscale.png", "png", &err, NULL);
if (err != NULL)
@@ -104,6 +104,6 @@ main (int argc, char **argv)
}
g_print ("wrote grayscale.png\n");
-
+
return 0;
}