我的表单上有一个TImgView32
(名为 CityMap),并在其上加载了一个图像。现在我创建一个 layer( ) 并使用如下变量TBitmapLayer
绘制一个圆:Canvas.Ellipse
TBitmap32
procedure TfrmMain.Button1Click(Sender: TObject);
var
tmpBmp: TBitmap32;
tmpBL: TBitmapLayer;
begin
tmpBL:= TBitmapLayer.Create(CityMap.Layers);
tmpBmp:= TBitmap32.Create;
with tmpBmp do
begin
//Clear;
SetSize(50, 50);
Canvas.Brush.Color := clYellow;
Canvas.Brush.Style:= bsSolid;
Canvas.Pen.Color := clBlue;
Canvas.Pen.Width := 2;
Canvas.Ellipse(Rect(0, 0, 50, 50));
end;
with tmpBL do
begin
Scaled:=true;
Bitmap.DrawMode:=dmBlend;
tmpBL.Bitmap:=(tmpBmp);
//tmpBmp.DrawTo(tmpBL.Bitmap, 0, 0); This line doesn't work! So using above line instead
end;
//...
end;
结果是这样的:
如您所见,问题在于烦人的黑色矩形。如何创建这样的结果: