Function: image-transform-check-size

image-transform-check-size is a byte-compiled function defined in image-mode.el.gz.

Signature

(image-transform-check-size)

Documentation

Check that the image exactly fits the width/height of the window.

Do this for an image of type imagemagick to make sure that the elisp code matches the way ImageMagick computes the bounding box of a rotated image.

Source Code

;; Defined in /usr/src/emacs/lisp/image-mode.el.gz
(defun image-transform-check-size ()
  "Check that the image exactly fits the width/height of the window.

Do this for an image of type `imagemagick' to make sure that the
elisp code matches the way ImageMagick computes the bounding box
of a rotated image."
  (when (and (not (numberp image-transform-resize))
	     (boundp 'image-type))
    (let ((size (image-display-size (image-get-display-property) t)))
      (cond ((eq image-transform-resize 'fit-width)
	     (cl-assert (= (car size)
			(- (nth 2 (window-inside-pixel-edges))
			   (nth 0 (window-inside-pixel-edges))))
		     t))
	    ((eq image-transform-resize 'fit-height)
	     (cl-assert (= (cdr size)
			(- (nth 3 (window-inside-pixel-edges))
			   (nth 1 (window-inside-pixel-edges))))
		     t))))))