TxSprite class

Inheritance

Constructors

TxSprite({required int msgCode, required int width, required int height, required int numColors, required Uint8List paletteData, required Uint8List pixelData})
Create a sprite with the specified size, palette data and pixel data, identified by the specified message code (the identifier used on the Lua side to label this sprite) width(Uint16), height(Uint16), bpp(Uint8), numColors(Uint8), palette (Uint8 r, Uint8 g, Uint8 b)*numColors, data (length: width x height bytes content: palette index)
TxSprite.fromImageBytes({required int msgCode, required Uint8List imageBytes})
Create a TxSprite from any image bytes that can be decoded by img.decode() If it's an indexed image, quantize down to 14 colors if larger (plus black, white as palette entries 0 and 1.) If it's an RGB image, also quantize to 14 colors (then prepend black and white) Scale to 640x400 preserving aspect ratio for 1- or 2-bit images Scale to ~128k pixels preserving aspect ratio for 4-bit images TODO improve quantization - quality, speed If quantizing, since neuralNet seems to give the black in entry 0 and white in the last entry We just leave 0 (black) and swap palette entries 1 and 15 (and remap those pixels)
TxSprite.fromPngBytes({required int msgCode, required Uint8List pngBytes})
Create a TxSprite from an indexed PNG Sprites should be PNGs with palettes of up to 2, 4, or 16 colors (1-, 2-, or 4-bit indexed palettes) Alpha channel (4th-RGBA), if present, is dropped before sending to Frame (RGB only, but color 0 is VOID) Scale to 640x400 if larger, preserving aspect ratio

Properties

hashCode int
The hash code for this object.
no setterinherited
height int
no setter
msgCode int
no setterinherited
numColors int
no setter
paletteData Uint8List
no setter
pixelData Uint8List
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width int
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pack() Uint8List
Corresponding parser should be called from frame_app.lua data_handler()
override
toImage() → Image
Convert TxSprite back to an image for testing/verification
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

pack1Bit(Uint8List bpp1) Uint8List
pack2Bit(Uint8List bpp2) Uint8List
pack4Bit(Uint8List bpp4) Uint8List