简体   繁体   English

如何在C ++ Builder中使用DrawTransparentBitmap()

[英]How to use DrawTransparentBitmap() in C++ Builder

Just trying to figure out how to use DrawTransparent in C++ Builder to draw a bitmap or tbitmap with an alpha channel so that the drawn image is semi-transparent with the background image. 只是想弄清楚如何在C ++ Builder中使用DrawTransparent来绘制带有alpha通道的位图或tbitmap,以使绘制的图像与背景图像半透明。

I looked all over the place and on this site but can't find anything other than a note that this as well as DrawTransparentBitmap exists.. 我在整个地方和这个站点上四处张望,但除了该注释以及DrawTransparentBitmap存在以外,找不到任何东西。

In the help it is listed as follows: 在帮助中列出如下:

virtual void __fastcall DrawTransparent(TCanvas* ACanvas, const 
System::Types::TRect &Rect, System::Byte Opacity);

However there are no code examples. 但是,没有代码示例。 The compiler doesn't recognize the procedure name and it does not appear as a method of tbitmap... 编译器无法识别过程名称,并且不会显示为tbitmap的方法...

I am still new to C++ and I could really use some help with this... 我还是C ++的新手,我真的可以在此方面提供一些帮助...

DrawTransparent is a protected method so you can't call it directly, but this should work: DrawTransparent是一个受保护的方法,因此您不能直接调用它,但这应该可以工作:

// opacity 50 
destination_bitmap->Canvas->Draw(0, 0, source_bitmap->Picture->Graphic, 50);

You may need to do source_bitmap->Transparent = true; 您可能需要做source_bitmap->Transparent = true; too. 太。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM