DrawPixMap w/Alpha

BlitzMax Forums/BlitzMax Beginners Area/DrawPixMap w/Alpha

BLaBZ(Posted 2010) [#1]
I'm having the hardest time with pixmaps hear....

I just want to DrawPixmap and have the alpha values blend in with what's behind it.

Is that possible?


Brucey(Posted 2010) [#2]
If your pixmap is an RGBA, and you have ALPHA_BLEND blending enabled, it should work as desired, except that you don't want to use DrawPixmap. Load it into a TImage first and draw that instead. (yes, really!)


Jesse(Posted 2010) [#3]
pixmaps don't work that way.
you have to convert it to an image first for it to be displayed as you want them to.


BLaBZ(Posted 2010) [#4]
You guys are brilliant! I just can't seem to turn it into a texture now...

LoadTexture(Image)
LoadTexture(Image.ToString())



Brucey(Posted 2010) [#5]
a TImage is a texture really (with a TPixmap as the raw backing data) - DrawImage img, x, y


BLaBZ(Posted 2010) [#6]
mhmm I still can't seem to apply an TImage as a TTexture to a mesh....

Local Mesh:TMesh = LoadMesh("tankturret.b3d")
Local Texture:TTexture = LoadTexture("tanktext.png")

	BeginMax2d()
	SetClsColor(255,0,0)
	Cls
	SetBlend ALPHABLEND
	Local aImage:TImage = LoadImage(Texture.Pixmap)
	DrawImage(aImage,0,0)
        Flip
	GrabImage(aImage,0,0)
	
	Texture.Pixmap = LockImage(aImage)
	UnlockImage(aImage)
	
	EndMax2d()

EntityTexture(Mesh,Texture)


:/


Brucey(Posted 2010) [#7]
Ah... a texture texture... you have ventured into the realms of minib3d, of which I am unfortunately unfamiliar...