Binary specs
In this section, we'll learn about the binary specs of .px files so that anyone can decode the file for various purposes.
How to decode
Models without header
These are pretty simple, their sizes are pre-determined, so just consume data and decode the values one by one to fill the properties of the models
Models with header
All headers contain a field to specify the length of the model. Use that field to determine where the model ends.
We'll see that there are properties within the models that have default values. If we reach the end of the data for the model, but there are still fields that need values, simply use the default value in this case.
Data types
These are some simple data types. .px files use little-endian byte order.
Primitive types
These are notated similarly to Swift data types
UInt- A n-bit unsigned integerUInt8is an 8-bit unsigned integer
Int- A n-bit signed integerInt16is a 16-bit signed integer
Float- A n-bit floatFloat32is a 32-bit float
Bool- A boolean value, 1 byteOptionSet<UInt>- A set oftrue(1) -false(0) flags using each bit of theUInttypeOptionSet<UInt8>has 8 flags. So0b10010001has1 << 0,1 << 4, and1 << 7flag set
DumbString- UTF8 data of a stringString- A stringThe first 2 bytes are a
UInt16to specify the length of the StringThe remaining is the UTF8 data of the string
Don't ask me why there is a
DumpStringin the first place
[Type]- An array of TypeThe first 8 bytes are a UInt64 to specify the length of the Array
The rest are the elements
Type[n]- n consecutive value ofTypeUInt8[3]- 3 consecutive UInt8
Composite types
Coordinate
Size
Rect
ARGBColor
RGB channels are alpha pre-multiplied
BlendMode
Corners
Models
Most models in this section have a header. Pixquare uses ID for everything.
CustomData
Store some custom data set by the users
Header (16 bytes)
Content
FrameContent
The color data of a cel.
Header (32 bytes)
Content
TilemapFrameContent
The alignment of a tilemap cel.
Header (32 bytes)
Content
Frame
A frame of the artwork.
Header (32 bytes)
Content
SymmetryLline
Header (16 bytes)
Content
Tag
Header (16 bytes)
Content
Tileset
Header (32 bytes)
Content
Fx
Header (16 bytes)
Content
Entry
Represents an entry in the artwork (layer, group, etc.), but doesn't have any actual data of the entry.
Header (16 bytes)
Content
Layer
A layer with all data.
Header (32 bytes)
Content
Group
A group with all data.
Header (32 bytes)
Content
ReferenceLayer
A reference layer with all data
Header (32 bytes)
Content
TilemapLayer
A tilemap layer with all data
Header (32 bytes)
Content
Stats
Contains data like time spent on this file, stroke count, etc.
Header (16 bytes)
Content
CanvasGrid
GuideLine
Header (14 bytes)
Content
Post-processor
Header (16 bytes)
Content
PaletteOrganization
Header (16 bytes)
Content
Artwork
This is the data of .px files.
Header (64 bytes)
Content
Last updated
Was this helpful?