diff src/image.c @ 1566:3d9f5c078521

separated Orientation and Grayscale functions moved Grayscale to Color management menu
author nadvornik
date Sat, 25 Apr 2009 22:08:09 +0000
parents ffc44762e706
children c776b1310ca6
line wrap: on
line diff
--- a/src/image.c	Sat Apr 25 20:55:11 2009 +0000
+++ b/src/image.c	Sat Apr 25 22:08:09 2009 +0000
@@ -363,7 +363,7 @@
 
 }
 
-void image_alter(ImageWindow *imd, AlterType type)
+void image_alter_orientation(ImageWindow *imd, AlterType type)
 {
 	static const gint rotate_90[]    = {1,   6, 7, 8, 5, 2, 3, 4, 1};
 	static const gint rotate_90_cc[] = {1,   8, 5, 6, 7, 4, 1, 2, 3};
@@ -393,19 +393,15 @@
 		case ALTER_FLIP:
 			imd->orientation = flip[imd->orientation];
 			break;
-		case ALTER_DESATURATE:
-			imd->desaturate = !imd->desaturate;
-			break;
 		case ALTER_NONE:
 			imd->orientation = imd->image_fd->exif_orientation ? imd->image_fd->exif_orientation : 1;
-			imd->desaturate = FALSE;
 			break;
 		default:
 			return;
 			break;
 		}
 
-	if (type != ALTER_NONE && type != ALTER_DESATURATE)
+	if (type != ALTER_NONE)
 		{
 		if (imd->image_fd->user_orientation == 0) file_data_ref(imd->image_fd);
 		imd->image_fd->user_orientation = imd->orientation;
@@ -417,12 +413,22 @@
 		}
 
 	pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
+}
+
+void image_set_desaturate(ImageWindow *imd, gboolean desaturate)
+{
+	imd->desaturate = desaturate;
 	if (imd->cm || imd->desaturate)
 		pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) );
 	else
 		pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, TRUE);
+	pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
 }
 
+gboolean image_get_desaturate(ImageWindow *imd)
+{
+	return imd->desaturate;
+}
 
 /*
  *-------------------------------------------------------------------