| 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 |
|