Hi!

I'm Bela and I have a (perhabhs) simple problem with using the Scheme
language. I want to create a special picture that displays the f(x, y) =
sin(x^2 + y^2) function with grayscale colors. The x and y is the x and
y coordinate of a pixel on the image.
I calculate the value of this function on every pixel on the image, and
I would perform the following transrormation (C-style):
color[x, y] = (int) ( ( sin(x*x + y*y) + 1 ) * 255 / 2 )

In this case if the f(x, y) = -1, the color will be 0, and it will be
the black color(RGB:0,0,0),  the 1 will be 255, therefore it will be the
white color (RGB:255,255,255), and any other value will be transformed a
gray color (RGB:color[x,y],color[x,y],color[x,y]).

Well, I wrote a scheme function to perform this. The source is in the
attachment. But I haven't find anything about the casting float to int,
and I got a following error message.

"Script-Fu Error
ERROR: not a number (errobj colorIndex)"

I have no idea to solve this problem. I'm waiting for your great
advices.

THanks
Bela

sinus-function.scm

Reply via email to