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
 Io.LoadFromStream with nongraphic file bug
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Marius

Netherlands
21 Posts

Posted - Aug 07 2018 :  07:39:59  Show Profile  Reply
I have the following code which is no longer working after the update to ImageEn 7.5.0, after the AToolbox.Io.LoadFromStream(AStream) (with a non graphic file) the with and the height are alway's 1.

Is this a bug?


AStream.Position := 0;
AToolbox := TImageEnView.Create(nil);
AToolbox.Io.LoadFromStream(AStream);
if AToolbox.IeBitmap.Width + AToolbox.IeBitmap.Height > 0 then begin
...
end;

Thanks,
Marius

Delphi XE

xequte

38183 Posts

Posted - Aug 07 2018 :  21:17:40  Show Profile  Reply
Hi Marius

For legacy reasons are "null" image in a TImageEnView is actually 1x1 pixel. This should be the same in old versions too (unless using a stand-alone TIEBitmap).

Your code will have been affected by the transition from LegacyBitmp = False to LegacyBitmap = True, which may have an effect (though off the top of my head, I can't think why).

Generally to test the success of loading, you should check IO.Aborting, otherwise in this base use a TIEBitmap rather than a TImageEnView, or check > 1x1.



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

Marius

Netherlands
21 Posts

Posted - Aug 08 2018 :  03:50:56  Show Profile  Reply
We did an upgrade from ImageEN from version 7.0 to 7.5 and then the 1x1 bitmaps weirdness happends.

After searching and comparing ImageEn sources, we might have overlooked the changes with the conditional "LegacyBitmapInTImageEnView", it is mentioned in the "Updating and Compatibility" but its effects are unclear (they are kind of destructive in combination with checking on width and heigth)


Thanks and regards,
Marius
Go to Top of Page

xequte

38183 Posts

Posted - Aug 09 2018 :  03:19:50  Show Profile  Reply
Hi Marius

In 7.5.0 we changed the default of TImageEnView.LegacyBitmap to false, previously it was true. So previously with your code:

AToolbox := TImageEnView.Create(nil);


AToolbox.LegacyBitmap would have been true.


To return to 7.0.* functionality change the code to:

AToolbox := TImageEnView.Create(nil);
AToolbox.LegacyBitmap := true;
...


When LegacyBitmap is enabled, TImageEnView uses a TBitmap to store images instead of a TIEBitmap. TBitmap is not as good with memory handling.

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

Marius

Netherlands
21 Posts

Posted - Aug 09 2018 :  05:52:25  Show Profile  Reply
Thank you Nigel,

That indeed solved our problem.

Regards,
Marius
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: