Photoshop stores the paths saved with an image in an image resource block.
These resource blocks consist of a series of 26 byte path point records, and so
the resource length should always be a multiple of 26.
Photoshop stores its paths as resources of type 8BIM with IDs in the range
2000 through 2999. These numbers should be reserved for Photoshop. The
name of the resource is the name given to the path when it was saved.
If the file contains a resource of type 8BIM with an ID of 2999, then this
resource contains a Pascal–style string containing the name of the clipping
path to use with this image when saving it as an EPS file.
The path format returned by GetProperty() call is identical to what is
described below. Refer to the IllustratorExport sample plug–in code to
see how this resource data is constructed.
Path points:
------------
All points used in defining a path are stored in eight bytes as a pair of 32–bit
components, vertical component first.
The two components are signed, fixed point numbers with 8 bits before the
binary point and 24 bits after the binary point. Three guard bits are reserved
in the points to eliminate most concerns over arithmetic overflow. Hence,
the range for each component is 0xF0000000 to 0x0FFFFFFF representing a
range of –16 to 16. The lower bound is included, but not the upper bound.
This limited range is used because the points are expressed relative to the
image size. The vertical component is given with respect to the image
height, and the horizontal component is given with respect to the image
width. [0,0] represents the top–left corner of the image; [1,1]
([0x01000000,0x01000000]) represents the bottom–right.
In Windows, the byte order of the path point components are reversed; you
should swap the bytes when accessing each 32–bit value.
Path records:
-------------
The data in a path resource consists of one or more 26-byte records. The first
two bytes of each record is a selector to indicate what kind of path it is. For
Windows, you should swap the bytes before accessing it as a short (int16).
The first 26-byte path record contains a selector value of 6, path fill rule
record. The remaining 24 bytes of the first record are zeroes. Paths use even/
Table 2–5: Path data record types:
-----------------------------------
Selector Description
0 Closed subpath length record
1 Closed subpath Bezier knot, linked
2 Closed subpath Bezier knot, unlinked
3 Open subpath length record
4 Open subpath Bezier knot, linked
5 Open subpath Bezier knot, unlinked
6 Path fill rule record
7 Clipboard record