ARGB => RGB Value

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

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


bbFlip?

I can solve this without even trying the code! I just made the same mistake yesterday.

In Blitz3D the And operator is bitwise, but not in BlitzMax.

Use (RGB & $FF) etc. in BlitzMax.

lol..

Hum ok ! Many thanks !