Add PixelInterpolateMethod type
This commit is contained in:
@ -3,6 +3,7 @@ mod composite_operator;
|
|||||||
mod dither_method;
|
mod dither_method;
|
||||||
mod filter_type;
|
mod filter_type;
|
||||||
mod gravity_type;
|
mod gravity_type;
|
||||||
|
mod pixel_interpolate_method;
|
||||||
mod metric_type;
|
mod metric_type;
|
||||||
mod resource_type;
|
mod resource_type;
|
||||||
|
|
||||||
@ -11,5 +12,6 @@ pub use self::composite_operator::CompositeOperator;
|
|||||||
pub use self::dither_method::DitherMethod;
|
pub use self::dither_method::DitherMethod;
|
||||||
pub use self::filter_type::FilterType;
|
pub use self::filter_type::FilterType;
|
||||||
pub use self::gravity_type::GravityType;
|
pub use self::gravity_type::GravityType;
|
||||||
|
pub use self::pixel_interpolate_method::PixelInterpolateMethod;
|
||||||
pub use self::metric_type::MetricType;
|
pub use self::metric_type::MetricType;
|
||||||
pub use self::resource_type::ResourceType;
|
pub use self::resource_type::ResourceType;
|
||||||
|
|||||||
47
src/types/pixel_interpolate_method.rs
Normal file
47
src/types/pixel_interpolate_method.rs
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
use crate::bindings;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[repr(u32)]
|
||||||
|
pub enum PixelInterpolateMethod {
|
||||||
|
Undefined = bindings::PixelInterpolateMethod_UndefinedInterpolatePixel,
|
||||||
|
Average = bindings::PixelInterpolateMethod_AverageInterpolatePixel,
|
||||||
|
Average9 = bindings::PixelInterpolateMethod_Average9InterpolatePixel,
|
||||||
|
Average16 = bindings::PixelInterpolateMethod_Average16InterpolatePixel,
|
||||||
|
Background = bindings::PixelInterpolateMethod_BackgroundInterpolatePixel,
|
||||||
|
Bilinear = bindings::PixelInterpolateMethod_BilinearInterpolatePixel,
|
||||||
|
Blend = bindings::PixelInterpolateMethod_BlendInterpolatePixel,
|
||||||
|
Catrom = bindings::PixelInterpolateMethod_CatromInterpolatePixel,
|
||||||
|
Integer = bindings::PixelInterpolateMethod_IntegerInterpolatePixel,
|
||||||
|
Mesh = bindings::PixelInterpolateMethod_MeshInterpolatePixel,
|
||||||
|
Nearest = bindings::PixelInterpolateMethod_NearestInterpolatePixel,
|
||||||
|
Spline = bindings::PixelInterpolateMethod_SplineInterpolatePixel,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for PixelInterpolateMethod {
|
||||||
|
fn default() -> Self {
|
||||||
|
return PixelInterpolateMethod::Undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<PixelInterpolateMethod> for bindings::PixelInterpolateMethod {
|
||||||
|
fn from(value: PixelInterpolateMethod) -> Self {
|
||||||
|
return value as bindings::PixelInterpolateMethod;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<bindings::PixelInterpolateMethod> for PixelInterpolateMethod {
|
||||||
|
fn from(value: bindings::PixelInterpolateMethod) -> Self {
|
||||||
|
/*
|
||||||
|
* SAFETY:
|
||||||
|
*
|
||||||
|
* `PixelInterpolateMethod` has the same repr as `bindings::PixelInterpolateMethod` - u32
|
||||||
|
*
|
||||||
|
* If `value` is less than Spline than it is in the vaild range and can be safely
|
||||||
|
* reinterpreted as `PixelInterpolateMethod`
|
||||||
|
*/
|
||||||
|
if value <= bindings::PixelInterpolateMethod_SplineInterpolatePixel {
|
||||||
|
return unsafe { std::mem::transmute(value) };
|
||||||
|
}
|
||||||
|
return PixelInterpolateMethod::default();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -35,6 +35,7 @@ use crate::{
|
|||||||
DitherMethod,
|
DitherMethod,
|
||||||
FilterType,
|
FilterType,
|
||||||
GravityType,
|
GravityType,
|
||||||
|
PixelInterpolateMethod,
|
||||||
MetricType,
|
MetricType,
|
||||||
ResourceType
|
ResourceType
|
||||||
};
|
};
|
||||||
@ -1184,7 +1185,7 @@ impl MagickWand {
|
|||||||
get_image_gamma, set_image_gamma, MagickGetImageGamma, MagickSetImageGamma, f64
|
get_image_gamma, set_image_gamma, MagickGetImageGamma, MagickSetImageGamma, f64
|
||||||
get_image_gravity, set_image_gravity, MagickGetImageGravity, MagickSetImageGravity, GravityType
|
get_image_gravity, set_image_gravity, MagickGetImageGravity, MagickSetImageGravity, GravityType
|
||||||
get_image_interlace_scheme, set_image_interlace_scheme, MagickGetImageInterlaceScheme, MagickSetImageInterlaceScheme, bindings::InterlaceType
|
get_image_interlace_scheme, set_image_interlace_scheme, MagickGetImageInterlaceScheme, MagickSetImageInterlaceScheme, bindings::InterlaceType
|
||||||
get_image_interpolate_method, set_image_interpolate_method, MagickGetImageInterpolateMethod, MagickSetImageInterpolateMethod, bindings::PixelInterpolateMethod
|
get_image_interpolate_method, set_image_interpolate_method, MagickGetImageInterpolateMethod, MagickSetImageInterpolateMethod, PixelInterpolateMethod
|
||||||
get_image_iterations, set_image_iterations, MagickGetImageIterations, MagickSetImageIterations, size_t
|
get_image_iterations, set_image_iterations, MagickGetImageIterations, MagickSetImageIterations, size_t
|
||||||
get_image_orientation, set_image_orientation, MagickGetImageOrientation, MagickSetImageOrientation, bindings::OrientationType
|
get_image_orientation, set_image_orientation, MagickGetImageOrientation, MagickSetImageOrientation, bindings::OrientationType
|
||||||
get_image_rendering_intent, set_image_rendering_intent, MagickGetImageRenderingIntent, MagickSetImageRenderingIntent, bindings::RenderingIntent
|
get_image_rendering_intent, set_image_rendering_intent, MagickGetImageRenderingIntent, MagickSetImageRenderingIntent, bindings::RenderingIntent
|
||||||
|
|||||||
Reference in New Issue
Block a user