432 views
in GUI Development by
Hi,

I have a bitmap of circle and I have adapted that bitmap to a warp image view. The circle is used to indicate that the "loading" process is happening by continuously rotating the circle. I have used timer and rotate and scale method. But it won't work. How this problem can be solved?.

Regards,
Sazna.

1 Answer

+3 votes
by

Hi Sazna! 

I did this just yesterday. Here is the solution I have come up with:

First I used a Float Effect that goes between values 0.0 and 360.0, with Linear timing to ensure a smooth animation, though the same could certainly be done with a timer. 

I have the outlet for the FloatEffect set to a property called "Angle". The Property has an "OnSetAngle" method with the following code:

OnSetAngle:

*********************************************************************************************
if ( pure Angle == value )
  return;
pure Angle = value;

WarpImage.RotateAndScale( WarpImage.Bounds.orect.center, Angle, 1.0, 1.0 );

*********************************************************************************************

Note that this will rotate counter clockwise, you can set the function to -Angle for clockwise. Make sure the float effect is enabled and you should see rotation. 

You don't necessarily need to use an effect, but if you use a timer. make sure that the angle you are rotating to is incrementing on each trigger. You will probably need some kind of counting variable to accomplish that. 

Let me know if this works for you, and if not, I can try to assist. 

-Liam

 

by

Hi Liam,

when I give WarpImage.RotateAndScale( WarpImage.Bounds.orect.center, Angle, 1.0, 1.0 ), It shows me error that the bounds is an unknown identifier. Then I have changed the WarpImage.Bounds.orect.center to a point value. Now the image rotates but for my case, I want the ring bitmap to rotate at the fixed position.

  

It is the bitmap and I want this edges to rotate while the position of the bitmap is fixed. Could you please assist me for that.?

 

Regards,

Sazna.

by

Hi Sazna, 

 

You may need to find the center point with respect to the bounds of the owner. If your warp bitmap is an object in another existing dialog you may need to do something like this:
 

first try replacing WarpImage.Bounds.orect.center with WarpImage.Bounds.center

From my understanding of things, this should work. 

 

if this still does not work give the following a try:

var centerPoint point = point( (WarpImage.Bounds.origin.x + (WarpImage.Bounds.w / 2)) , (WarpImage.Bounds.origin.y + (WarpImage.Bounds.h / 2)) );

WarpImage.RotateAndScale( centerPoint, Angle, 1.0, 1.0 );

This should get you a calculated center point of the warpImage. However, I believe the first method should work.

 

Best,

Liam

 

by
Hi Liam,

The main problem is the WarpImage view doesn't have properties like bounds and center. Always shows "Unknown identifier bounds/center used in the scope of views::WarpImage". What can be done for this?

Regards,

Sazna.
by
Hi Sazna,

 

Your absolutely right. I made an error. Try using WarpImage.SourceAnchor. This is a point property that you can set which should be set to the center point of the WarpImage.

 

You could also do something more cumbersome like:

var point centerPoint = point( WarpImage.Point1.x + ((WarpImage.Point2.x - WarpImage.Point1.x) / 2), WarpImage.Point1.y + ((WarpImage.Point4.y - WarpImage.Point1.y) / 2) );

This should generate the center point of the warpImage.

 

Let me know how this works,

Liam
by
Hi Liam,

It still didn't meet the requirement.

Regards,

Sazna
by

Hi Sazna,

please have a look to the section Perform 2D rotate and scale operations - it explains the details about the source anchor and the destination position.

I hope this helps....

Best regards,
Manfred.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...