Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/graphics/fake"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
graphics |
std/graphics |
fake.dodo |
option |
core/option |
fake.dodo |
Display
Struct · Source
An in-memory display implementing graphics.Display. It keeps its own copy of the screen, updated only inside each presented dirty rectangle, so a test can check both what an application drew and that its partial updates were large enough. Drawing code generic over graphics.Display runs under
dodo testwith no window or panel attached.
pub struct Display {
// Private implementation fields omitted.
}
Display.new
Function · Source
A display of the given size whose screen lives in
storage, which needs graphics.bytes_needed(width, height, format) bytes. The screen starts with whateverstorageholds.
pub fn new(storage: &mut[u8], width: u32, height: u32, format: graphics.PixelFormat) -> Display!graphics.Error from(storage)
Display.size
Function · Source
pub fn size(&self) -> graphics.Size
Display.format
Function · Source
pub fn format(&self) -> graphics.PixelFormat
Display.present
Function · Source
Copy
dirtyfromcanvasto the screen, converting its format. Only the part inside both the canvas’s bounds and the screen is copied, so a band canvas updates its band.
pub fn present(&mut self, canvas: &graphics.Canvas, dirty: graphics.Rect) -> void!graphics.Error
Display.screen
Function · Source
What the display currently shows.
pub fn screen(&self) -> &graphics.Canvas
Display.presents
Function · Source
Number of successful presents so far.
pub fn presents(&self) -> u32
Display.last_dirty
Function · Source
The area the last successful present copied, limited to the canvas and the screen.
pub fn last_dirty(&self) -> graphics.Rect
Display.covered
Function · Source
The smallest rectangle covering every area presented so far.
pub fn covered(&self) -> graphics.Rect
Display.fail_next
Function · Source
Make the next present fail with
error, for testing retry paths.
pub fn fail_next(&mut self, error: graphics.Error)