Heres some examples
DBP
Example
set display mode 800,600,32
cls rgb(0,255,255)
box 0,0,35,35,rgb(255,0,0),rgb(255,0,0),rgb(255,0,0),rgb(255,0,0)
box 65,0,100,35,rgb(0,255,0),rgb(0,255,0),rgb(0,255,0),rgb(0,255,0)
box 0,65,35,100,rgb(0,0,255),rgb(0,0,255),rgb(0,0,255),rgb(0,0,255)
box 65,65,100,100,rgb(255,255,0),rgb(255,255,0),rgb(255,255,0),rgb(255,255,0)
get image 1,0,0,100,100,1
cls 0
ColourKeys(1,2,rgb(255,0,0),rgb(0,255,0),rgb(0,0,255),rgb(255,255,0))
paste image 1,250,250,1
paste image 2,450,250,1
sync
suspend for key
end
function ColourKeys(ImageNum1 as integer,ImageNum2 as integer,Colour1 as dword,Colour2 as dword,Colour3 as dword,Colour4 as dword)
Index1 as integer
make memblock from image 256,ImageNum1
for Index1 = 15 to (get memblock size(256) - 1) step 4
`change the 0's at the end for different transparencies
if memblock dword(256,Index1 - 3) = Colour1 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour2 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour3 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour4 then write memblock byte 256,Index1,0
next Index1
make image from memblock ImageNum2,256
delete memblock 256
endfunction
Just the function
function ColourKeys(ImageNum1 as integer,ImageNum2 as integer,Colour1 as dword,Colour2 as dword,Colour3 as dword,Colour4 as dword)
Index1 as integer
make memblock from image 256,ImageNum1
for Index1 = 15 to (get memblock size(256) - 1) step 4
`change the 0's at the end for different transparencies
if memblock dword(256,Index1 - 3) = Colour1 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour2 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour3 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour4 then write memblock byte 256,Index1,0
next Index1
make image from memblock ImageNum2,256
delete memblock 256
endfunction
DBC (enhanced) - (This should work but I have not tested it)
Example
set display mode 800,600,32
cls rgb(0,255,255)
box 0,0,35,35,rgb(255,0,0),rgb(255,0,0),rgb(255,0,0),rgb(255,0,0)
box 65,0,100,35,rgb(0,255,0),rgb(0,255,0),rgb(0,255,0),rgb(0,255,0)
box 0,65,35,100,rgb(0,0,255),rgb(0,0,255),rgb(0,0,255),rgb(0,0,255)
box 65,65,100,100,rgb(255,255,0),rgb(255,255,0),rgb(255,255,0),rgb(255,255,0)
get image 1,0,0,100,100,1
cls 0
ColourKeys(1,2,rgb(255,0,0),rgb(0,255,0),rgb(0,0,255),rgb(255,255,0))
paste image 1,250,250,1
paste image 2,450,250,1
sync
suspend for key
end
function ColourKeys(ImageNum1,ImageNum2,Colour1,Colour2,Colour3,Colour4)
make memblock from image 256,ImageNum1
for Index1 = 15 to (get memblock size(256) - 1) step 4
`change the 0's at the end for different transparencies
if memblock dword(256,Index1 - 3) = Colour1 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour2 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour3 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour4 then write memblock byte 256,Index1,0
next Index1
make image from memblock ImageNum2,256
delete memblock 256
endfunction
Just the function
function ColourKeys(ImageNum1,ImageNum2,Colour1,Colour2,Colour3,Colour4)
make memblock from image 256,ImageNum1
for Index1 = 15 to (get memblock size(256) - 1) step 4
`change the 0's at the end for different transparencies
if memblock dword(256,Index1 - 3) = Colour1 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour2 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour3 then write memblock byte 256,Index1,0
if memblock dword(256,Index1 - 3) = Colour4 then write memblock byte 256,Index1,0
next Index1
make image from memblock ImageNum2,256
delete memblock 256
endfunction
Hope this helps
EDIT Damn you wmf