Function: image--flip-map
image--flip-map is a byte-compiled function defined in image.el.gz.
Signature
(image--flip-map MAP SIZE)
Documentation
Horizontally flip MAP according to SIZE.
Destructively modifies and returns MAP.
Source Code
;; Defined in /usr/src/emacs/lisp/image.el.gz
(defun image--flip-map (map size)
"Horizontally flip MAP according to SIZE.
Destructively modifies and returns MAP."
(pcase-dolist (`(,`(,type . ,coords) ,_id ,_plist) map)
(pcase-exhaustive type
('rect
(let ((x0 (- (car size) (cadr coords)))
(y0 (cdar coords))
(x1 (- (car size) (caar coords)))
(y1 (cddr coords)))
(setcar coords (cons x0 y0))
(setcdr coords (cons x1 y1))))
('circle
(setf (caar coords) (- (car size) (caar coords))))
('poly
(dotimes (i (length coords))
(when (= 0 (% i 2))
(aset coords i (- (car size) (aref coords i))))))))
map)