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
 how can i get layer's information before load file
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

stkwon

20 Posts

Posted - Nov 12 2018 :  01:40:58  Show Profile  Reply
using .IEN files.

i want read layer's property before load..

example.

if using LoadfromfileIEN

then check Text layer's font name

and install fonts before load IEN file.

how can i get layer's information before loadfromIEN?

xequte

38610 Posts

Posted - Nov 12 2018 :  17:32:06  Show Profile  Reply
Hi

I'm afraid there is not a way to access that information before loading. I will add it to the to-do list.

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

yogiyang

India
727 Posts

Posted - Nov 13 2018 :  01:49:00  Show Profile  Reply
Hello,

In the mean time you can load the file using following code:

var
   ieTemp: TImageEnView;
begin
   ieTemp := TImageEnView.Create(Application);
   ieTemp.IO.Params.JPEG_EnableAdjustOrientation := True;
   ieTemp.IO.Params.PSD_LoadLayers := True;
   ieTemp.IO.Params.PSD_ReplaceLayers := True;
   ieTemp.IO.LoadFromFileIEN('YourFile');

   //Loop through each Layer and do the needful here
   

   //Once completed
   FreeAndNil(ieTemp);
 
end;


HTH


Yogi Yang
Go to Top of Page

wesleybobato

Brazil
367 Posts

Posted - Nov 15 2018 :  06:37:05  Show Profile  Reply
Hi yogiyang

The correct way is to add the OnBeforeLoadImage or OnAfterLoadParams events.
Go to Top of Page

xequte

38610 Posts

Posted - Nov 15 2018 :  18:01:34  Show Profile  Reply
Hi

The problem here is that the user needs to know the name of the font before it is assigned to the layer. So an OnBeforeLoadLayer event would need to list all of the properties that have been loaded, and then after the event they would need to be assigned to the layer (a two stage loading process).




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

wesleybobato

Brazil
367 Posts

Posted - Nov 16 2018 :  06:47:21  Show Profile  Reply
Hi Nigel

This task is very complex in my opinion because if it is designed
incorrectly will cause slowness as it can cause overload.
  
  // Example 1
  Img.ReadParams(FileName.iev);
  OnBeforeLoadLayer(Img.Params, var AAbort: Boolean);
  
  if not AAbort then
   ImgReadImage(FileName.iev);
   
  -------------------------------------------------
   
  // Example 2
  var pr: TIOParams;
  pr := TIOParams.Create(nil);
  pr.ReadParams(FileName.iev);
  
  OnBeforeLoadLayer(pr, var AAbort: Boolean);
  if not AAbort then
    begin
img.AssignParams(pr);
img.ReadImage(FileName.iev);
end;
  
  pr.Free;

  -------------------------------------------------
  // Example 3
  Img.StartReading(FileName.iev);
  OnBeforeLoadLayer(Img.Params, var AAbort: Boolean);
  
  if not AAbort then
   Img.ContinueReadFile;

These are simple examples but you can see that example number 3 does less
reading on the storage unit (HD/SSD/SD and etc).

I added the parameter AAbort because I believe that if you can not install the font the programmer may want to cancel the operation.

Kind regards.
Go to Top of Page

xequte

38610 Posts

Posted - Nov 16 2018 :  16:21:34  Show Profile  Reply
Thanks for the feedback, Wesley,

I think the solution might be an event that allows preview (and modification) of each property as it is loaded. This avoid the two stage loading.

I'll look into this.



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

xequte

38610 Posts

Posted - Feb 06 2019 :  22:47:55  Show Profile  Reply
Hi Wesley

After loading an ImageEn layer file you can iterate through all of the fonts to ensure they are valid, for example:

ImageEnView1.IO.LoadFromFileIEN(...);
// Validate fonts are installed on this system
for i := 0 to ImageEnView1.LayersCount do
begin
  if ImageEnView1.Layers[i].Kind = ielkText then
    fontName := TIETextLayer( ImageEnView1.Layers[i] ).Font
  else
  if ImageEnView1.Layers[i].Kind = ielkLine then
    fontName := TIELineLayer( ImageEnView1.Layers[i] ).LabelFont
  else
    continue;

  if Screen.Fonts.IndexOf( fontName ) = -1 then
  begin
    // This font is not installed. Substitute or install it...
  end;
end;


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