Function: image--default-smoothing

image--default-smoothing is a byte-compiled function defined in image.el.gz.

Signature

(image--default-smoothing IMAGE)

Documentation

Say whether IMAGE should be smoothed when transformed.

Return lambda if the decision should be deferred to the time IMAGE is loaded.

Source Code

;; Defined in /usr/src/emacs/lisp/image.el.gz
(defun image--default-smoothing (image)
  "Say whether IMAGE should be smoothed when transformed.
Return `lambda' if the decision should be deferred to the time IMAGE is
loaded."
  (let* ((props (nthcdr 5 image))
         (scaling (plist-get props :scale))
         (rotation (plist-get props :rotation)))
    (cond
     ;; The scale of the image won't be available until
     ;; `image_set_transform', and as such, defer to its judgment.
     ((eq scaling 'default) 'lambda)
     ;; We always smooth when scaling down and small upwards scaling.
     ((and scaling (< scaling 2))
      t)
     ;; Smooth when doing non-90-degree rotation
     ((and rotation
           (or (not (zerop (mod rotation 1)))
               (not (zerop (% (truncate rotation) 90)))))
      t)
     (t nil))))