Function: pdf-util-image-displayed-edges
pdf-util-image-displayed-edges is a natively compiled function defined
in pdf-util.el.
Signature
(pdf-util-image-displayed-edges &optional WINDOW DISPLAYED-P)
Documentation
Return the visible region of the image in WINDOW.
Returns a list of pixel edges.
Source Code
;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-util.el
;; * ================================================================== *
;; * Scrolling
;; * ================================================================== *
(defun pdf-util-image-displayed-edges (&optional window displayed-p)
"Return the visible region of the image in WINDOW.
Returns a list of pixel edges."
(when displayed-p (pdf-util-assert-pdf-window window))
(let* ((edges (window-inside-pixel-edges window))
(isize (pdf-view-image-size displayed-p window))
(offset (if displayed-p
`(0 . 0)
(pdf-view-image-offset window)))
(hscroll (* (if displayed-p
(window-hscroll window)
(or (image-mode-window-get 'hscroll window) 0))
(frame-char-width (window-frame window))))
(vscroll (if displayed-p
(window-vscroll window t)
(or (image-mode-window-get 'vscroll window) 0)))
(x0 (+ hscroll (car offset)))
(y0 (+ vscroll (cdr offset)))
(x1 (min (car isize)
(+ x0 (- (nth 2 edges) (nth 0 edges)))))
(y1 (min (cdr isize)
(+ y0 (- (nth 3 edges) (nth 1 edges))))))
(mapcar #'round (list x0 y0 x1 y1))))