Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wxWidgets - Alpha blending

Is there a way in wxWidget to do alpha blending operations such as multiplying the alpha of a bitmap versus the RGB of other bitmap to generate new images (such as rendering a photo as an anti-aliased circular shape).

like image 497
rui Avatar asked Mar 01 '26 11:03

rui


1 Answers

Though I haven't done alpha blending myself, I believe the wxGraphicContext is what you are after.

http://docs.wxwidgets.org/stable/wx_wxgraphicscontext.html

I've got flicker free drawing into the graphics context (on Win32) using the following in my paint event handler:

void OnPaint( wxPaintEvent& e )
{
    wxBufferedPaintDC dc( this );        
    wxGraphicsContext* gdc = wxGraphicsContext::Create( dc );
    // you drawing code here
}

EDIT: this email trail might offer some more insight:

http://www.nabble.com/Is-alpha-blending-implemented-when-using-DC's--td17183159.html

like image 119
Daniel Paull Avatar answered Mar 03 '26 01:03

Daniel Paull



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!