Package com.tonic.vellum
Interface Canvas
-
public interface CanvasA drawing surface clipped to a section's bounds. Coordinates are local with (0,0) at the section's top-left; out-of-range writes are silently discarded, and writes mutate the back buffer without emitting escape codes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Rectbounds()voidclear()Fills the entire canvas with spaces in the default style.Canvasclip(Rect sub)Returns a further-clipped sub-canvas whose origin is the given rectangle's top-left.voidfill(Rect area, char c, Style style)Fills a local rectangle with a character and style.intheight()voidput(int x, int y, char c)Writes a character with the default style.voidput(int x, int y, char c, Style style)Writes a character with an explicit style.voidput(int x, int y, java.lang.String text)Writes a single line of text with the default style, truncated at the right edge.voidput(int x, int y, java.lang.String text, Style style)Writes a single line of text, truncated at the right edge.voidputCodePoint(int x, int y, int codePoint)Writes a Unicode code point, including supplementary characters, with the default style.voidputCodePoint(int x, int y, int codePoint, Style style)Writes a Unicode code point, including supplementary characters, with an explicit style.intwidth()
-
-
-
Method Detail
-
width
int width()
- Returns:
- the canvas width in columns
-
height
int height()
- Returns:
- the canvas height in rows
-
bounds
Rect bounds()
- Returns:
- the local bounds: origin (0,0) with this canvas's width and height
-
put
void put(int x, int y, char c)Writes a character with the default style.- Parameters:
x- the local columny- the local rowc- the character to write
-
put
void put(int x, int y, char c, Style style)Writes a character with an explicit style.- Parameters:
x- the local columny- the local rowc- the character to writestyle- the style to apply
-
putCodePoint
void putCodePoint(int x, int y, int codePoint)Writes a Unicode code point, including supplementary characters, with the default style.- Parameters:
x- the local columny- the local rowcodePoint- the Unicode code point to write
-
putCodePoint
void putCodePoint(int x, int y, int codePoint, Style style)Writes a Unicode code point, including supplementary characters, with an explicit style.- Parameters:
x- the local columny- the local rowcodePoint- the Unicode code point to writestyle- the style to apply
-
put
void put(int x, int y, java.lang.String text)Writes a single line of text with the default style, truncated at the right edge.- Parameters:
x- the local column of the first charactery- the local rowtext- the text to write
-
put
void put(int x, int y, java.lang.String text, Style style)Writes a single line of text, truncated at the right edge.- Parameters:
x- the local column of the first charactery- the local rowtext- the text to writestyle- the style to apply
-
fill
void fill(Rect area, char c, Style style)
Fills a local rectangle with a character and style.- Parameters:
area- the local rectangle to fillc- the character to fill withstyle- the style to apply
-
clear
void clear()
Fills the entire canvas with spaces in the default style.
-
-