Blitz not reading in bitmaps properly? Colour prob

Blitz3D Forums/Blitz3D Programming/Blitz not reading in bitmaps properly? Colour prob

This sounds like a 16 bit graphics issue... whoop it to 32 bit and it'll sort the problem, this question needs to go in the faq as it keeps recurring over and over.

This will return 16bit values based on your graphics card, there's a lot of functions and globals in there as these functions are pretty handy to be seperate.

This can be optimised big time if all you wanted to do was return a true 16 bit mask colour. But these are a bunch of functions that I always use and I couldn't be bothered!

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