28 views
in GUI Development by

Hi,

I'm having a problem with warp image.

First of all, let me explain what I'm planing to do..

Following image is the dialog I'm working on.

Let's named the warp image numbered ① as a grip( it's made with 2 warp images left grip and right grip which you can find it below) and image numbered ② as a roll cursor.

left grip : (image size : 77 x 26)     right grip :  (image size : 77 x 26)     roll cursor :  (image size : 26 x 28)

There are three movement for grip warp image and one movement for roll cursor warp image.

The roll cursor movement is simple. It rotates around rotating point 1( which is imaged as below and it's <219, 219>). You can find the code and setting of war image which I made are below.

      

About the roll cursor movement, there isn't problem. The problem occurs when grip warp image's movement.

Grip warp image's movements are 1) rotating around rotating point 1, 2) rotating around rotating point 2 and 3) linear movement based on 0 point.

The problem which I have is grip movement 1)'s source anchor and grip movement 2)'s source anchor needs to be different.

When I use WarpMatrix's translation to  change rotating point which I change rotating point 1 to rotating point 2 the grip movement 3) makes the a problem.

So, I can't move the grip as I wanted.

Is there any way to solve this problem?

Please help me solve this problem.

2 Answers

0 votes
by
 
Best answer

Hello Sooyong Choi,

please see the attached example project (download link). It demonstrates the matrix calculation for the 3 cases: (1) rotation around P1, (2) rotation around P2 and (3) rotation around P1 with additional translation. Important aspects are:

- Set the SourceAnchor to <0,0>. The bitmap will thus rotate per default around its top-left corner.

- Using Matrix.Translate() apply an additional translation to the position within the bitmap around which it should be rotated.

For the 3 case the code looks like this:

m.Rotate( 0.0, 0.0, 360.0 * Angle );

// Translation to the pivot point in the bitmap.
m.Translate( 0.0, -26.0 / 2.0, 0.0 );

// Additional translation to move the bitmap to/from the point 1
m.Translate( Offset, 0.0, 0.0 );

WarpImage.Warp3D( Point1, m );

I hope I have understood your application case correctly.

Best regards

Paul Banach

0 votes
by
Hello Mr.Banach,

I'd solved the problem.

I think I found a simple problem difficult and went back too far to find the answer..

Thanks for help.

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

...