Trait RasterOps

Source
pub trait RasterOps {
    type ID;

Show 15 methods // Required methods fn get_info(&self) -> RasterInfo; fn set_draw_color(&mut self, color: RGB); fn clear(&mut self) -> Result<()>; fn present_canvas(&mut self) -> Result<()>; fn read_pixels( &mut self, xy: PixelsXY, size: SizeInPixels, ) -> Result<Self::ID>; fn put_pixels(&mut self, xy: PixelsXY, data: &Self::ID) -> Result<()>; fn move_pixels( &mut self, x1y1: PixelsXY, x2y2: PixelsXY, size: SizeInPixels, ) -> Result<()>; fn write_text(&mut self, xy: PixelsXY, text: &str) -> Result<()>; fn draw_circle(&mut self, center: PixelsXY, radius: u16) -> Result<()>; fn draw_circle_filled( &mut self, center: PixelsXY, radius: u16, ) -> Result<()>; fn draw_line(&mut self, x1y1: PixelsXY, x2y2: PixelsXY) -> Result<()>; fn draw_pixel(&mut self, xy: PixelsXY) -> Result<()>; fn draw_rect(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<()>; fn draw_rect_filled( &mut self, xy: PixelsXY, size: SizeInPixels, ) -> Result<()>; // Provided method fn set_sync(&mut self, _enabled: bool) { ... }
}
Expand description

Primitive graphical console raster operations.

Required Associated Types§

Source

type ID

Type of the image data (raw pixels).

Required Methods§

Source

fn get_info(&self) -> RasterInfo

Queries information about the backend.

Source

fn set_draw_color(&mut self, color: RGB)

Sets the drawing color for subsequent operations.

Source

fn clear(&mut self) -> Result<()>

Clears the whole console with the given color.

Source

fn present_canvas(&mut self) -> Result<()>

Displays any buffered changes to the console.

Should ignore any sync values that the backend might have cached via set_sync.

Source

fn read_pixels(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<Self::ID>

Reads the raw pixel data for the rectangular region specified by xy and size.

Source

fn put_pixels(&mut self, xy: PixelsXY, data: &Self::ID) -> Result<()>

Restores the rectangular region stored in data at the xy coordinates.

Source

fn move_pixels( &mut self, x1y1: PixelsXY, x2y2: PixelsXY, size: SizeInPixels, ) -> Result<()>

Moves the rectangular region specified by x1y1 and size to x2y2. The original region is erased with the current drawing color.

Source

fn write_text(&mut self, xy: PixelsXY, text: &str) -> Result<()>

Writes text starting at xy with the current drawing color.

Source

fn draw_circle(&mut self, center: PixelsXY, radius: u16) -> Result<()>

Draws the outline of a circle at center with radius using the current drawing color.

Source

fn draw_circle_filled(&mut self, center: PixelsXY, radius: u16) -> Result<()>

Draws a filled circle at center with radius using the current drawing color.

Source

fn draw_line(&mut self, x1y1: PixelsXY, x2y2: PixelsXY) -> Result<()>

Draws a line from x1y1 to x2y2 using the current drawing color.

Source

fn draw_pixel(&mut self, xy: PixelsXY) -> Result<()>

Draws a single pixel at xy using the current drawing color.

Source

fn draw_rect(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<()>

Draws the outline of a rectangle from x1y1 to x2y2 using the current drawing color.

Source

fn draw_rect_filled(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<()>

Draws a filled rectangle from x1y1 to x2y2 using the current drawing color.

Provided Methods§

Source

fn set_sync(&mut self, _enabled: bool)

Sets whether automatic presentation of the canvas is enabled or not.

Raster backends might need this when the device they talk to is very slow and they want to buffer data in main memory first.

Does NOT present the canvas.

Implementors§