aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorAlan Third2019-01-02 21:00:09 +0000
committerAlan Third2019-01-10 19:24:20 +0000
commita1b7a3f2a3957a399d6c3c7bcffa07ac67da82fc (patch)
tree478594bd679f2db099fcb6320750f24fcedf5fc6 /doc
parentc342b26371480316024e1e5d63cd8b3f035dda69 (diff)
downloademacs-a1b7a3f2a3957a399d6c3c7bcffa07ac67da82fc.tar.gz
emacs-a1b7a3f2a3957a399d6c3c7bcffa07ac67da82fc.zip
Add native image scaling (bug#33587)
* configure.ac: Test for XRender outside of xft checks. * src/Makefile.in (XRENDER_LIBS): List XRender libs separately from xft libs. * lisp/image.el (image--get-imagemagick-and-warn): Allow resizing if native scaling is available. * src/dispextern.h: Add XRender and image scaling stuff. (struct image): Add XRender Pictures. * src/image.c (x_create_bitmap_mask): (image_create_x_image_and_pixmap): Handle XRender Picture. (scale_image_size): (compute_image_size): Make available when any form of scaling is enabled. (x_set_image_size): New function. (lookup_image): Set image size. (x_create_x_image_and_pixmap): Create XRender Picture when necessary. (x_put_x_image): Handle the case where desired size != actual size. (free_image): Free XRender Pictures. (Fimage_scaling_p): New function. (syms_of_image): Add image-scaling-p. * src/nsimage.m (ns_load_image): Remove NS specific resizing. ([EmacsImage setSizeFromSpec:]): Remove method. (ns_image_set_size): New function. * src/nsterm.m (ns_draw_fringe_bitmap): Cocoa and GNUstep both have the same compositing functions, so remove unnecessary difference. * src/xterm.c (x_composite_image): New function. (x_draw_image_foreground): Use new x_composite_image function. * doc/lispref/display.texi (Image Descriptors): Document image-scaling-p and add resizing descriptors. (ImageMagick Images): Remove resizing descriptors.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/display.texi90
1 files changed, 51 insertions, 39 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 19424ecc7e6..350b3108715 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -5112,6 +5112,47 @@ This adds a shadow rectangle around the image. The value,
5112@var{relief} is negative, shadows are drawn so that the image appears 5112@var{relief} is negative, shadows are drawn so that the image appears
5113as a pressed button; otherwise, it appears as an unpressed button. 5113as a pressed button; otherwise, it appears as an unpressed button.
5114 5114
5115@item :width @var{width}, :height @var{height}
5116The @code{:width} and @code{:height} keywords are used for scaling the
5117image. If only one of them is specified, the other one will be
5118calculated so as to preserve the aspect ratio. If both are specified,
5119aspect ratio may not be preserved.
5120
5121@item :max-width @var{max-width}, :max-height @var{max-height}
5122The @code{:max-width} and @code{:max-height} keywords are used for
5123scaling if the size of the image exceeds these values. If
5124@code{:width} is set, it will have precedence over @code{max-width},
5125and if @code{:height} is set, it will have precedence over
5126@code{max-height}, but you can otherwise mix these keywords as you
5127wish.
5128
5129If both @code{:max-width} and @code{:height} are specified, but
5130@code{:width} is not, preserving the aspect ratio might require that
5131width exceeds @code{:max-width}. If this happens, scaling will use a
5132smaller value for the height so as to preserve the aspect ratio while
5133not exceeding @code{:max-width}. Similarly when both
5134@code{:max-height} and @code{:width} are specified, but @code{:height}
5135is not. For example, if you have a 200x100 image and specify that
5136@code{:width} should be 400 and @code{:max-height} should be 150,
5137you'll end up with an image that is 300x150: Preserving the aspect
5138ratio and not exceeding the ``max'' setting. This combination of
5139parameters is a useful way of saying ``display this image as large as
5140possible, but no larger than the available display area''.
5141
5142@item :scale @var{scale}
5143This should be a number, where values higher than 1 means to increase
5144the size, and lower means to decrease the size, by multiplying both
5145the width and height. For instance, a value of 0.25 will make the
5146image a quarter size of what it originally was. If the scaling makes
5147the image larger than specified by @code{:max-width} or
5148@code{:max-height}, the resulting size will not exceed those two
5149values. If both @code{:scale} and @code{:height}/@code{:width} are
5150specified, the height/width will be adjusted by the specified scaling
5151factor.
5152
5153@item :index @var{frame}
5154@xref{Multi-Frame Images}.
5155
5115@item :conversion @var{algorithm} 5156@item :conversion @var{algorithm}
5116This specifies a conversion algorithm that should be applied to the 5157This specifies a conversion algorithm that should be applied to the
5117image before it is displayed; the value, @var{algorithm}, specifies 5158image before it is displayed; the value, @var{algorithm}, specifies
@@ -5251,6 +5292,16 @@ This function returns @code{t} if image @var{spec} has a mask bitmap.
5251(@pxref{Input Focus}). 5292(@pxref{Input Focus}).
5252@end defun 5293@end defun
5253 5294
5295@defun image-scaling-p &optional frame
5296This function returns @code{t} if @var{frame} supports image scaling.
5297@var{frame} @code{nil} or omitted means to use the selected frame
5298(@pxref{Input Focus}).
5299
5300If image scaling is not supported, @code{:width}, @code{:height},
5301@code{:scale}, @code{:max-width} and @code{:max-height} will only be
5302usable through ImageMagick, if available (@pxref{ImageMagick Images}).
5303@end defun
5304
5254@node XBM Images 5305@node XBM Images
5255@subsection XBM Images 5306@subsection XBM Images
5256@cindex XBM 5307@cindex XBM
@@ -5387,42 +5438,6 @@ color, which is used as the image's background color if the image
5387supports transparency. If the value is @code{nil}, it defaults to the 5438supports transparency. If the value is @code{nil}, it defaults to the
5388frame's background color. 5439frame's background color.
5389 5440
5390@item :width @var{width}, :height @var{height}
5391The @code{:width} and @code{:height} keywords are used for scaling the
5392image. If only one of them is specified, the other one will be
5393calculated so as to preserve the aspect ratio. If both are specified,
5394aspect ratio may not be preserved.
5395
5396@item :max-width @var{max-width}, :max-height @var{max-height}
5397The @code{:max-width} and @code{:max-height} keywords are used for
5398scaling if the size of the image of the image exceeds these values.
5399If @code{:width} is set it will have precedence over @code{max-width},
5400and if @code{:height} is set it will have precedence over
5401@code{max-height}, but you can otherwise mix these keywords as you
5402wish. @code{:max-width} and @code{:max-height} will always preserve
5403the aspect ratio.
5404
5405If both @code{:width} and @code{:max-height} has been set (but
5406@code{:height} has not been set), then @code{:max-height} will have
5407precedence. The same is the case for the opposite combination: The
5408``max'' keyword has precedence. That is, if you have a 200x100 image
5409and specify that @code{:width} should be 400 and @code{:max-height}
5410should be 150, you'll end up with an image that is 300x150: Preserving
5411the aspect ratio and not exceeding the ``max'' setting. This
5412combination of parameters is a useful way of saying ``display this
5413image as large as possible, but no larger than the available display
5414area''.
5415
5416@item :scale @var{scale}
5417This should be a number, where values higher than 1 means to increase
5418the size, and lower means to decrease the size. For instance, a value
5419of 0.25 will make the image a quarter size of what it originally was.
5420If the scaling makes the image larger than specified by
5421@code{:max-width} or @code{:max-height}, the resulting size will not
5422exceed those two values. If both @code{:scale} and
5423@code{:height}/@code{:width} are specified, the height/width will be
5424adjusted by the specified scaling factor.
5425
5426@item :format @var{type} 5441@item :format @var{type}
5427The value, @var{type}, should be a symbol specifying the type of the 5442The value, @var{type}, should be a symbol specifying the type of the
5428image data, as found in @code{image-format-suffixes}. This is used 5443image data, as found in @code{image-format-suffixes}. This is used
@@ -5431,9 +5446,6 @@ hint to ImageMagick to help it detect the image type.
5431 5446
5432@item :rotation @var{angle} 5447@item :rotation @var{angle}
5433Specifies a rotation angle in degrees. 5448Specifies a rotation angle in degrees.
5434
5435@item :index @var{frame}
5436@xref{Multi-Frame Images}.
5437@end table 5449@end table
5438 5450
5439@node SVG Images 5451@node SVG Images