Graechan wrote:
Got it with this
Code:
(define (splineValue)
(let* (
(cp.1 0 0)
(cp.2 38 31)
(cp.3 125 129)
(cp.4 197 223)
(cp.5 255 255)
(cp.6 255 255)
(cp.7 255 255)
(cp.8 255 255))
(gimp-curves-spline inner-bevel-layer 0 16 (splineValue))
)
)
Thanks to all as getting the right syntax was driving me MAD
No, what you've presented will not work. You have defined a procedure which calls itself and will loop forever. I think you have misplaced a parenthesis.
The
gimp-curves-* procedures expect the last argument to be a Scheme 'vector', which in some other programming languages might be called an 'array'. A 'vector' is very similar to a Scheme 'list' but has some important differences (e.g., you can't take a 'car' or a 'cdr' of a vector and you can't use 'map' or 'apply' on them).
The methods of specifying the gimp-curves vector that have been presented so far in this thread are overly complicated at best, and might not work depending upon the user's setup.
There are two simple ways of creating a 'vector' suitable for use in the
gimp-curves-* filters. The first is to use the
#(...) form to generate a constant vector.
Code:
(gimp-curves-spline drawable HISTOGRAM-VALUE 4 #(0 255 255 0))
(gimp-curves-explicit drawable
HISTOGRAM-VALUE
256
#(0 0 0 0 0 0 0 0 0 0 10 10 10 10 10 10 10 10 10 10 10
20 20 20 20 20 20 20 20 20 20 30 30 30 30 30 30 30 30 30
40 40 40 40 40 40 40 40 40 40 40 50 50 50 50 50 50 50 50 50 50
60 60 60 60 60 60 60 60 60 70 70 70 70 70 70 70 70 70 70 70
80 80 80 80 80 80 80 80 80 80 90 90 90 90 90 90 90 90 90
100 100 100 100 100 100 100 100 100 100 110 110 110 110 110 110 110 110 110 110 110
120 120 120 120 120 120 120 120 120 130 130 130 130 130 130 130 130 130 130
140 140 140 140 140 140 140 140 140 140 140 150 150 150 150 150 150 150 150 150
160 160 160 160 160 160 160 160 160 160 170 170 170 170 170 170 170 170 170 170 170
180 180 180 180 180 180 180 180 180 180 190 190 190 190 190 190 190 190 190
200 200 200 200 200 200 200 200 200 200 200 210 210 210 210 210 210 210 210 210 210
220 220 220 220 220 220 220 220 220 230 230 230 230 230 230 230 230 230 230 230
240 240 240 240 240 240 240 240 240 240 250 250 250 250 250)
But the
#(...) form only works for constants; i.e., everything in the curves vector has to be a specific number and not a variable or result of an evaluated function.
If you want to create a calculated curve, or one that is obtained from external data (such as a file), then you need to use the
(vector ...) procedure.
Code:
(gimp-curves-spline drawable
HISTOGRAM-VALUE
6
(vector 0 0 gray-point (gamma gray-point) 255 255))
(gimp-curves-explicit drawable
HISTOGRAM-VALUE
256
(vector step-0 step-0 step-0 step-0 step-0 step-0 step-0 step-0 step-0 step-0 step-0 step-0 step-0
step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1
step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1 step-1
step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2
step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2 step-2
step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3
step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3 step-3
step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4
step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4 step-4
step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5
step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5 step-5
step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6
step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6 step-6
step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7
step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7 step-7
step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8
step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8 step-8
step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9
step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9 step-9
step-10 step-10 step-10 step-10 step-10 step-10 step-10 step-10 step-10 step-10 step-10 step-10
step-10 )
These two forms of
#(...) and
(vector ...) are quite similar to their corresponding operations with lists:
'(...) and
(list ...)Of course, you can generate your vector of points using an algorithmic procedure, just make sure your final result is vector and that you pass the number of points in the vector to the
gimp-curves-* procedure.
Code:
(let* ((curve (generate-some-kind-of-curve 0 255 256 2.2 ))
(number-of-points (vector-length curve)) )
(gimp-curves-explicit drawable
HISTOGRAM-VALUE
number-of-points
curve ))