Function: image--scale-map

image--scale-map is a byte-compiled function defined in image.el.gz.

Signature

(image--scale-map MAP SCALE)

Documentation

Scale MAP according to SCALE.

Destructively modifies and returns MAP.

Source Code

;; Defined in /usr/src/emacs/lisp/image.el.gz
(defun image--scale-map (map scale)
  "Scale MAP according to SCALE.
Destructively modifies and returns MAP."
  (pcase-dolist (`(,`(,type . ,coords) ,_id ,_plist) map)
    (pcase-exhaustive type
      ('rect
       (setf (caar coords) (round (* (caar coords) scale)))
       (setf (cdar coords) (round (* (cdar coords) scale)))
       (setf (cadr coords) (round (* (cadr coords) scale)))
       (setf (cddr coords) (round (* (cddr coords) scale))))
      ('circle
       (setf (caar coords) (round (* (caar coords) scale)))
       (setf (cdar coords) (round (* (cdar coords) scale)))
       (setcdr coords (round (* (cdr coords) scale))))
      ('poly
       (dotimes (i (length coords))
         (aset coords i
               (round (* (aref coords i) scale)))))))
  map)