Thu Jan 27, 2022 1:21 pm
(define (adapt l1 l2 m)
(if (null? l)
'()
(cons ((* (car l1) m) + (* (car l1) ( - 1 m))
(adapt (cdr l1) ( cdr l2) m))
)
)
)
(define (painter y dy ) ; Paint the founded Rectangle
(begin
(define color (adapt '(12 12 12) '(122 122 122) 0.4) ) ; Defines a shade of Red as Color for the Rectangle
(gimp-image-select-rectangle image 2 0 y 300 dy ) ; Defines the Shape for the Rectangle
(gimp-context-set-foreground color) ; Set the Color to fill the Shape of the Rectangle
(gimp-edit-fill layer FILL-FOREGROUND) ; Paint finally the Rectangle
)
)
Thu Jan 27, 2022 2:26 pm
(define (adapt color1 color2 ratio)
(if (null? color1)
'()
(cons (+(* (car color1) ratio) (* (car color1) (- 1 ratio)))
(adapt (cdr color1) (cdr color2) ratio)
) ) )
(adapt '(12 12 12) '(it does not matter) 0.4)
Fri Jan 28, 2022 9:33 am
> (define (adapt color1 color2 ratio)
(if (null? color1)
'()
(cons (+(* (car color1) ratio) (* (car color2) (- 1 ratio)))
(adapt (cdr color1) (cdr color2) ratio)
) ) )
adapt
> (adapt '(12 12 12) '(1 1 1) 0.4)
(5,4.0 5,4.0 5,4.0)
> (adapt '(12 12 12) '(12 12 12) 0.4)
(12.0 12.0 12.0)
> (adapt '(12 12 12) '(6 6 6) 0.4)
(8,4.0 8,4.0 8,4.0)
> (adapt '(12 12 12) '(6 6 6) 0.5)
(9.0 9.0 9.0)
> (adapt '(12 12 12) '(0 0 0) 0.5)
(6.0 6.0 6.0)
> (adapt '(12 12 12) '(0 0 0) 0.75)
(9.0 9.0 9.0)