From ebfb8cccf6bfd9308b83df58d901f99752256319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw?= Date: Tue, 25 Feb 2025 17:40:12 +0100 Subject: przem-apply-waves-effect.scm-2.250225-0 --- 2.10/przem-apply-waves-effect.scm | 60 +++++++++++++++++++++++++++++---------- changelog.md | 3 ++ 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/2.10/przem-apply-waves-effect.scm b/2.10/przem-apply-waves-effect.scm index 2608410..52effba 100644 --- a/2.10/przem-apply-waves-effect.scm +++ b/2.10/przem-apply-waves-effect.scm @@ -24,10 +24,15 @@          (height (car (gimp-image-height image)))          (new-image (car (gimp-image-duplicate image)))          (new-drawable (car (gimp-image-get-active-drawable new-image))) + (pixw (cons-array 3 'byte)) + (resize-y 0) + (resize-x 0) (y 0) (x 0)) - ;(gimp-image-undo-group-start image) - + + (aset pixw 0 255) + (aset pixw 1 255) + (aset pixw 2 255) ;(gimp-image-insert-layer new-image new-drawable 0 -1) (gimp-selection-none new-image) @@ -35,34 +40,59 @@     (gimp-context-push)     (gimp-context-set-defaults) + ; symulacja + (while (< y height) +      (while (< x width) + (set! resize-x (+ x (* amplitude (sin (+ (* frequency x) phase))))) +          (set! resize-y (+ y (* amplitude (cos (+ (* frequency y) phase))))) + (set! x (+ x 1)) + ) + (set! x 0) + (set! y (+ y 1)) + ) + + + (gimp-image-scale new-image resize-x resize-y) +    (set! new-drawable (car (gimp-image-get-active-drawable new-image))) + + (set! x 0) + (set! y 0) +     ; Przejdź przez każdy piksel obrazu -    (while (< y height) - +    (while (< y height)       (while (< x width)         (let* (           (new-x (+ x (* amplitude (sin (+ (* frequency x) phase)))))           (new-y (+ y (* amplitude (cos (+ (* frequency y) phase))))) -          (color (car (gimp-image-pick-color image drawable x y TRUE TRUE 1))) - (gimp-message-set-handler 0) - (display "color: ") (displayln color) -          (gimp-drawable-set-pixel new-drawable new-x new-y color)) ) +          (color (cdr (gimp-image-pick-color image drawable x y FALSE FALSE 1))) + ;(pre-pixel (vector (gimp-drawable-get-pixel drawable x y))) + ;(pixel0 (vector-ref pre-pixel 0) ) + ;(pixel1 (vector-ref pre-pixel 1) ) + ;(pixel2 (vector-ref pre-pixel 2) ) + (type (car (gimp-drawable-get-pixel drawable x y))) + (pixel (cdr (gimp-drawable-get-pixel drawable x y))) + ) +          (gimp-drawable-set-pixel new-drawable new-x new-y 3 color) + (gimp-message "Test image saved.") + (display "pixel: ") (displayln pixel) + ) (set! x (+ x 1)) - ) + ) + (set! x 0) (set! y (+ y 1)) - ) + ) + ;(gimp-image-set-resolution image newdpi newdpi)     (gimp-context-pop) - ;(gimp-image-merge-down new-image new-drawable CLIP-TO-IMAGE)     (gimp-display-new new-image) - ;(gimp-image-undo-group-end image)) (gimp-selection-none new-image) - ;(gimp-displays-flush) + (gimp-displays-flush) -) ) - +) ) + (define displayln (lambda (obj) (display obj) (display "\n"))) diff --git a/changelog.md b/changelog.md index c257bf8..4224953 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,6 @@ +# [2.250225-0] przem-apply-waves-effect.scm +* Próba skopiowania barwy pixela + # [2.250224-0] przem-apply-waves-effect.scm * Nowa propozycja z sincosinus -- cgit v1.2.3