Function: image-crop--crop-image-update
image-crop--crop-image-update is a byte-compiled function defined in
image-crop.el.gz.
Signature
(image-crop--crop-image-update AREA DATA SIZE TYPE CUT TEXT)
Source Code
;; Defined in /usr/src/emacs/lisp/image/image-crop.el.gz
(defun image-crop--crop-image-update (area data size type cut text)
(let* ((image-scaling-factor 1)
(osize (image-size (create-image data nil t) t))
(factor (/ (float (car osize)) (car size)))
;; width x height + left + top
(width (abs (truncate (* factor (- (cl-getf area :right)
(cl-getf area :left))))))
(height (abs (truncate (* factor (- (cl-getf area :bottom)
(cl-getf area :top))))))
(left (truncate (* factor (min (cl-getf area :left)
(cl-getf area :right)))))
(top (truncate (* factor (min (cl-getf area :top)
(cl-getf area :bottom))))))
(image-crop--insert-image-data
(with-temp-buffer
(set-buffer-multibyte nil)
(insert data)
(if cut
(image-crop--process image-crop-cut-command
`((?l . ,left)
(?t . ,top)
(?r . ,(+ left width))
(?b . ,(+ top height))
(?c . ,cut)
(?f . ,(cadr (split-string type "/")))))
(image-crop--process image-crop-crop-command
`((?l . ,left)
(?t . ,top)
(?w . ,width)
(?h . ,height)
(?f . ,(cadr (split-string type "/"))))))
(buffer-string))
text)))