I have added an OnUserInteraction handler to this ImageEn demo:
\Demos\ImageEditing\BrushTool
procedure TForm1.ImageEnView1UserInteraction(Sender: TObject; Event: TIEUserInteractionEvent; Info: Integer);
begin
case Event of
ieiPaintEnd:
begin
if ImageEnView1.IEBitmap.HasAlphaChannel(True) then
begin
ImageEnView1.SetChessboardStyle(16, Graphics.bsSolid, clWhite, $00EEEEEE);
ImageEnView1.BackgroundStyle := iebsChessboard;
end
else
ImageEnView1.BackgroundStyle := iebsSolid;
end;
end;
end;
This shows a chessboard background for transparent areas. (The modified demo project is attached).
Then I loaded the image file colorfields.png that is contained in the attached zip file.
Then I configured the Brush Type as Eraser:
Then I painted with the configured Eraser Brush:
You can see that while the upper left semi-transparent color field has a Chessboard background, the area painted with the Eraser Brush has NO chessboard background! Why? Isn't the Eraser supposed to set the Alpha Transparency of the painted area to 0 when EraserOpacity = 1.0?
Documentation: "TIEBrushToolInteraction.EraserOpacity: 1.0 will completely erase (Alpha will become 0)."
attach/PeterPanino/20211228101530_PaintBrush.zip
53.14 KB