Add DecorationType type
This commit is contained in:
40
src/types/decoration_type.rs
Normal file
40
src/types/decoration_type.rs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
use crate::bindings;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[repr(u32)]
|
||||||
|
pub enum DecorationType {
|
||||||
|
Undefined = bindings::DecorationType_UndefinedDecoration,
|
||||||
|
No = bindings::DecorationType_NoDecoration,
|
||||||
|
Underline = bindings::DecorationType_UnderlineDecoration,
|
||||||
|
Overline = bindings::DecorationType_OverlineDecoration,
|
||||||
|
LineThrough = bindings::DecorationType_LineThroughDecoration,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for DecorationType {
|
||||||
|
fn default() -> Self {
|
||||||
|
return DecorationType::Undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<DecorationType> for bindings::DecorationType {
|
||||||
|
fn from(value: DecorationType) -> Self {
|
||||||
|
return value as bindings::DecorationType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<bindings::DecorationType> for DecorationType {
|
||||||
|
fn from(value: bindings::DecorationType) -> Self {
|
||||||
|
/*
|
||||||
|
* SAFETY:
|
||||||
|
*
|
||||||
|
* `DecorationType` has the same repr as `bindings::DecorationType` - u32
|
||||||
|
*
|
||||||
|
* If `value` is less than LineThrough than it is in the vaild range and can be safely
|
||||||
|
* reinterpreted as `DecorationType`
|
||||||
|
*/
|
||||||
|
if value <= bindings::DecorationType_LineThroughDecoration {
|
||||||
|
return unsafe { std::mem::transmute(value) };
|
||||||
|
}
|
||||||
|
return DecorationType::default();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ mod clip_path_units;
|
|||||||
mod colorspace_type;
|
mod colorspace_type;
|
||||||
mod composite_operator;
|
mod composite_operator;
|
||||||
mod compression_type;
|
mod compression_type;
|
||||||
|
mod decoration_type;
|
||||||
mod dispose_type;
|
mod dispose_type;
|
||||||
mod dither_method;
|
mod dither_method;
|
||||||
mod endian_type;
|
mod endian_type;
|
||||||
@ -30,6 +31,7 @@ pub use self::clip_path_units::ClipPathUnits;
|
|||||||
pub use self::colorspace_type::ColorspaceType;
|
pub use self::colorspace_type::ColorspaceType;
|
||||||
pub use self::composite_operator::CompositeOperator;
|
pub use self::composite_operator::CompositeOperator;
|
||||||
pub use self::compression_type::CompressionType;
|
pub use self::compression_type::CompressionType;
|
||||||
|
pub use self::decoration_type::DecorationType;
|
||||||
pub use self::dispose_type::DisposeType;
|
pub use self::dispose_type::DisposeType;
|
||||||
pub use self::dither_method::DitherMethod;
|
pub use self::dither_method::DitherMethod;
|
||||||
pub use self::endian_type::EndianType;
|
pub use self::endian_type::EndianType;
|
||||||
|
|||||||
@ -23,6 +23,7 @@ use crate::result::Result;
|
|||||||
use crate::{
|
use crate::{
|
||||||
AlignType,
|
AlignType,
|
||||||
ClipPathUnits,
|
ClipPathUnits,
|
||||||
|
DecorationType,
|
||||||
FillRule,
|
FillRule,
|
||||||
GravityType,
|
GravityType,
|
||||||
LineCap,
|
LineCap,
|
||||||
@ -118,7 +119,7 @@ impl DrawingWand {
|
|||||||
|
|
||||||
get_text_alignment, set_text_alignment, DrawGetTextAlignment, DrawSetTextAlignment, AlignType
|
get_text_alignment, set_text_alignment, DrawGetTextAlignment, DrawSetTextAlignment, AlignType
|
||||||
get_text_antialias, set_text_antialias, DrawGetTextAntialias, DrawSetTextAntialias, bindings::MagickBooleanType
|
get_text_antialias, set_text_antialias, DrawGetTextAntialias, DrawSetTextAntialias, bindings::MagickBooleanType
|
||||||
get_text_decoration, set_text_decoration, DrawGetTextDecoration, DrawSetTextDecoration, bindings::DecorationType
|
get_text_decoration, set_text_decoration, DrawGetTextDecoration, DrawSetTextDecoration, DecorationType
|
||||||
get_text_direction, set_text_direction, DrawGetTextDirection, DrawSetTextDirection, bindings::DirectionType
|
get_text_direction, set_text_direction, DrawGetTextDirection, DrawSetTextDirection, bindings::DirectionType
|
||||||
get_text_kerning, set_text_kerning, DrawGetTextKerning, DrawSetTextKerning, f64
|
get_text_kerning, set_text_kerning, DrawGetTextKerning, DrawSetTextKerning, f64
|
||||||
get_text_interline_spacing, set_text_interline_spacing, DrawGetTextInterlineSpacing, DrawSetTextInterlineSpacing, f64
|
get_text_interline_spacing, set_text_interline_spacing, DrawGetTextInterlineSpacing, DrawSetTextInterlineSpacing, f64
|
||||||
|
|||||||
Reference in New Issue
Block a user