Home
 
The page you are viewing is part of our 160,000 page PDF discussion forum archive spanning 1999-2011.
Go to the new Planet PDF forum to join the PDF community.
 

Search
 Advanced   
Sign up for a WebBoard account Archive Forum Home


PLATINUM
SPONSOR

GOLD
SPONSORS



Topic  
Go to previous topicPrev TopicGo to next topicNext Topic
Author Message
sudhin
sudhin

Total Messages 54

Subject:Rotation in annotation


I am using sdk 7, and trying to develop the code to rotate my annotation in the page.

My annotation contains only PDEText in appearance dict. In order to rotate the existing anotation , i first rotate the pdeText and to expand the annotation rectangle in accordance with rotated text, i take the annotation rectangle(in user space), create a transformation matrix with same rotation, and transform the rectangle trough this matrix. And finally set the rectangle to my annotation.

But the problem is, my annotation gets shifted from my original location.

this shift is reduced when i rotate an existing annotation near (0,0) in the user coordinates.

here is the code that i used to rotate annotation rectangle.

ASFixedMatrix rotateMatrix;
ASFixedRect asfLocation;

PDAnnotGetRect (oPdAnnot, &asfLocation);

memset(&rotateMatrix, 0, sizeof(rotateMatrix));
rotateMatrix.a = FloatToASFixed(cos((float)( 3.14*nRotation) / 180.0));
rotateMatrix.b = FloatToASFixed(sin((float)(-3.14*nRotation) / 180.0));
rotateMatrix.c = FloatToASFixed(sin((float)( 3.14*nRotation) / 180.0));
rotateMatrix.d = FloatToASFixed(cos((float)( 3.14*nRotation) / 180.0));
rotateMatrix.h = fixedZero;
rotateMatrix.v = fixedZero;

ASFixedMatrixTransformRect(&asfResult, & rotateMatrix, &asfLocation);
PDAnnotSetRect (oPdAnnot, &asfResult);

nRotation contains my newly rotated value.
oPdAnnot is my selected annotation.
Please help me to fix this.


Posted: 30 Jul 2009 07:56 PM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
aandi
aandi

Total Messages 17064

Subject:Rotation in annotation

This rotation matrix rotates elements around the origin (0,0). So if something was at 2 o'clock and you rotate by 90 degrees clockwise, it will be at 5 o'clock - below the origin. If you want your rotation to rotate a square within itself, then unless the square has 0,0 at the centre you need a translation component.


Posted: 30 Jul 2009 10:43 PM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
   
Go to previous topicPrev TopicGo to next topicNext Topic

go




Top | News | Developer | Find PDF Tools | Sponsorship | Tips | Home



Debenu's Planet PDF - a comprehensive site exclusively focused on Adobe Acrobat/PDF users and uses. Debenu's Planet PDF - Resources for Adobe Acrobat and PDF users

Please post PDF-related questions to our Planet PDF Forum forums.planetpdf.com. To send comments about this site please visit our contact page.
Planet PDF, Planet PDF Forum, PDF SDK - Debenu Quick PDF Library and Debenu are all copyright
© 2011 Debenu Pty Ltd.. All Rights Reserved. Privacy policy.