Function: shr-make-placeholder-image
shr-make-placeholder-image is a byte-compiled function defined in
shr.el.gz.
Signature
(shr-make-placeholder-image DOM)
Source Code
;; Defined in /usr/src/emacs/lisp/net/shr.el.gz
(defun shr-make-placeholder-image (dom)
(let* ((edges (and
(get-buffer-window (current-buffer))
(window-inside-pixel-edges
(get-buffer-window (current-buffer)))))
(scaling (image-compute-scaling-factor image-scaling-factor))
(width (truncate
(* (or (shr-string-number (dom-attr dom 'width)) 100)
scaling)))
(height (truncate
(* (or (shr-string-number (dom-attr dom 'height)) 100)
scaling)))
(max-width
(and edges
(truncate (* shr-max-image-proportion
(- (nth 2 edges) (nth 0 edges))))))
(max-height (and edges
(truncate (* shr-max-image-proportion
(- (nth 3 edges) (nth 1 edges))))))
svg)
(when (and max-width
(> width max-width))
(setq height (truncate (* (/ (float max-width) width) height))
width max-width))
(when (and max-height
(> height max-height))
(setq width (truncate (* (/ (float max-height) height) width))
height max-height))
(setq svg (svg-create width height))
(svg-gradient svg "background" 'linear '((0 . "#b0b0b0") (100 . "#808080")))
(svg-rectangle svg 0 0 width height :gradient "background"
:stroke-width 2 :stroke-color "black")
(let ((image (svg-image svg :scale 1)))
(setf (image-property image :ascent) 100)
image)))