Skip to main content

native/skia_native/src/generated_enums.rs

// Generated by mix skia.codegen. Do not edit by hand.

#![allow(dead_code)]
use rustler::{Atom, NifResult};
use skia_safe::{
    paint, BlendMode, BlurStyle, ClipOp, EncodedImageFormat, FilterMode, MipmapMode,
    PathFillType, PathOp, TileMode,
};
use super::atoms;
pub const BLEND_MODES: &[&str] = &[
    "clear",
    "src",
    "dst",
    "src_over",
    "dst_over",
    "src_in",
    "dst_in",
    "src_out",
    "dst_out",
    "src_a_top",
    "dst_a_top",
    "xor",
    "plus",
    "modulate",
    "screen",
    "overlay",
    "darken",
    "lighten",
    "color_dodge",
    "color_burn",
    "hard_light",
    "soft_light",
    "difference",
    "exclusion",
    "multiply",
    "hue",
    "saturation",
    "color",
    "luminosity",
];
pub const BLUR_STYLES: &[&str] = &["normal", "solid", "outer", "inner"];
pub const CLIP_OPS: &[&str] = &["difference", "intersect"];
pub const ENCODED_IMAGE_FORMATS: &[&str] = &[
    "bmp",
    "gif",
    "ico",
    "jpeg",
    "png",
    "wbmp",
    "webp",
    "pkm",
    "ktx",
    "astc",
    "dng",
    "heif",
    "avif",
    "jpegxl",
];
pub const FILL_RULES: &[&str] = &[
    "winding",
    "even_odd",
    "inverse_winding",
    "inverse_even_odd",
];
pub const MIPMAP_MODES: &[&str] = &["none", "nearest", "linear"];
pub const PATH_OPS: &[&str] = &[
    "difference",
    "intersect",
    "union",
    "xor",
    "reverse_difference",
];
pub const SAMPLINGS: &[&str] = &["nearest", "linear"];
pub const STROKE_CAPS: &[&str] = &["butt", "round", "square"];
pub const STROKE_JOINS: &[&str] = &["miter", "round", "bevel"];
pub const TILE_MODES: &[&str] = &["clamp", "repeat", "mirror", "decal"];
pub fn decode_blend_mode(value: Atom) -> NifResult<BlendMode> {
    match value {
        value if value == atoms::clear() => Ok(BlendMode::Clear),
        value if value == atoms::src() => Ok(BlendMode::Src),
        value if value == atoms::dst() => Ok(BlendMode::Dst),
        value if value == atoms::src_over() => Ok(BlendMode::SrcOver),
        value if value == atoms::dst_over() => Ok(BlendMode::DstOver),
        value if value == atoms::src_in() => Ok(BlendMode::SrcIn),
        value if value == atoms::dst_in() => Ok(BlendMode::DstIn),
        value if value == atoms::src_out() => Ok(BlendMode::SrcOut),
        value if value == atoms::dst_out() => Ok(BlendMode::DstOut),
        value if value == atoms::src_a_top() => Ok(BlendMode::SrcATop),
        value if value == atoms::dst_a_top() => Ok(BlendMode::DstATop),
        value if value == atoms::xor() => Ok(BlendMode::Xor),
        value if value == atoms::plus() => Ok(BlendMode::Plus),
        value if value == atoms::modulate() => Ok(BlendMode::Modulate),
        value if value == atoms::screen() => Ok(BlendMode::Screen),
        value if value == atoms::overlay() => Ok(BlendMode::Overlay),
        value if value == atoms::darken() => Ok(BlendMode::Darken),
        value if value == atoms::lighten() => Ok(BlendMode::Lighten),
        value if value == atoms::color_dodge() => Ok(BlendMode::ColorDodge),
        value if value == atoms::color_burn() => Ok(BlendMode::ColorBurn),
        value if value == atoms::hard_light() => Ok(BlendMode::HardLight),
        value if value == atoms::soft_light() => Ok(BlendMode::SoftLight),
        value if value == atoms::difference() => Ok(BlendMode::Difference),
        value if value == atoms::exclusion() => Ok(BlendMode::Exclusion),
        value if value == atoms::multiply() => Ok(BlendMode::Multiply),
        value if value == atoms::hue() => Ok(BlendMode::Hue),
        value if value == atoms::saturation() => Ok(BlendMode::Saturation),
        value if value == atoms::color() => Ok(BlendMode::Color),
        value if value == atoms::luminosity() => Ok(BlendMode::Luminosity),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_blur_style(value: Atom) -> NifResult<BlurStyle> {
    match value {
        value if value == atoms::normal() => Ok(BlurStyle::Normal),
        value if value == atoms::solid() => Ok(BlurStyle::Solid),
        value if value == atoms::outer() => Ok(BlurStyle::Outer),
        value if value == atoms::inner() => Ok(BlurStyle::Inner),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_clip_op(value: Atom) -> NifResult<ClipOp> {
    match value {
        value if value == atoms::difference() => Ok(ClipOp::Difference),
        value if value == atoms::intersect() => Ok(ClipOp::Intersect),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_encoded_image_format(value: Atom) -> NifResult<EncodedImageFormat> {
    match value {
        value if value == atoms::bmp() => Ok(EncodedImageFormat::BMP),
        value if value == atoms::gif() => Ok(EncodedImageFormat::GIF),
        value if value == atoms::ico() => Ok(EncodedImageFormat::ICO),
        value if value == atoms::jpeg() => Ok(EncodedImageFormat::JPEG),
        value if value == atoms::png() => Ok(EncodedImageFormat::PNG),
        value if value == atoms::wbmp() => Ok(EncodedImageFormat::WBMP),
        value if value == atoms::webp() => Ok(EncodedImageFormat::WEBP),
        value if value == atoms::pkm() => Ok(EncodedImageFormat::PKM),
        value if value == atoms::ktx() => Ok(EncodedImageFormat::KTX),
        value if value == atoms::astc() => Ok(EncodedImageFormat::ASTC),
        value if value == atoms::dng() => Ok(EncodedImageFormat::DNG),
        value if value == atoms::heif() => Ok(EncodedImageFormat::HEIF),
        value if value == atoms::avif() => Ok(EncodedImageFormat::AVIF),
        value if value == atoms::jpegxl() => Ok(EncodedImageFormat::JPEGXL),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_fill_rule(value: Atom) -> NifResult<PathFillType> {
    match value {
        value if value == atoms::winding() => Ok(PathFillType::Winding),
        value if value == atoms::even_odd() => Ok(PathFillType::EvenOdd),
        value if value == atoms::inverse_winding() => Ok(PathFillType::InverseWinding),
        value if value == atoms::inverse_even_odd() => Ok(PathFillType::InverseEvenOdd),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_mipmap_mode(value: Atom) -> NifResult<MipmapMode> {
    match value {
        value if value == atoms::none() => Ok(MipmapMode::None),
        value if value == atoms::nearest() => Ok(MipmapMode::Nearest),
        value if value == atoms::linear() => Ok(MipmapMode::Linear),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_path_op(value: Atom) -> NifResult<PathOp> {
    match value {
        value if value == atoms::difference() => Ok(PathOp::Difference),
        value if value == atoms::intersect() => Ok(PathOp::Intersect),
        value if value == atoms::union() => Ok(PathOp::Union),
        value if value == atoms::xor() => Ok(PathOp::XOR),
        value if value == atoms::reverse_difference() => Ok(PathOp::ReverseDifference),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_sampling(value: Atom) -> NifResult<FilterMode> {
    match value {
        value if value == atoms::nearest() => Ok(FilterMode::Nearest),
        value if value == atoms::linear() => Ok(FilterMode::Linear),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_stroke_cap(value: Atom) -> NifResult<paint::Cap> {
    match value {
        value if value == atoms::butt() => Ok(paint::Cap::Butt),
        value if value == atoms::round() => Ok(paint::Cap::Round),
        value if value == atoms::square() => Ok(paint::Cap::Square),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_stroke_join(value: Atom) -> NifResult<paint::Join> {
    match value {
        value if value == atoms::miter() => Ok(paint::Join::Miter),
        value if value == atoms::round() => Ok(paint::Join::Round),
        value if value == atoms::bevel() => Ok(paint::Join::Bevel),
        _ => Err(rustler::Error::BadArg),
    }
}
pub fn decode_tile_mode(value: Atom) -> NifResult<TileMode> {
    match value {
        value if value == atoms::clamp() => Ok(TileMode::Clamp),
        value if value == atoms::repeat() => Ok(TileMode::Repeat),
        value if value == atoms::mirror() => Ok(TileMode::Mirror),
        value if value == atoms::decal() => Ok(TileMode::Decal),
        _ => Err(rustler::Error::BadArg),
    }
}