アルファ チャネルのある画像を使用しましたが、画像の一部が完全に不透明ではありません。オブジェクトに描画すると、TImgView32
セクションが色から少し色がClear()
つきます。サンプル画像でそれを示しましょう:
これは、Photoshop で通常表示される元の画像です。
これは、以前にクリアした GR32 オブジェクトの新しいレイヤーに描画した結果の画像ですClear($00FF0000);
。
結果はPhotohopのように透明ですが、その赤いハローが問題です.
または別の色Clear($000000FF);
:
ご存知のように、私が使用した色は完全に透明であることに注意してください。
上記の結果を作成するために使用したコードは次のとおりです。
begin
ImageList.Bitmaps.Add; //ImageList is a TBitmap32List object
LoadPNGintoBitmap32(ImageList.Bitmap[0], ImgPath+'test.png', DummyBool);
BL:= TBitmapLayer.Create(ImgView.Layers);
ImgID:=0;
ScaleFactor:= 1;
LayerPos:= Point(100, 100);
with ImageList.Bitmap[ImgID] do
ImageRect:= Rect(0, 0, Width, Height);
{Auxilary variables}
CanvasWidth:= ImageRect.Right{*2}; //Extending width for two icon.
CanvasHeight:= ImageRect.Bottom;
BL.Location:= FloatRect(
LayerPos.X,
LayerPos.Y,
LayerPos.X + CanvasWidth * ScaleFactor,
LayerPos.Y + CanvasHeight * ScaleFactor
);
with BL.Bitmap do
begin
{Init}
SetSize(CanvasWidth, CanvasHeight);
DrawMode:= dmBlend;
Clear($00FF0000);
{Insert image}
Draw(0, 0, ImageRect, ImageList.Bitmap[ImgID]);
end;
if ScaleFactor<>1 then
TDraftResampler.Create(BL.Bitmap); //BL.Bitmap, because we used "Draw" method
end;
これを回避し、Photoshop のような明確な結果を得るにはどうすればよいですか?