ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search
 All Forums  ImageEn Library for Delphi, C++ and .Net  ImageEn and IEvolution Support Forum  Rotate Image and its layers at 180 Degree New Topic  Reply to Topic  Printer Friendly
Author  Topic

India
600 Posts

 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.TIAYogi Yang

India
600 Posts

 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; ```HTHYogi Yang

5227 Posts

 Posted - May 17 2020 :  03:59:58 Hi YogiYes, when ImageEn rotates a layer it does not reposition it. It would be a nice option in a future version.Nigel Xequte Softwarewww.imageen.com

India
600 Posts

 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 Delhi 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.TIAYogi Yang

5227 Posts

 Posted - May 18 2020 :  18:16:01 Hi YogiPlease look in hyieutils.pas. There are whole bunch of useful methods to calculate positions/sizes after rotation.Nigel Xequte Softwarewww.imageen.com
Topic
 New Topic  Reply to Topic  Printer Friendly Jump To: Select Forum ImageEn Library for Delphi, C++ and .Net       ImageEn and IEvolution Support Forum  -------------------- Home Active Topics Frequently Asked Questions Member Information Search Page