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
 Adding a Layer Causes TImageEnView to report empty
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Elemental

USA
56 Posts

Posted - Nov 25 2020 :  16:20:53  Show Profile  Reply
I have noticed the following odd behavior with ImageEn for Delphi, version 7.2.6:

Load an image into ImageEnView1 with LoadFromFile which is bigger than 2 x 2
ImageEnView1.IsEmpty returns False
Call ImageEnView1.LayersAdd()
ImageEnView1.IsEmpty now returns True.

The image is clearly not empty nor too small. I believe the problem is that IsEmpty relies on fIEBitmapValid, and that flag is being re-set to False in SetLayersCurrentEx because the new layer (a shape) is not a valid bitmap. I have attached a small sample project which was made in Delphi XE7, but the bug is still manifest in Sydney.

"Roj"

attach/Elemental/2020112516207_ImageEnIsEmpty.zip
57.83 KB

Elemental

USA
56 Posts

Posted - Nov 25 2020 :  16:24:44  Show Profile  Reply
I'm sorry. It's version 9.2.6, not 7.2.6.
Go to Top of Page

xequte

38613 Posts

Posted - Nov 27 2020 :  13:34:52  Show Profile  Reply
Hi Roj

That is correct. IsEmpty returns the status of the active layer.

https://www.imageen.com/help/TImageEnView.IsEmpty.html

When you can LayersAdd() the new layer will be empty, so the result is true.



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

Elemental

USA
56 Posts

Posted - Nov 30 2020 :  13:32:27  Show Profile  Reply
Thank you for your response. Since the tool in question should only be active when an image is actually loaded, I set a private boolean to the result of LoadFromFile, and then check that boolean in the OnUpdate method of the action. After all, I didn't want an OnUpdate method to change the active layer, and there is always a layer 0 so I couldn't check against that. Thanks, Nigel.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: