What's the best way to draw alpha blended shapes. Like Ellipse API, Rect API, etc.
I was thinking Bitblt the source image, draw shape on it, alphablend back to source.
But there has to be a beter way? Hopefully?
Printable View
What's the best way to draw alpha blended shapes. Like Ellipse API, Rect API, etc.
I was thinking Bitblt the source image, draw shape on it, alphablend back to source.
But there has to be a beter way? Hopefully?
I think thats probably the easiest way, it shouldn't be that processor hungry. I'm guessing your using DirectX? if you are the only way I can think of is if you create a blank surface, BitBlt the Shape to it then alpha blend it to the BackBuffer using eitheror if you use a Direct3D surface:VB Code:
Private Declare Function vbDABLalphablend16 Lib "vbDABL" (ByVal iMode As Integer, ByVal bColorKey As Integer, ByRef sPtr As Any, ByRef dPtr As Any, ByVal iAlphaVal As Integer, ByVal iWidth As Integer, ByVal iHeight As Integer, ByVal isPitch As Integer, ByVal idPitch As Integer, ByVal iColorKey As Integer) As IntegerNotice that using the vbDABLalphablend16 API it will only work in 16bit mode.VB Code:
D3DDevice.SetRenderState D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA D3DDevice.SetRenderState D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA D3DDevice.SetRenderState D3DRENDERSTATE_TEXTUREFACTOR, DirectX.CreateColorRGBA(1, 1, 1, A) D3DDevice.SetTextureStageState 0, D3DTSS_ALPHAOP, D3DTA_TFACTOR 'Where A is a value between 0-1, the Alpha Blend value
Use the second methid if you are using DX...thats my opinion...