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
 Layers fixing

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
spetric Posted - Jun 12 2020 : 14:22:17
Hi,

Is there a way to check if layer was rotated/resized?

Currently, in order to avoid unnecessary overhead, I'm using userdata to set and check if there was any rotation/resizing:


if (!userData) // oops, we do not have userData (throw an error in next version)
   continue;
if (*userData == 0) // no rotation, no resizing
   continue;
_primaryImageContainer->PaintView->Layers[i]->UseResampleFilter = true;
if (*userData & px_MASK_LRESIZED )
   _primaryImageContainer->PaintView->LayersFixSizes(i);
else if (*userData & px_MASK_LROTATED)
   _primaryImageContainer->PaintView->LayersFixRotations(i);
_primaryImageContainer->PaintView->Layers[i]->UseResampleFilter = false;
*userData = 0;
// and finally, recreate image zoo
_paintForm->LayerFixed(i);


The last instruction recreates "image zoo" (sharing bitmap with drawing engine, IPP and OpenCV).

I would like to get rid of userdata checking and recreate "image zoo" only if layer was rotated or resized. So is there more elegant way to know "geometry situation"?

I'm using version 8.1.1.

TIA,
Siniša
6   L A T E S T    R E P L I E S    (Newest First)
spetric Posted - Jun 18 2020 : 14:47:48
Hi Nigel,

Thanks a lot. I really don't know why I'm bothering with UserData
to set and check if there was rotation/resize. Now I can simplify
the code.

Siniša



xequte Posted - Jun 17 2020 : 16:27:23
Hi Siniša

No, the layer is not changed if rotate = 0 (specifically, the layer is skipped in the LayersFixRotations method if rotate = 0).

Nigel
Xequte Software
www.imageen.com
spetric Posted - Jun 17 2020 : 13:45:35
Hi Nigel,

Yes, I know that rotation does not change bitmap until fixing rotation is called, my question was wrongly constructed. I'll simplify it:

When rotate angle is zero and LayersFixRotations is called, does the bitmap change?

Siniša
xequte Posted - Jun 17 2020 : 02:17:40
Hi Siniša

Rotate is a visual property only. Setting it does not affect the bitmap at all, until LayersFixRotations is called.

https://www.imageen.com/help/TImageEnView.LayersFixRotations.html

After LayersFixRotations the image is modified and Rotate is reset to 0.



Nigel
Xequte Software
www.imageen.com
spetric Posted - Jun 16 2020 : 14:41:28
Hi Nigel,

Yes, (lyr.Width <> lyr.Bitmap.Width) or (lyr.Height <> lyr.Bitmap.Height) or (lyr.Rotate <> 0) seems like good solution.

Currently I'm using OnLayerNotify to set UserData (checking ielResized or ielRotated).

One question: when I rotate a layer and get back to rotate angle 0, does layer fixation change (recreate) Bitmap or ImageEn internally knows that there was no rotation and does not recreate bitmnap?

Siniša
xequte Posted - Jun 14 2020 : 17:32:37
Hi Sinisa

If an image layer has been resized, then lyr.Width <> lyr.Bitmap.Width. If it has been rotated then lyr.Rotate <> 0. Alternatively, you can check for ielRotated or ielResized in the OnLayerNotifyEx event.

https://www.imageen.com/help/TImageEnView.OnLayerNotifyEx.html

Is that what you are looking for?

Nigel
Xequte Software
www.imageen.com