The problem you've got is 16 bit modes don't have 8 bits per colour channel (0-255 on RG and B). So the 16 bit might be made up of 5,6,5 bits on the R,G,B. The problem with this is that the value you want might not be the value you get...
This bit of code writes a pixel to an image of the mask colour your want (255,0,255 in this case) and reads it back into the mask_r,g,b varibles to give you the true mask colour.
This only needs to be done in 16 bit modes.
This bit of code writes a pixel to an image of the mask colour your want (255,0,255 in this case) and reads it back into the mask_r,g,b varibles to give you the true mask colour.
This only needs to be done in 16 bit modes.
Global gotr=0 Global gotg=0 Global gotb=0 Global mask_r=0 Global mask_g=0 Global mask_b=0 Function get_mask() tmp=CreateImage(1,1) LockBuffer ImageBuffer(tmp) WriteRGB(tmp,1,1,255,0,255) GetRGB(tmp,1,1) mask_r=gotr mask_g=gotg mask_b=gotb UnlockBuffer ImageBuffer(tmp) FreeImage tmp End Function Function GetRGB(image_name,x,y) argb=ReadPixelFast(x,y,ImageBuffer(image_name)) gotr=(ARGB Shr 16) And $ff gotg=(ARGB Shr 8) And $ff gotb=ARGB And $ff End Function Function WriteRGB(image_name,x,y,red,green,blue) argb=(blue Or (green Shl 8) Or (red Shl 16) Or ($ff000000)) WritePixelFast x,y,argb,ImageBuffer(image_name) End Function