Expand description
Pixel8’s clipboard data model and paste appliers, plus the native JSON clipboard codec.
The value types here are format-neutral: PICO-8 [gfx]/[sfx] blobs decode
into them (see crate::pico8) and so does Pixel8’s native JSON format.
Structs§
- Paste
Report - The outcome of a paste, ready for the editor’s status bar.
- Pixel
Rect - A
width * heightblock of palette-index pixels, one per cell, row-major. - SfxClip
- A decoded
[sfx]blob: the SFX records plus any trailing pattern footers (present when the blob came from copying a song pattern). The patterns’ channel refs hold PICO-8 source SFX slots until a paste remaps them. - Slotted
- One clipboard item tagged with the PICO-8 slot it was copied from.
Enums§
- Clipboard
Payload - One copied item, tagged by kind. Reuses the asset structs, so
Sfx::custom_wave, sprite flags, and 8-bit map tiles all survive. - Pasted
- One decoded clipboard blob, by kind.
Functions§
- encode
- Encode a payload as a native
{ "app": "pixel8", … }JSON clipboard blob. - parse
- Decode a clipboard string into a
Pasted: a native Pixel8 JSON blob (a single{ … }object), else a PICO-8[gfx]/[sfx]blob. Any unrecognised or malformed text is anErr. - paste_
pattern - Music-editor paste: append the clip’s SFX after the last used SFX slot
(non-destructive), remap each footer pattern’s channel refs to where those
SFX landed, then overwrite music patterns from
at_pattern. - paste_
sfx - SFX-editor paste: overwrite SFX slots from
atwithrecords, remapping each record’s custom-instrument note refs to the slots they land in. Records past slot 63 are dropped. - paste_
sprites - Blit a pixel rectangle with its top-left at sheet pixel
(x0, y0), overwriting in place. Pixels past the sheet edge are clipped.flagsis one byte per covered 8x8 sprite (row-major); whenSome, each byte overwrites the destination sprite’s flag byte.