04-23-2016, 12:03 PM
Okay, I officially give up.
I've been trying variants of this code trying to make it work for...
...
2 and a half hours, I think.
If anyone is familiar with Scheme, can you PLEASE tell me why this isn't working???
(note: I am scripting for GIMP)
The problem is that gimp-hue-saturation can't accept values lower than -180 or higher than 180.
When I run the script, it works fine until the hue-offset reaches 210, at which point, due to the conditional, it should wrap around to -150 which is equivalent.
It does not. The execution keeps complaining that I'm feeding it 210, which is greater than 180!
For some reason my conditional seems to be ignored or something??
What should happen is the following:
hue-step is 30 as per my selected settings in the menu (unimportant to this)
hue-change is incremented by multiplication.
hue-offset is then made from hue-change and the hue is offset by that amount
OR if hue-offset is more than 180
hue-offset is added to -360 (it's done weird since I thought maybe the negative number was the problem for a while. It wasn't.) to get -150, -120, -90, etc.
then it does the same procedure as it would have above.
But it doesn't.
And this is pissing me off. I've spent too long trying to learn the basics of this unorthadox language just so I can edit this damn script segment to work the way I want it to, but apparently even that eludes me, probably because of some obscure rule or obvious syntax problem. ARGH!
I've been trying variants of this code trying to make it work for...
...
2 and a half hours, I think.
If anyone is familiar with Scheme, can you PLEASE tell me why this isn't working???
(note: I am scripting for GIMP)
Code:
;snipped
(let loop ((i 1))
(if (< i frames)
(let* ((hue-change (* i hue-step))
(new-frame (car (gimp-layer-copy first-frame 0))))
(gimp-image-add-layer new-image new-frame 0)
(if (> hue-change 180)
(let* ((hue-offset (+ (- 0 360) hue-change))) (gimp-hue-saturation new-frame 0 hue-offset 0 0))
(let* ((hue-offset hue-change)) (gimp-hue-saturation new-frame 0 hue-offset 0 0)))
(loop (+ i 1)))))
;snipped
When I run the script, it works fine until the hue-offset reaches 210, at which point, due to the conditional, it should wrap around to -150 which is equivalent.
It does not. The execution keeps complaining that I'm feeding it 210, which is greater than 180!
For some reason my conditional seems to be ignored or something??
What should happen is the following:
hue-step is 30 as per my selected settings in the menu (unimportant to this)
hue-change is incremented by multiplication.
hue-offset is then made from hue-change and the hue is offset by that amount
OR if hue-offset is more than 180
hue-offset is added to -360 (it's done weird since I thought maybe the negative number was the problem for a while. It wasn't.) to get -150, -120, -90, etc.
then it does the same procedure as it would have above.
But it doesn't.
And this is pissing me off. I've spent too long trying to learn the basics of this unorthadox language just so I can edit this damn script segment to work the way I want it to, but apparently even that eludes me, probably because of some obscure rule or obvious syntax problem. ARGH!