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

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -