summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--2.10/przem-apply-waves-effect.scm75
-rw-r--r--changelog.md3
2 files changed, 65 insertions, 13 deletions
diff --git a/2.10/przem-apply-waves-effect.scm b/2.10/przem-apply-waves-effect.scm
index 1578bc9..2608410 100644
--- a/2.10/przem-apply-waves-effect.scm
+++ b/2.10/przem-apply-waves-effect.scm
@@ -5,19 +5,65 @@
; ver. 1.250226-0
;(define (przem-apply-waves-effect image drawable amplitude wavelength phase type)
-(define (przem-apply-waves-effect image drawable)
-
- (let* (
- (width (car (gimp-image-width image)))
- (height (car (gimp-image-height image)))
- (amplitude 10) ; Amplituda fal
- (wavelength 50) ; Długość fali
- (type 0) ; Typ fali (0 - sinusoidalna, 1 - trójkątna, 2 - prostokątna)
- (phase 0) ; Faza fali
- )
- (plug-in-waves RUN-NONINTERACTIVE image drawable amplitude wavelength type phase)
- )
-)
+;(define (przem-apply-waves-effect image drawable)
+
+; (let* (
+; (width (car (gimp-image-width image)))
+; (height (car (gimp-image-height image)))
+ ; (amplitude 10) ; Amplituda fal
+ ; (wavelength 50) ; Długość fali
+ ; (type 0) ; Typ fali (0 - sinusoidalna, 1 - trójkątna, 2 - prostokątna)
+ ; (phase 0) ; Faza fali
+; )
+ ; (plug-in-waves RUN-NONINTERACTIVE image drawable amplitude wavelength type phase)
+ ; )
+;)
+(define (przem-apply-waves-effect image drawable amplitude frequency phase)
+ (let* (
+         (width (car (gimp-image-width image)))
+         (height (car (gimp-image-height image)))
+         (new-image (car (gimp-image-duplicate image)))
+         (new-drawable (car (gimp-image-get-active-drawable new-image)))
+ (y 0)
+ (x 0))
+ ;(gimp-image-undo-group-start image)
+
+ ;(gimp-image-insert-layer new-image new-drawable 0 -1)
+ (gimp-selection-none new-image)
+
+
+    (gimp-context-push)
+    (gimp-context-set-defaults)
+
+    ; Przejdź przez każdy piksel obrazu
+    (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)) )
+ (set! x (+ x 1))
+ )
+ (set! y (+ y 1))
+ )
+
+
+    (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)
+
+) )
+
+(define displayln (lambda (obj) (display obj) (display "\n")))
(script-fu-register "przem-apply-waves-effect"
@@ -33,6 +79,9 @@
;SF-ADJUSTMENT "Wave Length" '(50 0 100 1 10 0 0)
;SF-ADJUSTMENT "Phase Wave" '(0 0 100 1 10 0 0)
;SF-OPTION "Type" '("Sinusoidal" "Triangle" "Rectangular")
+ SF-VALUE "Amplitude" "10"
+  SF-VALUE "Frequency" "0.1"
+  SF-VALUE "Phase" "0"
)
diff --git a/changelog.md b/changelog.md
index 5b54ddb..c257bf8 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,6 @@
+# [2.250224-0] przem-apply-waves-effect.scm
+* Nowa propozycja z sincosinus
+
# [2.250223-3] przem-apply-cents-effect.scm
* Drobne literówki