A shape is the vector artwork of a frame or of a shape object. Everything here is as the JPEXS FLA converter reads and writes it, and has been checked against some thousands of real files. Values are little-endian.
Numbers
- A matrix is six signed 32-bit words: a, b, c, d as signed 16.16 fixed-point numbers, then tx, ty in twips (1/20 of a pixel). x′ = a·x + c·y + tx, y′ = b·x + d·y + ty.
- Edge coordinates are in 1/128 of a twip, so 2,560 to a pixel.
- A colour is four bytes in the order red, green, blue, alpha.
- Style indices count from 1; 0 means no style. The top bit of a stroke or fill index
(
0x8000) marks a selected edge.
The shape part
Classes CPicShape, CPicFrame, CPicRect and
CPicOval start with the same part: the
object part, then:
| Field | Meaning |
|---|---|
| u8 | The shape part’s revision (0 to 6). From revision 3 this sets the shape’s mode, below. |
| 6 × s32 | The shape’s matrix. |
| … | The shape data, below. |
Shape data
The mode is the part’s revision less 2 (0 for revisions below 3).
| Field | Present | Meaning |
|---|---|---|
| u8 | always | The data’s revision, 0 to 5. |
| u32 | always | A count hint, equal to the number of edges in the files seen. |
| u16 + fills | always | The fill styles. Below data revision 3 each is a u32 colour and a u16 value, not established; from 3, the fill record below. |
| u16 + strokes | always | The stroke styles. |
| edges | data revision 2 or more | Edge records, ended by a zero byte. |
| u32 + cubics | data revision 5 | The cubic curves. |
Fill styles
| Field | Meaning |
|---|---|
| u32 | The colour, for a solid fill (red, green, blue, alpha). |
| u8 flags | 0x10 gradient, 0x20 extended, 0x40 bitmap; none set is solid. For a gradient, 0x10 alone is linear, 0x12 and 0x13 radial. For a bitmap, bit 0 clipped (otherwise tiled), bit 1 not smoothed. |
| u8 | Secondary flags; not established. |
Gradient (0x10)
| Field | Present | Meaning |
|---|---|---|
| 6 × s32 | always | The gradient matrix. |
| u8 | always | The number of stops, up to 15. |
| s32 | mode 1 and up | The focal point: its low 16 bits as a signed number over 255. |
| u32 | mode 1 and up | Gradient flags: 0x01 linear RGB, 0x04 reflect, 0x08 repeat (neither: pad). |
| n × (u8, u32) | always | Stops: a ratio (0 to 255) and a colour. |
Extended fill (0x20)
Six s32 of a matrix, a u32 value, and four u16 words. JPEXS reads these but no public work states what they are used for: treat the extended fill as not established.
Bitmap fill (0x40)
Six s32 of a matrix, then a u16 media number: the mediaId of a
CMediaBits record.
Stroke styles
| Field | Present | Meaning |
|---|---|---|
| u32 | always | The colour. |
| u16 | always | The width in twips. |
| u16 | always | Style word 1; if non-zero, the stroke is dashed and this is the dash length in twips. |
| u16 | always | Style word 2: bits 0 to 2 the kind (below) when style word 1 is 0; bit 15 sharp corners; the higher bits are by kind, below. |
| u8 | mode 1 and up | Pixel hinting (0 or 1). |
| u8 | mode 1 and up | Scale mode: 0 normal, 1 horizontal, 2 vertical, 3 none. |
| u8 | mode 1 and up | Cap: 0 none, 1 round, 2 square. |
| u8 | mode 1 and up | Join: 0 miter, 1 round, 2 bevel. |
| u16 | mode 1 and up | Miter limit as 8.8 fixed point. |
| fill record | mode 1 and up | The stroke’s paint (a solid colour, gradient or bitmap). |
| Kind | Name | The rest of style word 2 (from bit 3 up) |
|---|---|---|
| 0 | solid | – |
| 1 | dashed | Style word 1 holds the dash; the gap in twips is style word 2 with bit 15 cleared. |
| 2 | dotted | Bits 3 up: the dot spacing in twips. |
| 3 | ragged | Bits 3–5 pattern (solid, simple, random, dotted, random dotted, triple dotted, random triple dotted), 6–7 wave height (flat, wavy, very wavy, wild), 8–9 wave length (very short, short, medium, long). |
| 4 | stipple | Bits 3–4 dot size (tiny, small, medium, large), 5–6 variation (one size, small variation, varied sizes, random sizes), 7–8 density (very dense, dense, sparse, very sparse). |
| 5 | hatched | Bits 3–4 thickness (hairline, thin, medium, thick), 5–6 space (very close, close, distant, very distant), 7–8 rotate (none, slight, medium, free), 9–10 jiggle (none, bounce, loose, wild), 11–12 curve (straight, slight curve, medium curve, very curved), 13–14 length (equal, slight variation, medium variation, random). |
| 6, 7 | not known | – |
Edge records
An edge is one line or quadratic curve between two points, with the styles on either side of it. The first edge’s control byte is non-zero; the list ends with a zero byte. Coordinates are absolute, written as changes from the previous edge’s end.
| Field | Present | Meaning |
|---|---|---|
| u8 | always | The control byte, below. |
| 3 × u8 or u16 | control & 0x40 | The stroke, left fill and right fill style indices, u8 if control & 0x80, otherwise u16. Absent: the previous edge’s styles again. |
| delta, delta | always | The change from the last edge’s end to this edge’s start (x, y). |
| delta, delta | a curve | The control point, relative to the start. |
| delta, delta | always | The end, relative to the start. |
| u8 | a line, mode 2 and up | Line flags; written as | (0) or / (1) in XFL. |
| Control bits | Meaning |
|---|---|
0x03 | The encoding of the start delta. |
0x0C | The encoding of the control delta. Non-zero makes the edge a curve. |
0x30 | The encoding of the end delta. |
0x40 | Style indices follow. |
0x80 | The style indices are u8, not u16. |
| Encoding | A delta is |
|---|---|
| 0 | Zero: nothing is stored. |
| 1 | An s16. |
| 2 | An s32. |
| 3 | An s16 shifted left seven bits. |
Cubics
Flash CS4 adds true cubic curves (data revision 5), which its shape editing keeps as well as the quadratics. A u32 count, then each curve:
| Field | Present | Meaning |
|---|---|---|
| 8 × s32 | always | The curve’s four points. |
| u8 + n × (s32, s32, u8, u8) | mode 3 and up | The quadratic entries: x, y, a control flag and a further value. |
| u8 | mode 4 and up | Flags: 0x01 a boundary start point follows (2 × s32), 0x02 a boundary end point follows (2 × s32). |
Rectangle and oval objects
Flash CS4’s primitive shapes, classes CPicRect and CPicOval:
the shape part (their outline), a u8 revision (0 to 3), a u8 of flags, then:
CPicRect: four s32, the corner radii.CPicOval: four s32, the bounds; then three floats: start angle, end angle (degrees) and inner radius (a percentage).
Morph shapes
A shape tween is held on its keyframe as a CPicMorphShape:
| Field | Present | Meaning |
|---|---|---|
| u8 | always | The revision, up to 2. |
| 2 × (6 × s32) | always | The matrices of the start and end shapes. |
| u32, u32 | revision 2 | A value not established, and the acceleration. |
count + CMorphSegment | always | The segments: four s32 style indices (stroke and fill, start and end), two points (s32, s32) and a count of CMorphCurve objects. |
count + CMorphHintItem | always | Shape hints: two points and a u32 key. Older files keep these in an MFC CObList: a u16 count, then the objects. |
| u16 + fills, u16 + strokes | always | The tween’s styles, written with mode 0. |
CMorphCurve: control point and anchor point of the start and end shapes
(four pairs of s32) and a u32 line flags.
A count here is a u16; if it is FFFF a u32 follows with the real count.