Function: pdf-view--bounding-box-to-slice

pdf-view--bounding-box-to-slice is a natively compiled function defined in pdf-view.el.

Signature

(pdf-view--bounding-box-to-slice BB)

Documentation

Convert bounding box BB to slice format for pdf-view-set-slice.

BB is a list (LEFT TOP RIGHT BOTTOM). Returns a list (X Y WIDTH HEIGHT).

Source Code

;; Defined in /nix/store/63h5z2vmzn0mfavcxi2idi23g5xcgkbl-emacs-packages-deps/share/emacs/site-lisp/elpa/pdf-tools-20260102.1101/pdf-view.el
(defun pdf-view--bounding-box-to-slice (bb)
  "Convert bounding box BB to slice format for `pdf-view-set-slice'.
BB is a list (LEFT TOP RIGHT BOTTOM).
Returns a list (X Y WIDTH HEIGHT)."
  (let* ((margin (max 0 (or pdf-view-bounding-box-margin 0)))
         (halfmargin (/ margin 2)))
    (cl-destructuring-bind (left top right bottom) bb
      (list (- left halfmargin) (- top halfmargin)
            (+ (- right left) margin) (+ (- bottom top) margin)))))