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 to save and load changes to layer
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

AndyColmes

USA
351 Posts

Posted - May 04 2012 :  18:09:40  Show Profile  Reply
My layer can be resized, moved and rotated. I would like to be able to save the settings and apply it to another image. How would I do this efficiently?

Thanks.

fab

1310 Posts

Posted - May 04 2012 :  23:39:27  Show Profile  Reply
There is no integrated support in ImageEn for this. You have to store each action and replicate that in your code.
Layer size, position and rotation are stored in:
ImageEnView.Layers[..].Width
ImageEnView.Layers[..].Height
ImageEnView.Layers[..].PosX
ImageEnView.Layers[..].PosY
ImageEnView.Layers[..].Rotate (and maybe also RotateCenterX and RotateCenterY)

Critical parameters are Width, Height and Rotate because they are reset when MouseInteract switches from resize to rotate and viceversa.
The difficulty is "when" to store these info. OnLayerNotify doesn't help, because it fires whenever a parameters changes and you (I suppose) don't want to save all intermediate size and rotation values.
So you should store these parameters just before MouseInteract changes, and you know when.

Hope this helps.
Go to Top of Page

AndyColmes

USA
351 Posts

Posted - May 06 2012 :  10:35:13  Show Profile  Reply
Thanks Fabrizio. It helped.

How about effects like Brightness, Contrast, Equalize, etc.? Is there an easy way to load and save those changes?

Thanks again.
Go to Top of Page

fab

1310 Posts

Posted - May 06 2012 :  14:18:13  Show Profile  Reply
It is the same: no support is provided by ImageEn, so you have to save each parameter of each called method.
Go to Top of Page

AndyColmes

USA
351 Posts

Posted - May 06 2012 :  20:26:53  Show Profile  Reply
As for the layer size and rotation, in what order should I restore the values? The PosX and PosY are different before and after rotation. So, should I restore the rotation first?

When I programmatically rotate the image bitmap and assigned it back to the layer, I would save that value to a variable. The issue is when the user rotates the layer further manually using the layer corner. Should I add the two rotation values and save that for later restore?

Thanks again.
Go to Top of Page

fab

1310 Posts

Posted - May 06 2012 :  22:27:20  Show Profile  Reply
quote:
As for the layer size and rotation, in what order should I restore the values? The PosX and PosY are different before and after rotation. So, should I restore the rotation first?


I suppose in the same order they was applied. Please note that after you set Rotation you have to call LayersFixRotations() and the same for Layer.Width and Height, you have to call LayersFixSizes(), has ImageEn does when you switch MouseInteract.

quote:
When I programmatically rotate the image bitmap and assigned it back to the layer, I would save that value to a variable. The issue is when the user rotates the layer further manually using the layer corner. Should I add the two rotation values and save that for later restore?


You should save only Rotate, RotateCenterX and RotateCenterY just before you change MosueInteract (switch off rotation mode) OR when you manually call LayersFixRotation().
Other intermediate rotations are not useful.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: