aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorJoakim Verona2010-06-26 23:17:02 +0200
committerJoakim Verona2010-06-26 23:17:02 +0200
commitc7f514b5f17b4607690ebf37a3cb09538d5bcd8f (patch)
treea191831e7f5f099e5579cd01350d1690554833d1 /src/image.c
parent65a192e9bde95812af4cd52201f631ad59c1e523 (diff)
downloademacs-c7f514b5f17b4607690ebf37a3cb09538d5bcd8f.tar.gz
emacs-c7f514b5f17b4607690ebf37a3cb09538d5bcd8f.zip
image-mode changes. removed the imagemagick specific :geometry and :crop interface that wasnt very good.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/src/image.c b/src/image.c
index 7c6f5645097..217f9221841 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7592,6 +7592,10 @@ enum imagemagick_keyword_index
7592 IMAGEMAGICK_HEURISTIC_MASK, 7592 IMAGEMAGICK_HEURISTIC_MASK,
7593 IMAGEMAGICK_MASK, 7593 IMAGEMAGICK_MASK,
7594 IMAGEMAGICK_BACKGROUND, 7594 IMAGEMAGICK_BACKGROUND,
7595 IMAGEMAGICK_HEIGHT,
7596 IMAGEMAGICK_WIDTH,
7597 IMAGEMAGICK_ROTATION,
7598 IMAGEMAGICK_CROP,
7595 IMAGEMAGICK_LAST 7599 IMAGEMAGICK_LAST
7596 }; 7600 };
7597 7601
@@ -7609,7 +7613,11 @@ static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] =
7609 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, 7613 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
7610 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, 7614 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
7611 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}, 7615 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
7612 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} 7616 {":background", IMAGE_STRING_OR_NIL_VALUE, 0},
7617 {":height", IMAGE_INTEGER_VALUE, 0},
7618 {":width", IMAGE_INTEGER_VALUE, 0},
7619 {":rotation", IMAGE_NUMBER_VALUE, 0},
7620 {":crop", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
7613 }; 7621 };
7614/* Free X resources of imagemagick image IMG which is used on frame F. */ 7622/* Free X resources of imagemagick image IMG which is used on frame F. */
7615 7623
@@ -7733,14 +7741,15 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7733 MagickSetIteratorIndex(image_wand, ino); 7741 MagickSetIteratorIndex(image_wand, ino);
7734 7742
7735 /* If width and/or height is set in the display spec assume we want 7743 /* If width and/or height is set in the display spec assume we want
7736 to scale to those. */ 7744 to scale to those values. if either h or w is unspecified, the
7745 unspecified should be calculated from the specified to preserve
7746 aspect ratio. */
7737 7747
7738 value = image_spec_value (img->spec, QCwidth, NULL); 7748 value = image_spec_value (img->spec, QCwidth, NULL);
7739 desired_width = (INTEGERP (value) ? XFASTINT (value) : -1); 7749 desired_width = (INTEGERP (value) ? XFASTINT (value) : -1);
7740 value = image_spec_value (img->spec, QCheight, NULL); 7750 value = image_spec_value (img->spec, QCheight, NULL);
7741 desired_height = (INTEGERP (value) ? XFASTINT (value) : -1); 7751 desired_height = (INTEGERP (value) ? XFASTINT (value) : -1);
7742 /* TODO if h or w is left out, it should be calculated to preserve aspect ratio */ 7752
7743 /* get original w and h, these will be recalculated before final blit*/
7744 height = MagickGetImageHeight (image_wand); 7753 height = MagickGetImageHeight (image_wand);
7745 width = MagickGetImageWidth (image_wand); 7754 width = MagickGetImageWidth (image_wand);
7746 7755
@@ -7796,15 +7805,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7796 MagickCropImage(image_wand, w,h, x,y); 7805 MagickCropImage(image_wand, w,h, x,y);
7797 } 7806 }
7798 7807
7799 if (STRINGP (crop) && STRINGP (geometry))
7800 {
7801 printf("MagickTransformImage %s %s\n", SDATA(crop), SDATA(geometry));
7802 image_wand = MagickTransformImage (image_wand, SDATA (crop),
7803 SDATA (geometry));
7804 /* TODO differ between image_wand and transform_wand. */
7805 }
7806
7807
7808 /* Furthermore :rotation. we need background color and angle for 7808 /* Furthermore :rotation. we need background color and angle for
7809 rotation. */ 7809 rotation. */
7810 /* 7810 /*
@@ -7830,8 +7830,8 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7830 } 7830 }
7831 } 7831 }
7832 7832
7833 /* Finaly we are done manipulating the image, 7833 /* Finaly we are done manipulating the image, figure out resulting
7834 figure out resulting width, height, and then transfer ownerwship to Emacs. 7834 width, height, and then transfer ownerwship to Emacs.
7835 */ 7835 */
7836 height = MagickGetImageHeight (image_wand); 7836 height = MagickGetImageHeight (image_wand);
7837 width = MagickGetImageWidth (image_wand); 7837 width = MagickGetImageWidth (image_wand);
@@ -7866,9 +7866,7 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7866 7866
7867 /* Copy imagegmagick image to x with primitive yet robust pixel 7867 /* Copy imagegmagick image to x with primitive yet robust pixel
7868 pusher loop. This has been tested a lot with many different 7868 pusher loop. This has been tested a lot with many different
7869 images, it doesnt work too well with image archive formats though! 7869 images.
7870
7871 Also seems slow.
7872 */ 7870 */
7873 7871
7874 /* Copy pixels from the imagemagick image structure to the x image map. */ 7872 /* Copy pixels from the imagemagick image structure to the x image map. */
@@ -7901,10 +7899,6 @@ imagemagick_load_image (/* Pointer to emacs frame structure. */
7901 if (imagemagick_rendermethod == 1) 7899 if (imagemagick_rendermethod == 1)
7902 { 7900 {
7903 /* Try if magicexportimage is any faster than pixelpushing. */ 7901 /* Try if magicexportimage is any faster than pixelpushing. */
7904 /* printf("ximg: bitmap_unit:%d format:%d byte_order:%d depth:%d
7905 bits_per_pixel:%d\n", */
7906 /* ximg->bitmap_unit,ximg->format,ximg->byte_order,
7907 ximg->depth,ximg->bits_per_pixel); */
7908 int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/ 7902 int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/
7909 char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ 7903 char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/
7910 /* Try to create a x pixmap to hold the imagemagick pixmap. */ 7904 /* Try to create a x pixmap to hold the imagemagick pixmap. */