Saturation Filter
Posted: Thu May 14, 2020 4:54 pm
Can anyone explain the following:
With a grey background, overlay a rectangle with any colour using the color mode saturation.
The result should be grey - but it is blue.
I have done a lot of research and experimenting, but cannot find a solution.
Here is the code:
setupgraphics:
GRAPHICS
SET TOOLBAR on
GET ORIENTATION P
IF p=1 OR p=3 THEN LET p=5
IF p=2 OR p=4 THEN LET p=6
SET ORIENTATION P
xmax=SCREEN_WIDTH()
ymax=SCREEN_HEIGHT()
draw font size 10
draw color 0,0,0
graphics mode normal
back=0.7
fill color back,back,back
fill rect 0,0 to xmax,ymax
c=0.5
graphics mode saturation
r=rnd(1)
g=rnd(1)
b=rnd(1)
fill color r,g,b
fill rect (xmax/2),(ymax/2) size 30,100
GET PIXEL xmax,ymax COLOR rr,gg,bb
graphics mode normal
draw text r at 10,10
draw text g at 10,20
draw text b at 10,30
draw text rr at 10,60
draw text gg at 10,70
draw text bb at 10,80
refresh
With a grey background, overlay a rectangle with any colour using the color mode saturation.
The result should be grey - but it is blue.
I have done a lot of research and experimenting, but cannot find a solution.
Here is the code:
setupgraphics:
GRAPHICS
SET TOOLBAR on
GET ORIENTATION P
IF p=1 OR p=3 THEN LET p=5
IF p=2 OR p=4 THEN LET p=6
SET ORIENTATION P
xmax=SCREEN_WIDTH()
ymax=SCREEN_HEIGHT()
draw font size 10
draw color 0,0,0
graphics mode normal
back=0.7
fill color back,back,back
fill rect 0,0 to xmax,ymax
c=0.5
graphics mode saturation
r=rnd(1)
g=rnd(1)
b=rnd(1)
fill color r,g,b
fill rect (xmax/2),(ymax/2) size 30,100
GET PIXEL xmax,ymax COLOR rr,gg,bb
graphics mode normal
draw text r at 10,10
draw text g at 10,20
draw text b at 10,30
draw text rr at 10,60
draw text gg at 10,70
draw text bb at 10,80
refresh