【发布时间】:2011-12-13 23:58:26
【问题描述】:
我创建了一个带有 3 个半透明 tImage3D 的 FireMonkey 应用程序。 这是代码和屏幕。一切似乎都很好。
procedure TForm1.Form3DCreate(Sender: TObject);
// create a new semi-transparent timage3d
// object with color and Z position.
procedure NewImage ( const nColor : tColor;
const nZ : integer );
begin
// create the image
with tImage3D . Create ( self ) do
begin
// put it on the screen
Parent := self;
// set the size
Width := 10;
Height := 10;
// set the image to a single pixel.
Bitmap . Width := 1;
Bitmap . Height := 1;
// set the Alpha to $80 to make it
// semi-transparent
Bitmap . Pixels [ 0, 0 ] := $80000000 + nColor;
// set the z position
Position . Z := nZ;
end;
end;
begin
NewImage ( claRed, +10 );
NewImage ( claGreen, 0 );
NewImage ( claBlue, -10 );
end;
现在颠倒顺序。现在它们是不透明的。
begin
NewImage ( claRed, -10 );
NewImage ( claGreen, 0 );
NewImage ( claBlue, +10 );
end;
我错过了什么?
【问题讨论】:
-
显然,一个对象对于之前创建的对象只是半透明的。如果那有意义的话。红色框显示为粉红色,因为您可以通过它看到白色背景,但通过它看不到绿色或蓝色框。通过绿色框,你可以看到白色背景和红色框,但看不到蓝色框。 text3d 对象也发生了同样的事情。
-
我认为@user 是对的。尝试重绘前面的对象。如果对象没有检测到它下面的任何东西,它可能会跳过混合功能,并且白色背景不算在内。
-
重绘前面的对象是什么意思?这是一个非常简单的例子来说明问题。最初的应用程序有几个浮动的旋转图像和文本,每个对象的位置每 50 毫秒更改一次,因此会不断重绘。
标签: delphi firemonkey