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
 Rotate Image and its layers at 180 Degree

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
yogiyang Posted - May 15 2020 : 08:43:27
Hello,

I am using following to rotate image and all its layers at 180 degree
ImageEnView1.LayersRotateAll(180, False, True);

But this is not giving the result that I want.
Here is what I am getting:


But what I want is this:
.

Any ideas as to how can we achieve this?

I have spend a whole day trying to get the math to calculate the location of layers after rotating them 180 degree.

Please help.

TIA


Yogi Yang
4   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - May 18 2020 : 18:16:01
Hi Yogi

Please look in hyieutils.pas. There are whole bunch of useful methods to calculate positions/sizes after rotation.


Nigel
Xequte Software
www.imageen.com
yogiyang Posted - May 18 2020 : 00:44:14
Hello Nigel,

This 180 degree rotation works but I am finding it hard to calculate locations of layers when rotated at 90 degree.

I read somewhere on net that we can use Cos and Sin but am not able to find any functions in Delphi that will calculate and return Cos and Sin and again I don't know as to how to implement.

If you have any ideas do share.

TIA


Yogi Yang
xequte Posted - May 17 2020 : 03:59:58
Hi Yogi

Yes, when ImageEn rotates a layer it does not reposition it. It would be a nice option in a future version.

Nigel
Xequte Software
www.imageen.com
yogiyang Posted - May 16 2020 : 01:56:20
Hello,

It seems I have found a way though not scientifically correct but it works like a charm!!
Here is the code that I am using:

ShowTempHourglass;
ImageEnView1.LockUpdate;
ImageEnView1.LayersCurrent := 0;

//Flip Vertical and then Flip Horizontal
for I := 1 to ImageEnView1.LayersCount - 1 do
begin
  ImageEnView1.Layers[I].PosY := ImageEnView1.Layers[0].Height -
    (ImageEnView1.Layers[I].PosY + ImageEnView1.Layers[I].Height);
  ImageEnView1.Layers[I].Bitmap.flip(fdHorizontal);
  ImageEnView1.Layers[I].PosX := ImageEnView1.Layers[0].Width -
    (ImageEnView1.Layers[I].PosX + ImageEnView1.Layers[I].Width);
  ImageEnView1.Layers[I].Bitmap.flip(fdVertical);
end; 

//Flip Background
ImageEnView1.Layers[0].Bitmap.flip(fdHorizontal);
ImageEnView1.Layers[0].Bitmap.flip(fdVertical);

ImageEnView1.UnlockUpdate;
ImageEnView1.Update;


HTH


Yogi Yang