gdi+ - WxWidgets draw a bitmap with opacity -
how can draw wximage, or wxbitmap dc opacity? looks not possible standard dc or wxgraphicscontext.
beginlayer/endlayer not yet implemented in wxgraphicscontext have been 1 solution. gdi+ doesn't seem support layers, non-trivial add this.
the solution seems to programmatically alter alpha channel pixel-by-pixel?
void yourcustomwindow::onpaint( wxpaintevent& event ) { wxpaintdc dc(this); wximage image( width, height ); image.initalpha(); unsigned char* imgdata = img.getdata(); unsigned char* imgalpha = img.getalpha(); // manipulate raw memory buffers populate // them whatever image like. // putting zeros everywhere create // transparent image. // done, not quite... // wxdc can draw wxbitmaps, not wximage, // 1 last step required // wxbitmap bmp( image ); dc.drawbitmap( bmp, 0, 0 ); }
Comments
Post a Comment