ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Eraser Brush Tool does not show transparency chessboard background
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

859 Posts

Posted - Dec 28 2021 :  10:18:58  Show Profile  Reply
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

PeterPanino

859 Posts

Posted - Dec 28 2021 :  11:36:04  Show Profile  Reply
This is VERY STRANGE: When I move the PaintBrush demo window (or even this browser window!) to my second external monitor, then the chessboard background is shown for the painted area!! When I move the window back to my primary monitor, then a white solid area is shown instead of the chessboard background!! Is this MAGIC??

I had to document this with my camera, otherwise, no one will believe this - I shot two camera photos from the SAME! Paint Brush demo window on each of my two monitors:

Monitor 1:



Monitor 2:



Can anyone explain this?

(The Moiré effect visible on the photos is a side effect of the camera lens when taking a photo from a monitor screen - it is not visible by the human eye when looking at the computer screen, because the human brain compensates for such undesired effects).
Go to Top of Page

xequte

38172 Posts

Posted - Dec 29 2021 :  15:19:20  Show Profile  Reply
Hi Peter

I'll need to look into this when we are back in the office in the new year.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

xequte

38172 Posts

Posted - Jan 09 2022 :  22:41:40  Show Profile  Reply
Hi Peter

I cannot reproduce that. Can you try calling ImageEnView1.Update(); or Invalidate(); after setting the background color. Or specifying at the time of loading.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: