pub trait ViewElement {
    // Required method
    fn active_pixels(&self) -> Vec<Pixel>;

    // Provided method
    fn active_points(&self) -> Vec<Vec2D> { ... }
}
Expand description

ViewElement is a trait that must be implemented by any element that can be blitted to a View

Required Methods§

source

fn active_pixels(&self) -> Vec<Pixel>

Return a vector of the element’s Pixels - A ColChar. If your whole object is a solid colour, consider using utils::points_to_pixels() which will add the same ColChar to every point and can then be used as this function’s output

Provided Methods§

source

fn active_points(&self) -> Vec<Vec2D>

Return the positions the ViewElement occupies, essentially active_pixels() without the ColChars. This has a default setting that extracts the Vec2Ds from active_pixels but you can set it to something else to make it faster

Implementors§