Plaster

common-lisp
(define-subwidget (image-widget background) (q+:make-qpixmap (background-path image-widget)) (when (and background-hue (/= 0 background-hue)) (with-finalizing ((image (q+:to-image background))) (dotimes (x (q+:width background)) (dotimes (y (q+:height background)) (with-finalizing* ((rgb (q+:pixel image x y)) (color (q+:make-qcolor (ldb (byte 8 16) rgb) (ldb (byte 8 8) rgb) (ldb (byte 8 0) rgb)))) (let ((hue (q+:hsv-hue color))) (fast-call (QColor set-hsv int int int) color (mod (+ hue background-hue) 360) (q+:hsv-saturation color) (q+:value color)) (setf (q+:pixel image x y) (q+:rgb color)))))) (let ((old-background background)) (setf background (q+:qpixmap-from-image image)) (finalize old-background)))))