pub struct Image {
pub width: u32,
pub height: u32,
pub fore_image: Vec<u32>,
pub back_image: Vec<u32>,
pub text_image: Vec<u32>,
}
Expand description
Represents a rectangular collection of chars to render as sprites or screens.
Fields§
§width: u32
The width of the image in chars.
height: u32
The height of the image in chars.
fore_image: Vec<u32>
The foreground color of each char in the image.
back_image: Vec<u32>
The background color of each char in the image.
text_image: Vec<u32>
The char to render at each position in the image.
Implementations§
source§impl Image
impl Image
sourcepub fn point_to_index(&self, p: Point) -> Option<usize>
pub fn point_to_index(&self, p: Point) -> Option<usize>
sourcepub fn clear(&mut self, ink: u32, paper: u32)
pub fn clear(&mut self, ink: u32, paper: u32)
Clears the image with a given ink and paper colour.
Arguments
ink
- The foreground colour to clear the image with.paper
- The background colour to clear the image with.
sourcepub fn draw_filled_rect(&mut self, rect: Rect, ch: Char)
pub fn draw_filled_rect(&mut self, rect: Rect, ch: Char)
Draws a rectangle at the given coordinates and dimensions using the given character.
Arguments
p
- The coordinates to draw the rectangle at.width
- The width of the rectangle.height
- The height of the rectangle.ch
- The character to draw the rectangle with.
Notes
If the coordinates are out of bounds, the rectangle is clipped.
Auto Trait Implementations§
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnwindSafe for Image
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.