Trait pixelar::prelude::MoreMethodsForPixelsTable
source · pub trait MoreMethodsForPixelsTable<const H: usize, const W: usize>: PixelsTable<H, W> {
fn change_pixel_color<P: ToPosition<H, W>, C1: ColorSelector>(
&mut self,
pos: P,
color: C1
) { ... }
fn surrounding_pixels(
&self,
pos: &Position
) -> SurroundingPixels<'_, H, W, Self> ⓘ
where
Self: Sized,
{ ... }
fn boundary_fill<P: ToPosition<H, W>, C1: ColorSelector + Clone>(
&mut self,
pos: P,
fill_color: PixelDescriptor,
boundary_color: C1,
dimensional_penetration: bool
) { ... }
fn boundary_fill_color<P: ToPosition<H, W>, C1: ColorSelector, C2: ColorSelector + Clone>(
&mut self,
pos: P,
fill_color: C1,
boundary_color: C2,
dimensional_penetration: bool
) { ... }
fn draw_straight_line<C: ColorSelector, P1: ToPosition<H, W>, P2: ToPosition<H, W>>(
&mut self,
color: C,
start: P1,
end: P2
) { ... }
fn draw_many_straight_lines<C: ColorSelector, P1: ToPosition<H, W>, P2: ToPosition<H, W>>(
&mut self,
color: C,
start: P1,
end: P2,
builder: impl FnOnce(&mut StraightLine<H, W>)
) { ... }
fn draw_free_drawing<C: ColorSelector>(
&mut self,
color: C,
builder: impl FnOnce(&mut FreeDrawing<H, W>)
) { ... }
fn rect_selection<P1: ToPosition<H, W>, P2: ToPosition<H, W>>(
&mut self,
top_left: P1,
bottom_right: P2
) -> RectSelection<'_, H, W, Self>
where
Self: Sized,
{ ... }
fn section_copy<const H1: usize, const W1: usize>(
&mut self,
start: impl ToPosition<H, W>
) -> Canvas<H1, W1>
where
Self: Sized,
{ ... }
fn modify_section<const H1: usize, const W1: usize>(
&mut self,
start: impl ToPosition<H, W> + Clone,
modifier: impl FnOnce(&mut Canvas<H1, W1>)
)
where
Self: Sized,
{ ... }
}
Provided Methods§
fn change_pixel_color<P: ToPosition<H, W>, C1: ColorSelector>(
&mut self,
pos: P,
color: C1
)
fn surrounding_pixels(&self, pos: &Position) -> SurroundingPixels<'_, H, W, Self> ⓘwhere
Self: Sized,
fn boundary_fill<P: ToPosition<H, W>, C1: ColorSelector + Clone>(
&mut self,
pos: P,
fill_color: PixelDescriptor,
boundary_color: C1,
dimensional_penetration: bool
)
fn boundary_fill_color<P: ToPosition<H, W>, C1: ColorSelector, C2: ColorSelector + Clone>(
&mut self,
pos: P,
fill_color: C1,
boundary_color: C2,
dimensional_penetration: bool
)
fn draw_straight_line<C: ColorSelector, P1: ToPosition<H, W>, P2: ToPosition<H, W>>(
&mut self,
color: C,
start: P1,
end: P2
)
fn draw_many_straight_lines<C: ColorSelector, P1: ToPosition<H, W>, P2: ToPosition<H, W>>(
&mut self,
color: C,
start: P1,
end: P2,
builder: impl FnOnce(&mut StraightLine<H, W>)
)
fn draw_free_drawing<C: ColorSelector>(
&mut self,
color: C,
builder: impl FnOnce(&mut FreeDrawing<H, W>)
)
sourcefn rect_selection<P1: ToPosition<H, W>, P2: ToPosition<H, W>>(
&mut self,
top_left: P1,
bottom_right: P2
) -> RectSelection<'_, H, W, Self>where
Self: Sized,
fn rect_selection<P1: ToPosition<H, W>, P2: ToPosition<H, W>>(
&mut self,
top_left: P1,
bottom_right: P2
) -> RectSelection<'_, H, W, Self>where
Self: Sized,
Get an rectangle like selection with specified top left and bottom right edges.
Example
let mut selection = pixel_paper.rect_selection(LeftTopEdge, (3, 3));
selection.apply_color(Black);
sourcefn section_copy<const H1: usize, const W1: usize>(
&mut self,
start: impl ToPosition<H, W>
) -> Canvas<H1, W1>where
Self: Sized,
fn section_copy<const H1: usize, const W1: usize>(
&mut self,
start: impl ToPosition<H, W>
) -> Canvas<H1, W1>where
Self: Sized,
Get a copy of a fixed size ( H1
*W1
) section of a PixelsTable
.
Example
let copy = pixel_paper.section_copy::<3, 3>(LeftTopEdge);
sourcefn modify_section<const H1: usize, const W1: usize>(
&mut self,
start: impl ToPosition<H, W> + Clone,
modifier: impl FnOnce(&mut Canvas<H1, W1>)
)where
Self: Sized,
fn modify_section<const H1: usize, const W1: usize>(
&mut self,
start: impl ToPosition<H, W> + Clone,
modifier: impl FnOnce(&mut Canvas<H1, W1>)
)where
Self: Sized,
Cut, Modify, Replace
Modify a fixed size ( H1
*W1
) section of this PixelsTable
separately and in place.
Example
Modify a 3*3 cut starting from LeftTopEdge as a separate Canvas
.
pixel_paper.modify_section::<3, 3>(LeftTopEdge, |canvas| {
canvas.change_pixel_color(RightBottomEdge, Red);
});