Adobe Illustrator Artwork 3版格式规范查询及圆形绘制技术问询
First off, your old Illustrator 3.x file is essentially a PostScript Level 3 document with Illustrator-specific metadata comments (like the %%Creator and %%AI8_CreatorVersion lines). AI versions 1 through 3 stored artwork directly as PostScript code, so the core specifications you need are rooted in PostScript standards, with minor Illustrator-specific additions.
Where to Find the Specifications
- PostScript Language Reference Manual (3rd Edition): This is the definitive source for understanding the drawing commands in your file. It covers every PostScript operator, including
m(moveto),c(curveto), andb(closepath + fill + stroke) that you see in the circle code. This manual defines how vector paths are constructed, including how Bézier curves are used to approximate shapes like circles. - Adobe Illustrator 3.x File Format Documentation: While older, Adobe's archived docs for early AI formats note that these files are PostScript documents with additional metadata comments (the lines starting with
%%). The actual drawing logic is 100% PostScript, so the PostScript manual is your primary resource.
How to Identify Circles in This Format
PostScript doesn't have a native "draw circle" operator—instead, circles are approximated using four cubic Bézier curve segments (the c commands in your code). Here's how to parse and recognize this pattern:
Breakdown of Your Circle Code
Let's walk through the code you provided:
253 -433 m 253 -465.0325 227.0325 -491 195 -491 c 162.9675 -491 137 -465.0325 137 -433 c 137 -400.9675 162.9675 -375 195 -375 c 227.0325 -375 253 -400.9675 253 -433 c b
253 -433 m: Moves the pen to the starting point (the rightmost point of the circle).- Four
ccommands: Each defines a cubic Bézier curve segment that approximates one quadrant of the circle. For a perfect approximation, the control points follow a fixed ratio relative to the circle's radius (~0.55228, which is4*(sqrt(2)-1)/3). b: Closes the path, fills it with the current fill color, and strokes it with the current stroke color.
Key Features to Detect a Circle
To programmatically identify this as a circle:
- Look for a closed path made of four consecutive cubic Bézier curves (four
coperators) that start and end at the same point (thempoint, which is repeated at the end of the lastc). - Calculate the center point: In your example, the center is
(195, -433)—this is the midpoint between opposing curve endpoints (e.g., 253 and 137 for the x-axis, -491 and -375 for the y-axis). - Verify the radius is consistent: The distance from the center to any curve endpoint (e.g.,
253-195=58,-491 - (-433)=58) should be identical. - Check the control points: Each control point should be offset from the center by
radius * 0.55228along one axis, and by the full radius along the other (matching the quadrant of the curve segment).
内容的提问来源于stack exchange,提问作者David Portabella

