#[repr(C)]pub struct Style {
pub flags_and_miter_limit: u32,
pub line_width: f32,
}Expand description
Data structure encoding stroke or fill style.
Fields§
§flags_and_miter_limit: u32Encodes the stroke and fill style parameters. This field is split into two 16-bit parts:
-
flags: u16- encodes fill vs stroke, even-odd vs non-zero fill mode for fills and cap and join style for strokes. See theFLAGS_*constants below for more information.flags: |style|fill|join|start cap|end cap|reserved| bits: 0 1 2-3 4-5 6-7 8-15 -
miter_limit: u16- The miter limit for a stroke, encoded in binary16 (half) floating point representation. This field is only meaningful for theJoin::Miterjoin style. It’s ignored for other stroke styles and fills.
line_width: f32Encodes the stroke width. This field is ignored for fills.
Implementations§
Source§impl Style
impl Style
Sourcepub const FLAGS_STYLE_BIT: u32 = 0x8000_0000
pub const FLAGS_STYLE_BIT: u32 = 0x8000_0000
0 for a fill, 1 for a stroke
Sourcepub const FLAGS_FILL_BIT: u32 = 0x4000_0000
pub const FLAGS_FILL_BIT: u32 = 0x4000_0000
0 for non-zero, 1 for even-odd
Sourcepub const FLAGS_JOIN_BITS_BEVEL: u32 = 0
pub const FLAGS_JOIN_BITS_BEVEL: u32 = 0
Encodings for join style:
- 0b00 -> bevel
- 0b01 -> miter
- 0b10 -> round
pub const FLAGS_JOIN_BITS_MITER: u32 = 0x1000_0000
pub const FLAGS_JOIN_BITS_ROUND: u32 = 0x2000_0000
pub const FLAGS_JOIN_MASK: u32 = 0x3000_0000
Sourcepub const FLAGS_CAP_BITS_BUTT: u32 = 0
pub const FLAGS_CAP_BITS_BUTT: u32 = 0
Encodings for cap style:
- 0b00 -> butt
- 0b01 -> square
- 0b10 -> round
pub const FLAGS_CAP_BITS_SQUARE: u32 = 0x0100_0000
pub const FLAGS_CAP_BITS_ROUND: u32 = 0x0200_0000
pub const FLAGS_START_CAP_BITS_BUTT: u32
pub const FLAGS_START_CAP_BITS_SQUARE: u32
pub const FLAGS_START_CAP_BITS_ROUND: u32
pub const FLAGS_END_CAP_BITS_BUTT: u32 = Self::FLAGS_CAP_BITS_BUTT
pub const FLAGS_END_CAP_BITS_SQUARE: u32 = Self::FLAGS_CAP_BITS_SQUARE
pub const FLAGS_END_CAP_BITS_ROUND: u32 = Self::FLAGS_CAP_BITS_ROUND
pub const FLAGS_START_CAP_MASK: u32 = 0x0C00_0000
pub const FLAGS_END_CAP_MASK: u32 = 0x0300_0000
pub const MITER_LIMIT_MASK: u32 = 0xFFFF
pub fn from_fill(fill: Fill) -> Self
Sourcepub fn from_stroke(stroke: &Stroke) -> Option<Self>
pub fn from_stroke(stroke: &Stroke) -> Option<Self>
Creates a style from a stroke.
As it isn’t meaningful to encode a zero width stroke, returns None if the width is zero.
Trait Implementations§
impl Copy for Style
impl Pod for Style
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Forget for Style
impl Freeze for Style
impl Move for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnsafeUnpin for Style
impl UnwindSafe for Style
Blanket Implementations§
impl<T> AnyBitPattern for Twhere
T: Pod,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.