Author |
Topic  |
|
AndyColmes
  
USA
351 Posts |
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. |
|
fab
   
1310 Posts |
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.
|
 |
|
AndyColmes
  
USA
351 Posts |
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
   
1310 Posts |
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
  
USA
351 Posts |
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
   
1310 Posts |
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. |
 |
|
|
Topic  |
|
|
|