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§
Required Methods§
Sourcefn get_info(&self) -> RasterInfo
fn get_info(&self) -> RasterInfo
Queries information about the backend.
Sourcefn set_draw_color(&mut self, color: RGB)
fn set_draw_color(&mut self, color: RGB)
Sets the drawing color for subsequent operations.
Sourcefn present_canvas(&mut self) -> Result<()>
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
.
Sourcefn read_pixels(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<Self::ID>
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
.
Sourcefn put_pixels(&mut self, xy: PixelsXY, data: &Self::ID) -> Result<()>
fn put_pixels(&mut self, xy: PixelsXY, data: &Self::ID) -> Result<()>
Restores the rectangular region stored in data
at the xy
coordinates.
Sourcefn move_pixels(
&mut self,
x1y1: PixelsXY,
x2y2: PixelsXY,
size: SizeInPixels,
) -> Result<()>
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.
Sourcefn write_text(&mut self, xy: PixelsXY, text: &str) -> Result<()>
fn write_text(&mut self, xy: PixelsXY, text: &str) -> Result<()>
Writes text
starting at xy
with the current drawing color.
Sourcefn draw_circle(&mut self, center: PixelsXY, radius: u16) -> Result<()>
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.
Sourcefn draw_circle_filled(&mut self, center: PixelsXY, radius: u16) -> Result<()>
fn draw_circle_filled(&mut self, center: PixelsXY, radius: u16) -> Result<()>
Draws a filled circle at center
with radius
using the current drawing color.
Sourcefn draw_line(&mut self, x1y1: PixelsXY, x2y2: PixelsXY) -> Result<()>
fn draw_line(&mut self, x1y1: PixelsXY, x2y2: PixelsXY) -> Result<()>
Draws a line from x1y1
to x2y2
using the current drawing color.
Sourcefn draw_pixel(&mut self, xy: PixelsXY) -> Result<()>
fn draw_pixel(&mut self, xy: PixelsXY) -> Result<()>
Draws a single pixel at xy
using the current drawing color.
Sourcefn draw_rect(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<()>
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.
Sourcefn draw_rect_filled(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<()>
fn draw_rect_filled(&mut self, xy: PixelsXY, size: SizeInPixels) -> Result<()>
Draws a filled rectangle from x1y1
to x2y2
using the current drawing color.