A shape drawn on the stage is a <DOMShape> in a frame’s
<elements>. Like a shape in a SWF file, it is not a list of separate
outlines but a set of edges, each saying which fill lies on its left and which on its
right, and which stroke draws it. The styles come first, numbered, and the edges refer to
them by number. The edges themselves are packed into one compact string. Adobe has not
documented this encoding; the description below follows the xfl2svg project’s reader
and was checked against the files examined for this site.
<DOMShape>
<fills>
<FillStyle index="1">
<SolidColor color="…"/>
</FillStyle>
</fills>
<edges>
<Edge fillStyle1="1" edges="!36 -36S2|120 0!120 0|36 36!36 36|0 120 …"/>
</edges>
</DOMShape>
LIBRARY/Tween 1.xml of a Flash CS5.5 document; the colour differs from file to file.Fill styles
<fills> holds one <FillStyle> for each fill the
shape uses. Its index attribute is the number the edges use, counting from
1. It holds one of:
| Element | Attributes and children |
|---|---|
<SolidColor> | A flat colour: color (default #000000) and alpha (default 1). |
<LinearGradient> | A <matrix> that places the gradient, then <GradientEntry color alpha ratio> stops (ratio 0 to 1, up to 15 stops); spreadMethod (pad, reflect, repeat) and interpolationMethod (rgb, linearRGB). |
<RadialGradient> | The same, and focalPointRatio, −1 to 1 (default 0, the centre). |
<BitmapFill> | A <matrix>, bitmapPath (the bitmap’s name in the library) and bitmapIsClipped (default true; false tiles the bitmap). |
The gradient matrix maps a square of 1,638.4 pixels (32,768 twips), centred on 0, to the gradient’s box, as in a SWF file.
Stroke styles
<strokes> holds one <StrokeStyle> for each line
style, again numbered by index. It holds one stroke element. Every stroke
has weight (pixels, default 1), scaleMode
(none, normal, vertical,
horizontal), miterLimit (default 3),
pixelHinting, sharpCorners, and a <fill>
holding its paint as one of the fills above.
| Element | Its own attributes, with defaults |
|---|---|
<SolidStroke> | caps: none, round (default), square. joints: miter, round (default), bevel. solidStyle: the hairline setting. |
<DashedStroke> | dash1 and dash2, the dash and the gap (default 6). |
<DottedStroke> | dotSpace (default 3). |
<RaggedStroke> | pattern: solid, simple (default), random, dotted, random dotted, triple dotted, random tripple dotted (so spelt). waveHeight: flat, wavy (default), very wavy, wild. waveLength: very short, short (default), medium, long. |
<StippleStroke> | dotSize: tiny, small (default), medium, large. variation: one size, small variation, varied sizes (default), random sizes. density: very dense, dense, sparse (default), very sparse. |
<HatchedStroke> | hatchThickness: hairline (default), thin, medium, thick. space: very close, close, distant (default), very distant. jiggle: none (default), bounce, loose, wild. rotate: none (default), slight, medium, free. curve: straight (default), slight curve, medium curve, very curved. length: equal (default), slight variation, medium variation, random. |
These are the same kinds and choices, in the same order, as the stroke style bits of a binary FLA.
Edges
<edges> holds the shape’s <Edge> elements. Each
has:
| Attribute | Meaning |
|---|---|
fillStyle0 | The fill on the left of the path, as it is drawn. |
fillStyle1 | The fill on the right of the path. |
strokeStyle | The stroke that draws the path. |
edges | The path, as a string of commands. |
cubics | The cubic curves the path was drawn with, below. |
The styles default to 0, none. The shape itself has isDrawingObject
(a drawing object, drawn in object drawing mode) and isFloating, whose
meaning is not established.
The string is a run of commands, each one character followed by numbers separated by spaces. There is no space before a command:
| Command | Numbers | Meaning |
|---|---|---|
! | x y | Move to the point. |
| or / | x y | A straight line to the point. The two differ only in the line-flags byte a binary FLA stores after a straight edge: | is 0 and / is 1, as the JPEXS converter maps them. What the flag means is not established. |
[ or ] | cx cy x y | A quadratic Bézier curve to (x, y), with control point (cx, cy). |
S | a number | After a move, such as S2: which sides of the edge are selected, as bits: 1 the left fill, 2 the right fill, 4 the stroke. The JPEXS converter reads it so, from the selected-edge bits of the binary form; a drawing ignores it. |
Points are absolute, in the shape’s own coordinates. To draw a shape as filled areas, a reader collects the edges of each fill style, reversing those that have the fill on the other side, and joins them end to end into closed outlines, as for the shapes of a SWF file. Strokes are drawn from the edges of each stroke style as they are.
Reading the example: !36 -36 moves to (36, −36); S2 is a
marker; |120 0 draws a line to (120, 0). Then !120 0|36 36
moves to (120, 0) and draws to (36, 36), and !36 36|0 120 draws from
there to (0, 120). Here each segment starts with its own move, even where it carries
on from the one before.
Numbers
Coordinates are in twips, twentieths of a pixel, so 120 is 6 pixels.
They are written in one of two ways:
- Decimal, with an optional sign and fraction:
36,-120,1.25. - Hexadecimal fixed point, after
#: the whole part in hexadecimal, a dot, and the fraction as two hexadecimal digits, in 256ths.#1.2Cis0x1+0x2C÷ 256 = 1 + 44 ÷ 256 = 1.171875 twips.
Morph shapes, for shape tweens, use the same numbers in their
<MorphSegment> and <MorphCurves> elements, in
the # form.
The # form is a 32-bit signed number, whole part and fraction, written in
hexadecimal with the fraction’s two digits after the dot: a whole part of
800000 or more is negative (subtract 0x1000000). So
#FFFF38.80 is −200 + 0.5 = −199.5 twips. The xfl2svg and JPEXS readers both
read it so, and so does the explorer.
Cubics
An edge drawn as a cubic Bézier curve can also keep that curve in its
cubics attribute, beside the quadratic approximation in
edges. The schema gives its grammar, with decimal twips:
!x y (a, b; c1x,c1y c2x,c2y ex,ey Q x y q x y P x y …) c, d;
!x y– the start point(a, b;– an optional point, then the cubic’s control points and end point- then pairs of numbers, each pair optionally led by
Q,q,Porp: the points of the quadratic curves that stand for the cubic ) c, d;– another optional point
These are the same parts as a binary FLA’s cubic records: four points, the approximation’s entries with a control flag each, and two optional boundary points. The meaning of the four letters and of the boundary points is not established. The explorer shows the string as it is.