Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gdi+ WxWidgets使用不透明度绘制位图_Gdi+_Wxwidgets - Fatal编程技术网

Gdi+ WxWidgets使用不透明度绘制位图

Gdi+ WxWidgets使用不透明度绘制位图,gdi+,wxwidgets,Gdi+,Wxwidgets,如何将wxImage或wxBitmap绘制到具有不透明度的DC?使用标准DC或wxGraphicsContext似乎是不可能的 BeginLayer/EndLayer尚未在wxGraphicsContext中实现,而wxGraphicsContext本来是一种解决方案。GDI+似乎不支持层,所以添加它是非常重要的 唯一的解决方案似乎是通过编程逐像素改变alpha通道?希望我能提供帮助,但我对wxWidgets处理不透明度有自己的问题…很抱歉,我错过了你的答案。祝你一切顺利。 void YourC

如何将wxImage或wxBitmap绘制到具有不透明度的DC?使用标准DC或wxGraphicsContext似乎是不可能的

BeginLayer/EndLayer尚未在wxGraphicsContext中实现,而wxGraphicsContext本来是一种解决方案。GDI+似乎不支持层,所以添加它是非常重要的


唯一的解决方案似乎是通过编程逐像素改变alpha通道?

希望我能提供帮助,但我对wxWidgets处理不透明度有自己的问题…很抱歉,我错过了你的答案。祝你一切顺利。
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 to populate
  // them with whatever image you like.
  // Putting zeros everywhere will create a fully
  // transparent image.


     // almost done, but not quite... 
     // wxDC can only draw wxBitmaps, not wxImage,
     // so one last step is required
  //
  wxBitmap bmp( image );
  dc.DrawBitmap( bmp, 0, 0 );
 }