ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 I have a question about layer rotation.
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

ickkm

14 Posts

Posted - Dec 16 2025 :  02:36:24  Show Profile  Reply
I'm trying to implement an analog clock, as shown in the attached image.

MainImageView.LayersCaching := -1;
MainImageView.LayersCropped := false;
MainImageView.LayersRotationFilter := ierBicubic;
MainImageView.LayersRotationUseFilterOnPreview := True;
MainImageView.LayersFastDrawing := iefDelayed;

I created a layer by setting it up as shown in the attached source above.

MainImageView.Layers[1+(Ni*4)].Rotate := -AHour;

MainImageView.Layers[2+(Ni*4)].Rotate := -AMin;

MainImageView.Layers[3+(Ni*4)].Rotate := -ASec;

And as shown above, the clock has been implemented successfully using the rotate command. However, when the minute image rotates, there's a slight fluctuation, as if PosX and PosY are changing. The most severe changes are around 180 and 360 degrees. The image size is 10 pixels wide and 256 pixels high. What's a good way to solve this problem?

xequte

39297 Posts

Posted - Dec 16 2025 :  20:47:41  Show Profile  Reply
Hi

Rounding errors are likely to be an issue here.

I think that a more reliable method would be to create your hour, minute and second hand images at the size of their maximum rotation so that the rotation point of each hand (the pin) is located at precisely the center of the image.

Another possibility is to use TIEImageLayer( ImageEnView1.CurrentLayer ).RotateCenterX/Y for the position of the rotation point.

https://www.imageen.com/help/TIELayer.RotateCenterX.html
https://www.imageen.com/help/TIELayer.RotateCenterY.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: