1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
// Copyright (c) 2023 Xu Shaohua <shaohua@biofan.org>. All rights reserved.
// Use of this source is governed by Lesser General Public License that can be found
// in the LICENSE file.
/// `PaintStyle` set Style to fill, stroke, or both fill and stroke geometry.
///
/// The stroke and fill share all paint attributes; for instance,
/// they are drawn with the same color.
///
/// Use `StrokeAndFill` to avoid hitting the same pixels twice with a stroke draw
/// and a fill draw.
#[repr(u8)]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum PaintStyle {
/// Set to fill geometry
Fill,
/// Set to stroke geometry
Stroke,
/// Sets to stroke and fill geometry
StrokeAndFill,
}
impl Default for PaintStyle {
fn default() -> Self {
Self::Fill
}
}
/// `StrokeJoin` specifies how corners are drawn when a shape is stroked.
/// Join affects the four corners of a stroked rectangle, and the connected segments in a
/// stroked path.
///
/// Choose miter join to draw sharp corners.
/// Choose round join to draw a circle with a radius equal to the stroke width
/// on top of the corner.
/// Choose bevel join to minimally connect the thick strokes.
///
/// The fill path constructed to describe the stroked path respects the join setting
/// but may not contain the actual join.
/// For instance, a fill path constructed with round joins does not necessarily
/// include circles at each connected segment.
#[repr(u8)]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum StrokeJoin {
/// Extends to miter limit
Miter,
/// Adds circle
Round,
/// connects outside edges
Bevel,
}
impl Default for StrokeJoin {
fn default() -> Self {
Self::Miter
}
}
/// `StrokeCap` draws at the beginning and end of an open path contour.
#[repr(u8)]
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum StrokeCap {
/// No stroke extension
Butt,
/// Adds circle
Round,
/// Adds square
Square,
}
impl Default for StrokeCap {
fn default() -> Self {
Self::Butt
}
}