cl-aseprite
0.1.2Aseprite file format parser
System Information
Definition Index
-
CL-ASEPRITE
- ASEPRITE
- ASE
NOTE: this software is of alpha quality, and the API is subject to change.
cl-aseprite
is a high-performance Common Lisp library for parsing.aseprite
files created with Aseprite and LibreSprite programs into meaningful Lisp structures.Aseprite is a proprietary image editor designed for pixel art drawing and animation. It was used in the development of several notable games such as Celeste, Loop Hero, and many others (source: Wikipedia).
LibreSprite is a free and open source fork of Aseprite created after its license changed from GPLv2 to proprietary in 2016.
Key part of the library is
LOAD-SPRITE
function, which returnsSPRITE
structure, which in turn contains lists ofTAG
andLAYER
structures with latter having an array ofCEL
structures. See Aseprite docs for details on those entities.In most cases,
CEL
'sDATA
field contains an array of 32-bit ABGR pixel data, so to convert it to image just copy it usingCFFI
into proper container, e.g. to the result of call to al_lock_bitmap when using cl-liballegro.-
EXTERNAL STRUCTURE CEL
Representation of cel.
DURATION
: duration in millisecondsX
: x position of cel dataY
: y position of cel dataOPACITY
: opacity levelZ-INDEX
: z-indexTYPE
: one of:IMAGE
,:LINKED
or:TILEMAP
USER-DATA
: user data stringWIDTH
: width in pixels (for:IMAGE
type) or in tiles (for:TILEMAP
type)HEIGHT
: height in pixels (for:IMAGE
type) or in tiles (for:TILEMAP
type)DATA
: raw data, only for:IMAGE
and:TILEMAP
typesFRAME-POSITION
: frame position to link with (only for:LINKED
type)ID-BITMASK
: bitmask for tile ID (only for:TILEMAP
type)X-FLIP-BITMASK
: bitmask for X flip (only for:TILEMAP
type)Y-FLIP-BITMASK
: bitmask for Y flip (only for:TILEMAP
type)DIAGONAL-FLIP-BITMASK
: bitmask for diagonal flip (only for:TILEMAP
type)
-
EXTERNAL STRUCTURE LAYER
Representation of layer.
VISIBLEP
: whether layer is visibleBACKGROUNDP
: whether layer is background layerCONTINUOUSP
: whether layer is continuous (prefers linked cels)REFERENCEP
: whether layer is reference layerTYPE
: one of:IMAGE
,:GROUP
or:TILEMAP
CHILD-LEVEL
: relationship with next layer in layers list, see hereBLEND-MODE
: keyword indicating blend modeOPACITY
: layer opacity. only valid ifSPRITE-HAS-OPACITY-P
isT
TILESET-INDEX
: only for:TILEMAP
typeUSER-DATA
: user data stringCELS
: array ofCEL
s, indices correspond to frame numbers
-
EXTERNAL STRUCTURE SPRITE
Representation of sprite.
WIDTH
: width in pixelsHEIGHT
: height in pixelsCOLOR-DEPTH
: color depth in bits per pixel, could be 32 (ABGR), 16 (grayscale) or 8 (indexed)COLOR-PROFILE
::SRGB
orNIL
(corresponding to "None")HAS-OPACITY-P
: whether there is opaque colorTRANSPARENT-INDEX
: palette entry index for transparent color (only for indexed sprites)COLORS
: number of colorsPALETTE
: palette as an array of packed ABGR valuesPIXEL-RATIO
: pixel width/pixel heightUSER-DATA
: user data stringFRAMES
: number of frames in each layerLAYERS
: plist of spriteLAYER
s in reversed orderTAGS
: plist of frameTAG
s
-
EXTERNAL STRUCTURE TAG
Representation of tag.
FIRST-FRAME
: index of first tagged frameLAST-FRAME
: index of last tagged frameDIRECTION
: one of:FORWARD
,:REVERSE
,:PING-PONG
or:PING-PONG-REVERSE
REPEAT
: repeat N times. 0 means infinite, 1 once etc.USER-DATA
: user data string
-
EXTERNAL FUNCTION LOAD-SPRITE
- FILESPEC
Loads Aseprite file from given
FILESPEC
, either path or binary stream.See
SPRITE
.