invert alphachannel of alphachannel textures
Posted: Mon May 01, 2006 1:44 pm
Hi Fred
Because GDI functions always replaces the highest byte(alphachannel) with zero, you can't see anything if you draw something with the 2DDrawing-Lib on alphachannel textures.
It would be cool if you change this behavior.
You just need to invert the alphachannel and set the Blendingmode
Sprite3DBlendingMode(#D3DBLEND_INVSRCALPHA,#D3DBLEND_SRCALPHA) as default.
Here a example:
it would be cool If you do the same For DrawAlphaImage().
Thanks in advance
regards
Stefan
Because GDI functions always replaces the highest byte(alphachannel) with zero, you can't see anything if you draw something with the 2DDrawing-Lib on alphachannel textures.
It would be cool if you change this behavior.
You just need to invert the alphachannel and set the Blendingmode
Sprite3DBlendingMode(#D3DBLEND_INVSRCALPHA,#D3DBLEND_SRCALPHA) as default.
Here a example:
Code: Select all
UsePNGImageDecoder()
InitSprite()
InitSprite3D()
OpenWindow(1,0,0,640,480,"TEST")
OpenWindowedScreen(WindowID(1),0,0,640,480,0,0,0)
LoadSprite(1,"C:\TEST.png",#PB_Sprite_AlphaBlending|#PB_Sprite_Texture)
CreateSprite3D(1,1)
; Invert Alphachannel
StartDrawing(SpriteOutput(1))
For M=0 To DrawingBufferPitch()*SpriteHeight(1)-1 Step 4
PokeB(DrawingBuffer()+M+3,~PeekB(DrawingBuffer()+M+3))
Next
StopDrawing()
; draw something with GDI
StartDrawing(SpriteOutput(1))
Box(0,0,100,100,#Red)
Line(0,0,300,300,#Green)
StopDrawing()
Repeat
ClearScreen(0)
Start3D()
Sprite3DBlendingMode(6,5)
DisplaySprite3D(1,0,0)
Stop3D()
FlipBuffers()
Until WindowEvent()=#PB_Event_CloseWindow
Thanks in advance

regards
Stefan