From 247543547e083ae8130d5a25fe25241a74da468b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw?= Date: Thu, 13 Feb 2025 19:04:58 +0100 Subject: przem-apply-sepia.scm-1.250213-0 --- 2.10/przem-apply-sepia.scm | 40 ++++++++++++++++++++++++++++++++++++---- 3.0/przem-apply-sepia-v3.scm | 16 +++++++++------- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/2.10/przem-apply-sepia.scm b/2.10/przem-apply-sepia.scm index 91e43a3..449d627 100644 --- a/2.10/przem-apply-sepia.scm +++ b/2.10/przem-apply-sepia.scm @@ -2,9 +2,9 @@ ; author: PRP ; licencja: Public Domain ; Gdańsk - 07-02-2025 -; ver. 1.250208-0 +; ver. 1.250213-0 -(define (przem-apply-sepia image drawable value-slider-sepia) +(define (przem-apply-sepia image drawable value-slider-sepia gradient-reverse gradient-shape) (let* ( (image-width (car (gimp-image-width image))) @@ -13,6 +13,7 @@ (center-y (* image-height 0.5)) ; either is OK (sepia-layer (car (gimp-layer-new image image-width image-height RGBA-IMAGE "Sepia Layer" 100 NORMAL-MODE))) (is-nocolorful (car (gimp-drawable-is-gray drawable))) ; czy obraz jest w odcieniach szarości + (radius (sqrt (+ (* center-x center-x) (* center-y center-y)))) ) (gimp-image-undo-group-start image) @@ -27,12 +28,41 @@ ; Dodanie koloru sepii (gimp-context-set-foreground '(112 66 20)) ; Kolor sepii - + (gimp-context-set-background '(233 213 186)) ; Kolor sepii + + (gimp-image-insert-layer image sepia-layer 0 -1) (gimp-selection-all image) - (gimp-edit-blend sepia-layer FG-BG-RGB-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE TRUE 3 0 TRUE 0 0 image-width image-height) + (if (= gradient-reverse TRUE) + (begin + + (if (= gradient-shape TRUE) + (begin + (gimp-edit-blend sepia-layer FG-BG-RGB-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE TRUE 3 0 TRUE 0 0 image-width image-height) + ) + (begin + (gimp-edit-blend sepia-layer CUSTOM-MODE NORMAL-MODE + GRADIENT-RADIAL 100 0 REPEAT-NONE FALSE + FALSE 0 0 TRUE + center-x center-y radius 0) + ) ) ) + (begin + + (if (= gradient-shape TRUE) + (begin + (gimp-edit-blend sepia-layer FG-BG-RGB-MODE NORMAL-MODE GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE TRUE 3 0 TRUE 0 0 image-width image-height) + ) + (begin + (gimp-edit-blend sepia-layer CUSTOM-MODE NORMAL-MODE + GRADIENT-RADIAL 100 0 REPEAT-NONE FALSE + FALSE 0 0 TRUE + center-x center-y radius 0) + ) ) ) ) + + + ; ) ; Zmiana krycia warstwy (gimp-layer-set-opacity sepia-layer value-slider-sepia) @@ -53,6 +83,8 @@ SF-IMAGE "Image" 0 SF-DRAWABLE "Drawable" 0 SF-ADJUSTMENT "Sepia intensity" '(50 0 100 1 10 0 0) + SF-TOGGLE "Gradient reverse" FALSE + SF-TOGGLE "Shape" TRUE ) (script-fu-menu-register "przem-apply-sepia" diff --git a/3.0/przem-apply-sepia-v3.scm b/3.0/przem-apply-sepia-v3.scm index 0ff0292..5689358 100644 --- a/3.0/przem-apply-sepia-v3.scm +++ b/3.0/przem-apply-sepia-v3.scm @@ -2,16 +2,17 @@ ; author: PRP ; licencja: Public Domain ; Gdańsk - 07-02-2025 -; ver. 1.2502012-0 for GIMP 3 +; ver. 1.2502013-0 for GIMP 3 (define (przem-apply-sepia-v3 image drawable value-slider-sepia gradient-reverse gradient-shape) (let* ( (image-width (car (gimp-image-get-width image))) (image-height (car (gimp-image-get-height image))) (center-x (/ image-width 2)) - (center-y (* image-height 0.5)) ; either is OK + (center-y (/ image-height 2)) ; either is OK (sepia-layer (car (gimp-layer-new image image-width image-height RGBA-IMAGE "Sepia Layer" 100 LAYER-MODE-NORMAL))) (is-nocolorful (car (gimp-drawable-is-gray drawable))) ; czy obraz jest w odcieniach szarości + (radius (sqrt (+ (* center-x center-x) (* center-y center-y)))) ) (gimp-image-undo-group-start image) @@ -29,15 +30,16 @@ (gimp-drawable-desaturate drawable DESATURATE-LIGHTNESS) ; Dodanie koloru sepii - (gimp-context-set-foreground (list 112 66 20)) ; sepia ciemniejszy - (gimp-context-set-foreground (list 233 213 186)) ; sepia jasniejszy (gimp-image-insert-layer image sepia-layer 0 -1) (gimp-context-push) - (gimp-context-set-foreground (list 112 66 20)) ; ciemniejsza - (gimp-context-set-background (list 210 180 140)) ; jasniejsza + (gimp-context-set-foreground (list 112 66 20)) ; sepia ciemniejszy + (gimp-context-set-background (list 233 213 186)) ; sepia jasniejszy + + ;(gimp-context-set-foreground (list 112 66 20)) ; ciemniejsza + ;(gimp-context-set-background (list 210 180 140)) ; jasniejsza ;(plug-in-checkerboard #:run-mode RUN-NONINTERACTIVE ; #:image image ; #:drawables (vector drawable) @@ -67,7 +69,7 @@ GRADIENT-SHAPEBURST-DIMPLED 0 FALSE 1 0 TRUE - 0 0 image-width image-height) + 0 0 center-x center-y) ) ) (gimp-context-pop) -- cgit v1.2.3