This content has been marked as final.
Show 12 replies
-
1. Re: Last question for today - how to draw with API circle of N pixels radius
(Leonard_Rosenthol) Sep 5, 2008 9:16 AM (in response to andrejusc)You call it four times...
Here is a snippet that explains the math...
/* 4/3 * (1-cos 45)/sin 45 = 4/3 * sqrt(2) - 1 */
#define ARC_MAGIC ((ASFixed) 0.552284749)
#define PI ((ASFixed)3.141592654)
void DrawCircle( ASFixed inCenterX, ASFixed inCenterY, ASFixed inRadius )
{
/* draw four Bezier curves to approximate a circle */
MoveTo( inCenterX + inRadius, inCenterY );
CurveTo( inCenterX + inRadius, inCenterY + inRadius*ARC_MAGIC,
inCenterX + inRadius*ARC_MAGIC, inCenterY + inRadius,
inCenterX, inCenterY + inRadius );
CurveTo( inCenterX - inRadius*ARC_MAGIC, inCenterY + inRadius,
inCenterX - inRadius, inCenterY + inRadius*ARC_MAGIC,
inCenterX - inRadius, inCenterY );
CurveTo( inCenterX - inRadius, inCenterY - inRadius*ARC_MAGIC,
inCenterX - inRadius*ARC_MAGIC, inCenterY - inRadius,
inCenterX, inCenterY - inRadius );
CurveTo( inCenterX + inRadius*ARC_MAGIC, inCenterY - inRadius,
inCenterX + inRadius, inCenterY - inRadius*ARC_MAGIC,
inCenterX + inRadius, inCenterY );
Close();
} -
2. Re: Last question for today - how to draw with API circle of N pixels radius
andrejusc Sep 7, 2008 9:09 AM (in response to andrejusc)Hi Leonard,
Thank you for that snippet!
What is the best way to fill this painted circle with black? Do I need first to fill those curve segments and then draw filled internal rectangle? Or there is any other way for that? -
3. Re: Last question for today - how to draw with API circle of N pixels radius
(Leonard_Rosenthol) Sep 7, 2008 10:55 AM (in response to andrejusc)You would follow up the drawing operators will a set color operator ('g') and then a fill operator ('f'). -
4. Re: Last question for today - how to draw with API circle of N pixels radius
andrejusc Sep 7, 2008 11:18 AM (in response to andrejusc)If inRadius is of value 1.4175 (instead of let say 72) - I think it doesn't work with ARC_MAGIC value. I only see 2 segments of whole circle painted correctly in that case. What shold be used for such small radius values? -
5. Re: Last question for today - how to draw with API circle of N pixels radius
andrejusc Sep 7, 2008 11:34 AM (in response to andrejusc)Sorry, was my mistake with some commented lines. Everything works properly. -
6. Re: Last question for today - how to draw with API circle of N pixels radius
(Madhav) Nov 22, 2008 12:30 AM (in response to andrejusc)CurveTo( inCenterX + inRadius, inCenterY + inRadius*ARC_MAGIC,
inCenterX + inRadius*ARC_MAGIC, inCenterY + inRadius,
inCenterX, inCenterY + inRadius );
Hi All,
I am using above code snippet, but it gives error because MoveTo() & CurveTo() function is not present.
please reply.. -
7. Re: Last question for today - how to draw with API circle of N pixels radius
andrejusc Nov 22, 2008 6:26 AM (in response to andrejusc)Hi,
Take a look at PDEPathDrawCurveSnip.cpp in Plugins samples.
What you actually need is to have your own function (call it DrawCircle for example) similar to DrawCurve, in which you'll have your own sequence of these statements:
ASFixed pathData[10];
pathData[0] = kPDEMoveTo;
pathData[1] = x;
pathData[2] = y;
pathData[3] = kPDECurveTo;
pathData[4] = x1;
pathData[5] = y1;
pathData[6] = x2;
pathData[7] = y2;
pathData[8] = x3;
pathData[9] = y3; -
8. Re: Last question for today - how to draw with API circle of N pixels radius
(Madhav) Nov 24, 2008 6:44 AM (in response to andrejusc)Hi..
I want to create Circle and polygon on page. please helpme to draw circle.. I am create curveTo() as follows...
void CurveTo(ASFixed x, ASFixed y, ASFixed x1, ASFixed y1, ASFixed x2, ASFixed y2)
{
PDEPath path = PDEPathCreate();
PDEPathSetPaintOp(path, kPDEStroke);
PDEGraphicState gState = SetGraphicState(ASInt32ToFixed(1),
ASInt32ToFixed(1), ASInt32ToFixed(0), ASInt32ToFixed(0));
PDEElementSetGState((PDEElement) path, &gState, sizeof(PDEGraphicState));
ASFixed pathData[10];
pathData[0] = kPDEMoveTo;
pathData[1] = x;
pathData[2] = y;
pathData[3] = kPDECurveTo;
pathData[4] = x1;
pathData[5] = y1;
pathData[6] = x2;
pathData[7] = y2;
PDEPathSetData(path, pathData, sizeof(pathData));
}
but it doesn't work i.e not shown circle.. please reply..
Thanks in Advance.. -
9. Re: Last question for today - how to draw with API circle of N pixels radius
(kirubasankar) Jan 27, 2009 4:28 AM (in response to andrejusc)sir i want to generate a small circle while i click a button inside my circle it will count automatically ...so please send me the code..... -
10. Re: Last question for today - how to draw with API circle of N pixels radius
(kirubasankar) Jan 27, 2009 4:30 AM (in response to andrejusc)sir i want to generate a small circle while i click a button.. inside my circle it should display (one) 1 ...while i clicked each time it will automatically get increamented ..upto 999 if(count=1000) again it will display 1 in the circle..it will count automatically ...so please send me the code..... -
11. Re: Last question for today - how to draw with API circle of N pixels radius
(Leonard_Rosenthol) Jan 27, 2009 5:36 AM (in response to andrejusc)You need to look at the documentation for Acrobat forms and JavaScript. -
12. Re: Last question for today - how to draw with API circle of N pixels radius
(kirubasankar) Feb 1, 2009 11:47 PM (in response to andrejusc)i am using acrobat pro can u please tell me how could i create the above task using acrobat pro
