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