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

How to use DrawTransparentBitmap() in C++ Builder

只是想弄清楚如何在 C++ Builder 中使用 DrawTransparent 绘制带有 alpha 通道的位图或 tbitmap,以便绘制的图像与背景图像半透明。

我找遍了整个地方和这个网站,但除了一个说明这个以及 DrawTransparentBitmap 存在之外找不到任何东西..

在帮助中是这样列出的:

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

但是没有代码示例。编译器无法识别过程名称,它不会作为 tbitmap 的方法出现...

我对 C++ 还是个新手,我真的需要一些帮助...

DrawTransparent 是一个受保护的方法,因此您不能直接调用它,但这应该有效:

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

您可能还需要 source_bitmap->Transparent = true;