TxTextSpriteBlock class

Inheritance

Constructors

TxTextSpriteBlock({required int msgCode, required int width, required int fontSize, required int maxDisplayRows, String? fontFamily, TextAlign textAlign = ui.TextAlign.left, TextDirection textDirection = ui.TextDirection.ltr, required String text})
Represents an (optionally) multi-line block of text of a specified width and number of visible rows at a specified lineHeight If the supplied text string is longer, only the last displayRows will be shown rendered and sent to Frame. If the supplied text string has fewer than or equal to displayRows, only the number of actual rows will be rendered and sent to Frame If any given line of text is shorter than width, the text Sprite will be set to the actual width required. When sending TxTextSpriteBlock to Frame, the sendMessage() will send the header with block dimensions and line-by-line offsets and the user then sends each line[] as a TxSprite message with the same msgCode as the Block, and the frame app will use the offsets to place each line. By sending each line separately we can display them as they arrive, as well as reducing overall memory requirement (each concat() call is smaller). After calling the constructor, check isNotEmpty before calling rasterize() and sending the header or the sprites. Sending a TextSpriteBlock with no lines is not intended usage. text is trimmed (leading and trailing whitespace) before laying out the paragraph, but any blank lines within the range of displayed rows will be sent as an empty (1px) TxSprite

Properties

fontSize int
no setter
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
After construction, a TextSpriteBlock should be tested that it has a non-zero number of sprite lines to send, otherwise it should not be rasterized nor sent
no setter
isNotEmpty bool
After construction, a TextSpriteBlock should be tested that it has a non-zero number of sprite lines to send, otherwise it should not be rasterized nor sent
no setter
maxDisplayRows int
no setter
msgCode int
no setterinherited
numLines int
no setter
rasterizedSprites List<TxSprite>
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 data handler
override
rasterize({required int startLine, required int endLine}) Future<void>
Since the Paragraph rasterizing to the Canvas, and the getting of the Image bytes are async functions, there needs to be an async function not just the constructor. Plus we want the caller to decide how many lines of a long paragraph to rasterize, and when. Text lines as TxSprites are accumulated in this object. startLine and endLine are inclusive
toPngBytes({required int startLine, required int endLine}) Future<Uint8List>
Convert TxTextSpriteBlock back to a single image for testing/verification startLine and endLine are inclusive
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

monochromePal ↔ PaletteUint8?
getter/setter pair