diff options
| author | Alan Third | 2019-01-02 21:00:09 +0000 |
|---|---|---|
| committer | Alan Third | 2019-01-10 19:24:20 +0000 |
| commit | a1b7a3f2a3957a399d6c3c7bcffa07ac67da82fc (patch) | |
| tree | 478594bd679f2db099fcb6320750f24fcedf5fc6 /doc | |
| parent | c342b26371480316024e1e5d63cd8b3f035dda69 (diff) | |
| download | emacs-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.texi | 90 |
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 |
| 5113 | as a pressed button; otherwise, it appears as an unpressed button. | 5113 | as a pressed button; otherwise, it appears as an unpressed button. |
| 5114 | 5114 | ||
| 5115 | @item :width @var{width}, :height @var{height} | ||
| 5116 | The @code{:width} and @code{:height} keywords are used for scaling the | ||
| 5117 | image. If only one of them is specified, the other one will be | ||
| 5118 | calculated so as to preserve the aspect ratio. If both are specified, | ||
| 5119 | aspect ratio may not be preserved. | ||
| 5120 | |||
| 5121 | @item :max-width @var{max-width}, :max-height @var{max-height} | ||
| 5122 | The @code{:max-width} and @code{:max-height} keywords are used for | ||
| 5123 | scaling if the size of the image exceeds these values. If | ||
| 5124 | @code{:width} is set, it will have precedence over @code{max-width}, | ||
| 5125 | and if @code{:height} is set, it will have precedence over | ||
| 5126 | @code{max-height}, but you can otherwise mix these keywords as you | ||
| 5127 | wish. | ||
| 5128 | |||
| 5129 | If both @code{:max-width} and @code{:height} are specified, but | ||
| 5130 | @code{:width} is not, preserving the aspect ratio might require that | ||
| 5131 | width exceeds @code{:max-width}. If this happens, scaling will use a | ||
| 5132 | smaller value for the height so as to preserve the aspect ratio while | ||
| 5133 | not exceeding @code{:max-width}. Similarly when both | ||
| 5134 | @code{:max-height} and @code{:width} are specified, but @code{:height} | ||
| 5135 | is 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, | ||
| 5137 | you'll end up with an image that is 300x150: Preserving the aspect | ||
| 5138 | ratio and not exceeding the ``max'' setting. This combination of | ||
| 5139 | parameters is a useful way of saying ``display this image as large as | ||
| 5140 | possible, but no larger than the available display area''. | ||
| 5141 | |||
| 5142 | @item :scale @var{scale} | ||
| 5143 | This should be a number, where values higher than 1 means to increase | ||
| 5144 | the size, and lower means to decrease the size, by multiplying both | ||
| 5145 | the width and height. For instance, a value of 0.25 will make the | ||
| 5146 | image a quarter size of what it originally was. If the scaling makes | ||
| 5147 | the image larger than specified by @code{:max-width} or | ||
| 5148 | @code{:max-height}, the resulting size will not exceed those two | ||
| 5149 | values. If both @code{:scale} and @code{:height}/@code{:width} are | ||
| 5150 | specified, the height/width will be adjusted by the specified scaling | ||
| 5151 | factor. | ||
| 5152 | |||
| 5153 | @item :index @var{frame} | ||
| 5154 | @xref{Multi-Frame Images}. | ||
| 5155 | |||
| 5115 | @item :conversion @var{algorithm} | 5156 | @item :conversion @var{algorithm} |
| 5116 | This specifies a conversion algorithm that should be applied to the | 5157 | This specifies a conversion algorithm that should be applied to the |
| 5117 | image before it is displayed; the value, @var{algorithm}, specifies | 5158 | image 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 | ||
| 5296 | This 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 | |||
| 5300 | If image scaling is not supported, @code{:width}, @code{:height}, | ||
| 5301 | @code{:scale}, @code{:max-width} and @code{:max-height} will only be | ||
| 5302 | usable 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 | |||
| 5387 | supports transparency. If the value is @code{nil}, it defaults to the | 5438 | supports transparency. If the value is @code{nil}, it defaults to the |
| 5388 | frame's background color. | 5439 | frame's background color. |
| 5389 | 5440 | ||
| 5390 | @item :width @var{width}, :height @var{height} | ||
| 5391 | The @code{:width} and @code{:height} keywords are used for scaling the | ||
| 5392 | image. If only one of them is specified, the other one will be | ||
| 5393 | calculated so as to preserve the aspect ratio. If both are specified, | ||
| 5394 | aspect ratio may not be preserved. | ||
| 5395 | |||
| 5396 | @item :max-width @var{max-width}, :max-height @var{max-height} | ||
| 5397 | The @code{:max-width} and @code{:max-height} keywords are used for | ||
| 5398 | scaling if the size of the image of the image exceeds these values. | ||
| 5399 | If @code{:width} is set it will have precedence over @code{max-width}, | ||
| 5400 | and if @code{:height} is set it will have precedence over | ||
| 5401 | @code{max-height}, but you can otherwise mix these keywords as you | ||
| 5402 | wish. @code{:max-width} and @code{:max-height} will always preserve | ||
| 5403 | the aspect ratio. | ||
| 5404 | |||
| 5405 | If both @code{:width} and @code{:max-height} has been set (but | ||
| 5406 | @code{:height} has not been set), then @code{:max-height} will have | ||
| 5407 | precedence. The same is the case for the opposite combination: The | ||
| 5408 | ``max'' keyword has precedence. That is, if you have a 200x100 image | ||
| 5409 | and specify that @code{:width} should be 400 and @code{:max-height} | ||
| 5410 | should be 150, you'll end up with an image that is 300x150: Preserving | ||
| 5411 | the aspect ratio and not exceeding the ``max'' setting. This | ||
| 5412 | combination of parameters is a useful way of saying ``display this | ||
| 5413 | image as large as possible, but no larger than the available display | ||
| 5414 | area''. | ||
| 5415 | |||
| 5416 | @item :scale @var{scale} | ||
| 5417 | This should be a number, where values higher than 1 means to increase | ||
| 5418 | the size, and lower means to decrease the size. For instance, a value | ||
| 5419 | of 0.25 will make the image a quarter size of what it originally was. | ||
| 5420 | If the scaling makes the image larger than specified by | ||
| 5421 | @code{:max-width} or @code{:max-height}, the resulting size will not | ||
| 5422 | exceed those two values. If both @code{:scale} and | ||
| 5423 | @code{:height}/@code{:width} are specified, the height/width will be | ||
| 5424 | adjusted by the specified scaling factor. | ||
| 5425 | |||
| 5426 | @item :format @var{type} | 5441 | @item :format @var{type} |
| 5427 | The value, @var{type}, should be a symbol specifying the type of the | 5442 | The value, @var{type}, should be a symbol specifying the type of the |
| 5428 | image data, as found in @code{image-format-suffixes}. This is used | 5443 | image 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} |
| 5433 | Specifies a rotation angle in degrees. | 5448 | Specifies 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 |