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 to save and load changes to layer

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
AndyColmes Posted - May 04 2012 : 18:09:40
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.
5   L A T E S T    R E P L I E S    (Newest First)
fab Posted - May 06 2012 : 22:27:20
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.
AndyColmes Posted - May 06 2012 : 20:26:53
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.
fab Posted - May 06 2012 : 14:18:13
It is the same: no support is provided by ImageEn, so you have to save each parameter of each called method.
AndyColmes Posted - May 06 2012 : 10:35:13
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.
fab Posted - May 04 2012 : 23:39:27
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.