summaryrefslogtreecommitdiff
path: root/src/nsterm.h
diff options
context:
space:
mode:
authorAlan Third <alan@idiocy.org>2019-06-05 21:51:33 +0100
committerAlan Third <alan@idiocy.org>2019-06-05 22:28:46 +0100
commit610fb73ab6d7a22b722f523d6ebc4aa8fa1db7c9 (patch)
tree8a3ee992ccc310071ac5a97ced8907652974c88e /src/nsterm.h
parent9201cf62ce9f17793bb6103050c9ba27eb942e57 (diff)
downloademacs-610fb73ab6d7a22b722f523d6ebc4aa8fa1db7c9.tar.gz
Add native image rotation and cropping
* lisp/image.el (image--get-imagemagick-and-warn): Only fallback to ImageMagick if native transforms aren't available. * src/dispextern.h (INIT_MATRIX, COPY_MATRIX, MULT_MATRICES): New macros for matrix manipulation. (HAVE_NATIVE_SCALING, HAVE_NATIVE_TRANSFORMS): Rename and change all relevant locations. * src/image.c (x_set_image_rotation): (x_set_transform): New functions. (x_set_image_size): Use transform matrix for resizing under X and NS. (x_set_image_crop): New function. (lookup_image): Use the new transform functions. (Fimage_scaling_p, Fimage_transforms_p): Rename and update all callers. * src/nsimage.m (ns_load_image): Remove rotation code. (ns_image_set_transform): New function. ([EmacsImage dealloc]): Release the saved transform. ([EmacsImage rotate:]): Remove unneeded method. ([EmacsImage setTransform:]): New method. * src/nsterm.h (EmacsImage): Add transform property and update method definitions. * src/nsterm.m (ns_dumpglyphs_image): Use the transform to draw the image correctly. * src/xterm.c (x_composite_image): Use PictOpSrc as we don't care about alpha values here. * doc/lispref/display.texi (Image Descriptors): Add :rotation. (ImageMagick Images): Remove :rotation.
Diffstat (limited to 'src/nsterm.h')
-rw-r--r--src/nsterm.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nsterm.h b/src/nsterm.h
index 1e56276ca3c..567f462ec69 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -632,6 +632,8 @@ typedef id instancetype;
unsigned char *pixmapData[5]; /* shortcut to access pixel data */
NSColor *stippleMask;
unsigned long xbm_fg;
+@public
+ NSAffineTransform *transform;
}
+ (instancetype)allocInitFromFile: (Lisp_Object)file;
- (void)dealloc;
@@ -648,7 +650,7 @@ typedef id instancetype;
- (NSColor *)stippleMask;
- (Lisp_Object)getMetadata;
- (BOOL)setFrame: (unsigned int) index;
-- (instancetype)rotate: (double)rotation;
+- (void)setTransform: (double[3][3]) m;
@end
@@ -1201,6 +1203,7 @@ extern bool ns_load_image (struct frame *f, struct image *img,
extern int ns_image_width (void *img);
extern int ns_image_height (void *img);
extern void ns_image_set_size (void *img, int width, int height);
+extern void ns_image_set_transform (void *img, double m[3][3]);
extern unsigned long ns_get_pixel (void *img, int x, int y);
extern void ns_put_pixel (void *img, int x, int y, unsigned long argb);
extern void ns_set_alpha (void *img, int x, int y, unsigned char a);