comparison src/image.c @ 1580:24ef7b610ed6

Backed out changeset 3d9f5c078521
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 01 May 2009 15:45:54 +0900
parents 3d9f5c078521
children cef502852c4f
comparison
equal deleted inserted replaced
1566:3d9f5c078521 1580:24ef7b610ed6
361 if (imd->cm) color_man_correct_region(imd->cm, *pixbuf, x, y, w, h); 361 if (imd->cm) color_man_correct_region(imd->cm, *pixbuf, x, y, w, h);
362 if (imd->desaturate) pixbuf_desaturate_rect(*pixbuf, x, y, w, h); 362 if (imd->desaturate) pixbuf_desaturate_rect(*pixbuf, x, y, w, h);
363 363
364 } 364 }
365 365
366 void image_alter_orientation(ImageWindow *imd, AlterType type) 366 void image_alter(ImageWindow *imd, AlterType type)
367 { 367 {
368 static const gint rotate_90[] = {1, 6, 7, 8, 5, 2, 3, 4, 1}; 368 static const gint rotate_90[] = {1, 6, 7, 8, 5, 2, 3, 4, 1};
369 static const gint rotate_90_cc[] = {1, 8, 5, 6, 7, 4, 1, 2, 3}; 369 static const gint rotate_90_cc[] = {1, 8, 5, 6, 7, 4, 1, 2, 3};
370 static const gint rotate_180[] = {1, 3, 4, 1, 2, 7, 8, 5, 6}; 370 static const gint rotate_180[] = {1, 3, 4, 1, 2, 7, 8, 5, 6};
371 static const gint mirror[] = {1, 2, 1, 4, 3, 6, 5, 8, 7}; 371 static const gint mirror[] = {1, 2, 1, 4, 3, 6, 5, 8, 7};
391 imd->orientation = mirror[imd->orientation]; 391 imd->orientation = mirror[imd->orientation];
392 break; 392 break;
393 case ALTER_FLIP: 393 case ALTER_FLIP:
394 imd->orientation = flip[imd->orientation]; 394 imd->orientation = flip[imd->orientation];
395 break; 395 break;
396 case ALTER_DESATURATE:
397 imd->desaturate = !imd->desaturate;
398 break;
396 case ALTER_NONE: 399 case ALTER_NONE:
397 imd->orientation = imd->image_fd->exif_orientation ? imd->image_fd->exif_orientation : 1; 400 imd->orientation = imd->image_fd->exif_orientation ? imd->image_fd->exif_orientation : 1;
401 imd->desaturate = FALSE;
398 break; 402 break;
399 default: 403 default:
400 return; 404 return;
401 break; 405 break;
402 } 406 }
403 407
404 if (type != ALTER_NONE) 408 if (type != ALTER_NONE && type != ALTER_DESATURATE)
405 { 409 {
406 if (imd->image_fd->user_orientation == 0) file_data_ref(imd->image_fd); 410 if (imd->image_fd->user_orientation == 0) file_data_ref(imd->image_fd);
407 imd->image_fd->user_orientation = imd->orientation; 411 imd->image_fd->user_orientation = imd->orientation;
408 } 412 }
409 else 413 else
411 if (imd->image_fd->user_orientation != 0) file_data_unref(imd->image_fd); 415 if (imd->image_fd->user_orientation != 0) file_data_unref(imd->image_fd);
412 imd->image_fd->user_orientation = 0; 416 imd->image_fd->user_orientation = 0;
413 } 417 }
414 418
415 pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation); 419 pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation);
416 }
417
418 void image_set_desaturate(ImageWindow *imd, gboolean desaturate)
419 {
420 imd->desaturate = desaturate;
421 if (imd->cm || imd->desaturate) 420 if (imd->cm || imd->desaturate)
422 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) ); 421 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, image_post_process_tile_color_cb, (gpointer) imd, (imd->cm != NULL) );
423 else 422 else
424 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, TRUE); 423 pixbuf_renderer_set_post_process_func((PixbufRenderer *)imd->pr, NULL, NULL, TRUE);
425 pixbuf_renderer_set_orientation((PixbufRenderer *)imd->pr, imd->orientation); 424 }
426 } 425
427
428 gboolean image_get_desaturate(ImageWindow *imd)
429 {
430 return imd->desaturate;
431 }
432 426
433 /* 427 /*
434 *------------------------------------------------------------------- 428 *-------------------------------------------------------------------
435 * read ahead (prebuffer) 429 * read ahead (prebuffer)
436 *------------------------------------------------------------------- 430 *-------------------------------------------------------------------