Trait pixel_engine_draw::traits::DottedShapeTrait
source · pub trait DottedShapeTrait: SmartDrawingTrait {
fn draw_line_dotted<P: Into<Vi2d>>(
&mut self,
p1: P,
p2: P,
col: Color,
pattern: u32
) { ... }
fn draw_rect_dotted<P: Into<Vi2d>>(
&mut self,
pos: P,
size: P,
col: Color,
pattern: u32
) { ... }
fn draw_triangle_dotted<P: Into<Vi2d>>(
&mut self,
pts1: P,
pts2: P,
pts3: P,
col: Color,
pattern: u32
) { ... }
}
Provided Methods§
sourcefn draw_line_dotted<P: Into<Vi2d>>(
&mut self,
p1: P,
p2: P,
col: Color,
pattern: u32
)
fn draw_line_dotted<P: Into<Vi2d>>(
&mut self,
p1: P,
p2: P,
col: Color,
pattern: u32
)
Draw a dotted line
Examples found in repository?
src/traits.rs (line 132)
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
fn draw_rect_dotted<P: Into<Vi2d>>(&mut self, pos: P, size: P, col: Color, pattern: u32) {
let Vi2d { x, y } = pos.into();
let Vi2d { x: w, y: h } = size.into() - Vi2d { x: 1, y: 1 };
self.draw_line_dotted((x, y), (x + w, y), col, pattern);
self.draw_line_dotted((x + w, y), (x + w, y + h), col, pattern);
self.draw_line_dotted((x + w, y + h), (x, y + h), col, pattern);
self.draw_line_dotted((x, y + h), (x, y), col, pattern);
}
/// Draw the edges of a triangle between the three points
/// This is the dotted form
fn draw_triangle_dotted<P: Into<Vi2d>>(
&mut self,
pts1: P,
pts2: P,
pts3: P,
col: Color,
pattern: u32,
) {
let pts1: Vi2d = pts1.into();
let pts2: Vi2d = pts2.into();
let pts3: Vi2d = pts3.into();
self.draw_line_dotted(pts1, pts2, col, pattern);
self.draw_line_dotted(pts1, pts3, col, pattern);
self.draw_line_dotted(pts2, pts3, col, pattern);
}