Function: image-transform-width
image-transform-width is a byte-compiled function defined in
image-mode.el.gz.
Signature
(image-transform-width WIDTH HEIGHT)
Documentation
Return the bounding box width of a rotated WIDTH x HEIGHT rectangle.
The rotation angle is the value of image-transform-rotation in degrees.
Source Code
;; Defined in /usr/src/emacs/lisp/image-mode.el.gz
;;; Image transformation
(defsubst image-transform-width (width height)
"Return the bounding box width of a rotated WIDTH x HEIGHT rectangle.
The rotation angle is the value of `image-transform-rotation' in degrees."
(let ((angle (degrees-to-radians image-transform-rotation)))
;; Assume, w.l.o.g., that the vertices of the rectangle have the
;; coordinates (+-w/2, +-h/2) and that (0, 0) is the center of the
;; rotation by the angle A. The projections onto the first axis
;; of the vertices of the rotated rectangle are +- (w/2) cos A +-
;; (h/2) sin A, and the difference between the largest and the
;; smallest of the four values is the expression below.
(+ (* width (abs (cos angle))) (* height (abs (sin angle))))))