ARGB => RGB Value

Blitz3D SDK Forums/Blitz3D SDK Programming/ARGB => RGB Value

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi

This program work perfectly with blitz3D but not under SDK ?
Any idea ?

Import blitz3d.blitz3dsdk

bbBeginBlitz3D()

bbGraphics3D 640,480,0,2

bbSetBuffer bbBackBuffer()
img_img=bbLoadImage("image.bmp")
img_x=100
img_y=20

While Not bbKeyHit(1)
bbCls
bbDrawImage img_img,img_x,img_y
	If bbMouseX()>img_x And bbMouseX()<img_x+bbImageWidth(img_img)
		If bbMouseY()>img_y And bbMouseY()<img_y+bbImageHeight(img_img)
		get_color(img_img,bbMouseX()-img_x,bbMouseY()-img_y)
		EndIf
	EndIf
Flip
Wend
End

Function get_color(img,x,y)
	Local RGB
	Local R,G,B
	bbSetBuffer bbImageBuffer(img)
	bbLockBuffer bbImageBuffer(img)
	
	RGB = bbReadPixelFast(x,y)

	
	R= (RGB And $FF0000) Shr 16
	G= (RGB And $FF00) Shr 8
	B= (RGB And $FF)

	Print R
		
	bbUnlockBuffer bbImageBuffer(img)
	bbSetBuffer bbBackBuffer()
	bbColor R,G,B
	bbRect 200,200,100,100
	Flip
End Function