Add StretchType type
This commit is contained in:
@ -18,6 +18,7 @@ mod rendering_intent;
|
|||||||
mod resolution_type;
|
mod resolution_type;
|
||||||
mod resource_type;
|
mod resource_type;
|
||||||
mod statistic_type;
|
mod statistic_type;
|
||||||
|
mod stretch_type;
|
||||||
mod style_type;
|
mod style_type;
|
||||||
|
|
||||||
pub use self::alpha_channel_option::AlphaChannelOption;
|
pub use self::alpha_channel_option::AlphaChannelOption;
|
||||||
@ -40,4 +41,5 @@ pub use self::rendering_intent::RenderingIntent;
|
|||||||
pub use self::resolution_type::ResolutionType;
|
pub use self::resolution_type::ResolutionType;
|
||||||
pub use self::resource_type::ResourceType;
|
pub use self::resource_type::ResourceType;
|
||||||
pub use self::statistic_type::StatisticType;
|
pub use self::statistic_type::StatisticType;
|
||||||
|
pub use self::stretch_type::StretchType;
|
||||||
pub use self::style_type::StyleType;
|
pub use self::style_type::StyleType;
|
||||||
|
|||||||
46
src/types/stretch_type.rs
Normal file
46
src/types/stretch_type.rs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
use crate::bindings;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[repr(u32)]
|
||||||
|
pub enum StretchType {
|
||||||
|
Undefined = bindings::StretchType_UndefinedStretch,
|
||||||
|
Normal = bindings::StretchType_NormalStretch,
|
||||||
|
UltraCondensed = bindings::StretchType_UltraCondensedStretch,
|
||||||
|
ExtraCondensed = bindings::StretchType_ExtraCondensedStretch,
|
||||||
|
Condensed = bindings::StretchType_CondensedStretch,
|
||||||
|
SemiCondensed = bindings::StretchType_SemiCondensedStretch,
|
||||||
|
SemiExpanded = bindings::StretchType_SemiExpandedStretch,
|
||||||
|
Expanded = bindings::StretchType_ExpandedStretch,
|
||||||
|
ExtraExpanded = bindings::StretchType_ExtraExpandedStretch,
|
||||||
|
UltraExpanded = bindings::StretchType_UltraExpandedStretch,
|
||||||
|
Any = bindings::StretchType_AnyStretch,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for StretchType {
|
||||||
|
fn default() -> Self {
|
||||||
|
return StretchType::Undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<StretchType> for bindings::StretchType {
|
||||||
|
fn from(value: StretchType) -> Self {
|
||||||
|
return value as bindings::StretchType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<bindings::StretchType> for StretchType {
|
||||||
|
fn from(value: bindings::StretchType) -> Self {
|
||||||
|
/*
|
||||||
|
* SAFETY:
|
||||||
|
*
|
||||||
|
* `StretchType` has the same repr as `bindings::StretchType` - u32
|
||||||
|
*
|
||||||
|
* If `value` is less than Any than it is in the vaild range and can be safely
|
||||||
|
* reinterpreted as `StretchType`
|
||||||
|
*/
|
||||||
|
if value <= bindings::StretchType_AnyStretch {
|
||||||
|
return unsafe { std::mem::transmute(value) };
|
||||||
|
}
|
||||||
|
return StretchType::default();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -24,6 +24,7 @@ use crate::{
|
|||||||
ClipPathUnits,
|
ClipPathUnits,
|
||||||
FillRule,
|
FillRule,
|
||||||
GravityType,
|
GravityType,
|
||||||
|
StretchType,
|
||||||
StyleType,
|
StyleType,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ impl DrawingWand {
|
|||||||
get_font_size, set_font_size, DrawGetFontSize, DrawSetFontSize, f64
|
get_font_size, set_font_size, DrawGetFontSize, DrawSetFontSize, f64
|
||||||
get_font_style, set_font_style, DrawGetFontStyle, DrawSetFontStyle, StyleType
|
get_font_style, set_font_style, DrawGetFontStyle, DrawSetFontStyle, StyleType
|
||||||
get_font_weight, set_font_weight, DrawGetFontWeight, DrawSetFontWeight, usize
|
get_font_weight, set_font_weight, DrawGetFontWeight, DrawSetFontWeight, usize
|
||||||
get_font_stretch, set_font_stretch, DrawGetFontStretch, DrawSetFontStretch, bindings::StretchType
|
get_font_stretch, set_font_stretch, DrawGetFontStretch, DrawSetFontStretch, StretchType
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user