Urgent Hue and Saturation filter

Hi.

It is for testing high resolution outputs.

(Code on iPhone)

xmax=SCREEN_WIDTH()
ymax=SCREEN_HEIGHT()
graphics mode normal
fill color 0.1,0.1,0.1
fill rect 0,0 to xmax,ymax

graphics mode saturation

main:
r=rnd(1)
g=rnd(1)
b=rnd(1)
x=rnd(xmax)
y=rnd(ymax)
w=rnd(100)
h=rnd(100)
fill color r,g,b
fill rect x,y size w,h

goto main

What app are you using to run that code?

Called SmartBasic.
Very fast ! and been using for ~ 3 years now.
Perfect for experimentation.

I have currently got something running, but not right.
Here is what is supposed to happen which is required in sequence:

Create an external high resolution screen.
Fill the screen with R=G=B (any grey scale but not 0,0,0 otherwise nothing will happen)

Loop:
Select any rectangular area on external screen.
Assign a random colour (RGB) value for the rectangular area.
Convert the HSB value from the Random colour (RGB) assigned to this rectangle. Will be a constant (A)
Go through every pixel in the rectangular area and change its HSB S value with (A).
Draw the result. (Simulating a Saturation overlay of the rectangle on main screen)
Repeat loop.

Does that make sense??