mrHandy
Where do you get your figure of 20000 colours that you mention in your first post?
Why do you think your code doesn't work?
Lost in Thought and
Phaelax
You both seem to have forgotten that DBPro performs "integer division" on integers - mrHandy's code is a simple way of converting the range 0, 1, ..., 255 to the range 0, 32, 64, ..., 224. Just try it.
The following simple variant of mrHandy's code illustrates the idea (don't forget to press q to see the result):
Sw=640
Sh=480
set display mode Sw,Sh,32,1
set window on
set window size Sw,Sh
sync on : sync rate 0
create bitmap 1, 640, 480
box 0, 0, 640, 480, rgb(255, 0, 0), rgb(0, 255, 0), rgb(0, 0, 255), rgb(255, 255, 255)
get image 1, 0, 0, 640, 480, 1
set current bitmap 0
repeat
paste image 1,0,0
if inkey$()="q"
lock pixels
for fy = 0 to 480
for fx = 0 to 640
c=point(fx,fy)
r=(rgbr(c)/32)*32
g=(rgbg(c)/32)*32
b=(rgbb(c)/32)*32
dot fx,fy,rgb(r,g,b)
next fx
next fy
unlock pixels
endif
sync
until spacekey()=1