I am trying to draw some polygon which can be place on top of each other with some transparency.
Example: The kind of tranparency of those graph (if i am not wring it is called alpha transparency )
https://rud.is/b/wp-content/uploads/201 ... galpha.png
I know i have to use wxGraphicsContext and so at the moment my code looks like this :
Code: Select all
void GADrawingArea::paintEvent(wxPaintEvent & evt)
{
wxBufferedPaintDC dc(this);
PrepareDC(dc);
render(dc);
}
void GADrawingArea::render(wxDC& dc)
{
dc.Clear();
wxPoint tab2[4] = {wxPoint(10,50), wxPoint(50,50), wxPoint(10,10), wxPoint(10,50)};
dc.SetPen( *wxBLACK_PEN );
dc.SetBrush(*wxBLACK_BRUSH);
dc.DrawPolygon(4,tab2);
wxGraphicsContext* gc;
wxMemoryDC *memdc = wxDynamicCast(&dc, wxMemoryDC);
gc = wxGraphicsContext::Create(*memdc);
wxPoint2DDouble tab[4] = {wxPoint(25,50), wxPoint(65,50), wxPoint(25,10), wxPoint(25,50)};
gc->SetPen( *wxRED_PEN );
gc->SetBrush(*wxRED_BRUSH);
gc->DrawLines(4,tab);
}
As you can see, there is not transparency.
I guess there is a function or something like a parameter in a function but i am not finding it.
Thanks for your help.