[−][src]Struct gouache::Path
A path consisting of monotone quadratic Bézier segments.
Methods
impl Path
[src]
pub fn new() -> Path
[src]
Constructs a new empty path.
pub fn offset(&self) -> Vec2
[src]
Gets the offset from the origin of the smallest axis-aligned bounding box containing this path.
pub fn size(&self) -> Vec2
[src]
Gets a vector representing the width and height of the smallest axis-aligned bounding box containing this path.
pub fn move_to(&mut self, point: Vec2) -> &mut Self
[src]
Ends the current component of the path (if any) and begins a new one at the given location.
Every path should begin with a call to move_to
.
pub fn line_to(&mut self, point: Vec2) -> &mut Self
[src]
Appends a straight line to the path with the given endpoint.
pub fn quadratic_to(&mut self, control: Vec2, point: Vec2) -> &mut Self
[src]
Appends a quadratic Bézier segment to the path with the given control point and endpoint.
Subdivides the added segment into up to three monotone segments.
pub fn cubic_to(
&mut self,
control1: Vec2,
control2: Vec2,
point: Vec2
) -> &mut Self
[src]
&mut self,
control1: Vec2,
control2: Vec2,
point: Vec2
) -> &mut Self
Appends a cubic Bézier segment to the path with the given control points and endpoint.
Approximates the cubic with quadratic segments (details here).
pub fn arc_to(
&mut self,
radius: f32,
large_arc: bool,
winding: bool,
point: Vec2
) -> &mut Self
[src]
&mut self,
radius: f32,
large_arc: bool,
winding: bool,
point: Vec2
) -> &mut Self
Appends a circular segment to the path with the given radius and endpoint.
Approximates the circular segment with up to eight quadratic segments.
Parameters follow the SVG spec. large_arc
and winding
specify which
of four possible arcs with the given endpoints and radius will be
added. large_arc
specifies whether to choose an arc of greater than
180 degrees. winding
specifies whether to choose an arc which winds
in the counterclockwise direction.
pub fn close(&mut self)
[src]
Marks the current path component as closed. If the current point is not equal to the initial point, a linear segment to the initial point is added.
pub fn stroke(&self, width: f32) -> Path
[src]
Converts this path to a stroked path with the given width.
The offset curves bounding the stroke are approximated by dilating the Bézier control polygons.
The line-cap style is "butt" and the line-join style is "miter clip."
pub fn get_data(&self) -> PathData
[src]
Serializes a path for uploading to the GPU.
The serialization process consists of the following:
- Shared segment endpoints are duplicated so that segments can be reordered freely.
- Perfectly horizontal segments are removed (as they have no effect when rendered).
- Segments are sorted by y-centroid.
- An index structure is built which divides the path's bounding box into n equally spaced rows, storing the earliest and latest segment indices incident on that row. As a heuristic, n is chosen to be the total number of path segments.
- The index structure and segment control points are packed into 3-channel 16-bit texels.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnwindSafe for Path
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,