Add LineJoin type
This commit is contained in:
39
src/types/line_join.rs
Normal file
39
src/types/line_join.rs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
use crate::bindings;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[repr(u32)]
|
||||||
|
pub enum LineJoin {
|
||||||
|
Undefined = bindings::LineJoin_UndefinedJoin,
|
||||||
|
Miter = bindings::LineJoin_MiterJoin,
|
||||||
|
Round = bindings::LineJoin_RoundJoin,
|
||||||
|
Bevel = bindings::LineJoin_BevelJoin,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for LineJoin {
|
||||||
|
fn default() -> Self {
|
||||||
|
return LineJoin::Undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<LineJoin> for bindings::LineJoin {
|
||||||
|
fn from(value: LineJoin) -> Self {
|
||||||
|
return value as bindings::LineJoin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<bindings::LineJoin> for LineJoin {
|
||||||
|
fn from(value: bindings::LineJoin) -> Self {
|
||||||
|
/*
|
||||||
|
* SAFETY:
|
||||||
|
*
|
||||||
|
* `LineJoin` has the same repr as `bindings::LineJoin` - u32
|
||||||
|
*
|
||||||
|
* If `value` is less than Bevel than it is in the vaild range and can be safely
|
||||||
|
* reinterpreted as `LineJoin`
|
||||||
|
*/
|
||||||
|
if value <= bindings::LineJoin_BevelJoin {
|
||||||
|
return unsafe { std::mem::transmute(value) };
|
||||||
|
}
|
||||||
|
return LineJoin::default();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,6 +11,7 @@ mod filter_type;
|
|||||||
mod gravity_type;
|
mod gravity_type;
|
||||||
mod image_type;
|
mod image_type;
|
||||||
mod interlace_type;
|
mod interlace_type;
|
||||||
|
mod line_join;
|
||||||
mod metric_type;
|
mod metric_type;
|
||||||
mod orientation_type;
|
mod orientation_type;
|
||||||
mod pixel_interpolate_method;
|
mod pixel_interpolate_method;
|
||||||
@ -34,6 +35,7 @@ pub use self::filter_type::FilterType;
|
|||||||
pub use self::gravity_type::GravityType;
|
pub use self::gravity_type::GravityType;
|
||||||
pub use self::image_type::ImageType;
|
pub use self::image_type::ImageType;
|
||||||
pub use self::interlace_type::InterlaceType;
|
pub use self::interlace_type::InterlaceType;
|
||||||
|
pub use self::line_join::LineJoin;
|
||||||
pub use self::metric_type::MetricType;
|
pub use self::metric_type::MetricType;
|
||||||
pub use self::orientation_type::OrientationType;
|
pub use self::orientation_type::OrientationType;
|
||||||
pub use self::pixel_interpolate_method::PixelInterpolateMethod;
|
pub use self::pixel_interpolate_method::PixelInterpolateMethod;
|
||||||
|
|||||||
@ -24,6 +24,7 @@ use crate::{
|
|||||||
ClipPathUnits,
|
ClipPathUnits,
|
||||||
FillRule,
|
FillRule,
|
||||||
GravityType,
|
GravityType,
|
||||||
|
LineJoin,
|
||||||
StretchType,
|
StretchType,
|
||||||
StyleType,
|
StyleType,
|
||||||
};
|
};
|
||||||
@ -107,7 +108,7 @@ impl DrawingWand {
|
|||||||
|
|
||||||
get_stroke_dash_offset, set_stroke_dash_offset, DrawGetStrokeDashOffset, DrawSetStrokeDashOffset, f64
|
get_stroke_dash_offset, set_stroke_dash_offset, DrawGetStrokeDashOffset, DrawSetStrokeDashOffset, f64
|
||||||
get_stroke_line_cap, set_stroke_line_cap, DrawGetStrokeLineCap, DrawSetStrokeLineCap, bindings::LineCap
|
get_stroke_line_cap, set_stroke_line_cap, DrawGetStrokeLineCap, DrawSetStrokeLineCap, bindings::LineCap
|
||||||
get_stroke_line_join, set_stroke_line_join, DrawGetStrokeLineJoin, DrawSetStrokeLineJoin, bindings::LineJoin
|
get_stroke_line_join, set_stroke_line_join, DrawGetStrokeLineJoin, DrawSetStrokeLineJoin, LineJoin
|
||||||
get_stroke_miter_limit, set_stroke_miter_limit, DrawGetStrokeMiterLimit, DrawSetStrokeMiterLimit, usize
|
get_stroke_miter_limit, set_stroke_miter_limit, DrawGetStrokeMiterLimit, DrawSetStrokeMiterLimit, usize
|
||||||
get_stroke_opacity, set_stroke_opacity, DrawGetStrokeOpacity, DrawSetStrokeOpacity, f64
|
get_stroke_opacity, set_stroke_opacity, DrawGetStrokeOpacity, DrawSetStrokeOpacity, f64
|
||||||
get_stroke_width, set_stroke_width, DrawGetStrokeWidth, DrawSetStrokeWidth, f64
|
get_stroke_width, set_stroke_width, DrawGetStrokeWidth, DrawSetStrokeWidth, f64
|
||||||
|
|||||||
Reference in New Issue
Block a user