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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 how can i get layer's information before load file

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
stkwon Posted - Nov 12 2018 : 01:40:58
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?
7   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Feb 06 2019 : 22:47:55
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
xequte Posted - Nov 16 2018 : 16:21:34
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
wesleybobato Posted - Nov 16 2018 : 06:47:21
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.
xequte Posted - Nov 15 2018 : 18:01:34
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
wesleybobato Posted - Nov 15 2018 : 06:37:05
Hi yogiyang

The correct way is to add the OnBeforeLoadImage or OnAfterLoadParams events.
yogiyang Posted - Nov 13 2018 : 01:49:00
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
xequte Posted - Nov 12 2018 : 17:32:06
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