Skip to main content

singe_npp/
types_enums.rs

1use super::*;
2
3#[non_exhaustive]
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
5#[repr(u32)]
6pub enum InterpolationMode {
7    Undefined = sys::NppiInterpolationMode::NPPI_INTER_UNDEFINED as _,
8    Nearest = sys::NppiInterpolationMode::NPPI_INTER_NN as _,
9    Linear = sys::NppiInterpolationMode::NPPI_INTER_LINEAR as _,
10    Cubic = sys::NppiInterpolationMode::NPPI_INTER_CUBIC as _,
11    CubicBspline = sys::NppiInterpolationMode::NPPI_INTER_CUBIC2P_BSPLINE as _,
12    CubicCatmullRom = sys::NppiInterpolationMode::NPPI_INTER_CUBIC2P_CATMULLROM as _,
13    CubicB05C03 = sys::NppiInterpolationMode::NPPI_INTER_CUBIC2P_B05C03 as _,
14    Super = sys::NppiInterpolationMode::NPPI_INTER_SUPER as _,
15    Lanczos = sys::NppiInterpolationMode::NPPI_INTER_LANCZOS as _,
16    Lanczos3Advanced = sys::NppiInterpolationMode::NPPI_INTER_LANCZOS3_ADVANCED as _,
17    SmoothEdge = sys::NppiInterpolationMode::NPPI_SMOOTH_EDGE as _,
18}
19
20impl_enum_conversion!(sys::NppiInterpolationMode, InterpolationMode);
21
22impl From<InterpolationMode> for i32 {
23    fn from(value: InterpolationMode) -> Self {
24        let raw: u32 = value.into();
25        raw as _
26    }
27}
28
29impl_enum_display!(InterpolationMode, {
30    InterpolationMode::Undefined => "NPPI_INTER_UNDEFINED",
31    InterpolationMode::Nearest => "NPPI_INTER_NN",
32    InterpolationMode::Linear => "NPPI_INTER_LINEAR",
33    InterpolationMode::Cubic => "NPPI_INTER_CUBIC",
34    InterpolationMode::CubicBspline => "NPPI_INTER_CUBIC2P_BSPLINE",
35    InterpolationMode::CubicCatmullRom => "NPPI_INTER_CUBIC2P_CATMULLROM",
36    InterpolationMode::CubicB05C03 => "NPPI_INTER_CUBIC2P_B05C03",
37    InterpolationMode::Super => "NPPI_INTER_SUPER",
38    InterpolationMode::Lanczos => "NPPI_INTER_LANCZOS",
39    InterpolationMode::Lanczos3Advanced => "NPPI_INTER_LANCZOS3_ADVANCED",
40    InterpolationMode::SmoothEdge => "NPPI_SMOOTH_EDGE",
41});
42
43#[non_exhaustive]
44#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
45#[repr(u32)]
46pub enum RoundMode {
47    Near = sys::NppRoundMode::NPP_RND_NEAR as _,
48    Financial = sys::NppRoundMode::NPP_RND_FINANCIAL as _,
49    Zero = sys::NppRoundMode::NPP_RND_ZERO as _,
50}
51
52impl_enum_conversion!(sys::NppRoundMode, RoundMode);
53
54impl_enum_display!(RoundMode, {
55    RoundMode::Near => "NPP_RND_NEAR",
56    RoundMode::Financial => "NPP_RND_FINANCIAL",
57    RoundMode::Zero => "NPP_RND_ZERO",
58});
59
60#[non_exhaustive]
61#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
62#[repr(u32)]
63pub enum HintAlgorithm {
64    None = sys::NppHintAlgorithm::NPP_ALG_HINT_NONE as _,
65    Fast = sys::NppHintAlgorithm::NPP_ALG_HINT_FAST as _,
66    Accurate = sys::NppHintAlgorithm::NPP_ALG_HINT_ACCURATE as _,
67}
68
69impl_enum_conversion!(sys::NppHintAlgorithm, HintAlgorithm);
70
71impl_enum_display!(HintAlgorithm, {
72    HintAlgorithm::None => "NPP_ALG_HINT_NONE",
73    HintAlgorithm::Fast => "NPP_ALG_HINT_FAST",
74    HintAlgorithm::Accurate => "NPP_ALG_HINT_ACCURATE",
75});
76
77#[non_exhaustive]
78#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
79#[repr(u32)]
80pub enum ImageNormalization {
81    Infinity = sys::NppiNorm::nppiNormInf as _,
82    L1 = sys::NppiNorm::nppiNormL1 as _,
83    L2 = sys::NppiNorm::nppiNormL2 as _,
84}
85
86impl_enum_conversion!(sys::NppiNorm, ImageNormalization);
87
88impl_enum_display!(ImageNormalization, {
89    ImageNormalization::Infinity => "nppiNormInf",
90    ImageNormalization::L1 => "nppiNormL1",
91    ImageNormalization::L2 => "nppiNormL2",
92});
93
94#[non_exhaustive]
95#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
96#[repr(u32)]
97pub enum WatershedSegmentBoundaryType {
98    None = sys::NppiWatershedSegmentBoundaryType::NPP_WATERSHED_SEGMENT_BOUNDARIES_NONE as _,
99    Black = sys::NppiWatershedSegmentBoundaryType::NPP_WATERSHED_SEGMENT_BOUNDARIES_BLACK as _,
100    White = sys::NppiWatershedSegmentBoundaryType::NPP_WATERSHED_SEGMENT_BOUNDARIES_WHITE as _,
101    Contrast =
102        sys::NppiWatershedSegmentBoundaryType::NPP_WATERSHED_SEGMENT_BOUNDARIES_CONTRAST as _,
103    BoundariesOnly =
104        sys::NppiWatershedSegmentBoundaryType::NPP_WATERSHED_SEGMENT_BOUNDARIES_ONLY as _,
105}
106
107impl_enum_conversion!(
108    sys::NppiWatershedSegmentBoundaryType,
109    WatershedSegmentBoundaryType
110);
111
112impl_enum_display!(WatershedSegmentBoundaryType, {
113    WatershedSegmentBoundaryType::None => "NPP_WATERSHED_SEGMENT_BOUNDARIES_NONE",
114    WatershedSegmentBoundaryType::Black => "NPP_WATERSHED_SEGMENT_BOUNDARIES_BLACK",
115    WatershedSegmentBoundaryType::White => "NPP_WATERSHED_SEGMENT_BOUNDARIES_WHITE",
116    WatershedSegmentBoundaryType::Contrast => "NPP_WATERSHED_SEGMENT_BOUNDARIES_CONTRAST",
117    WatershedSegmentBoundaryType::BoundariesOnly => "NPP_WATERSHED_SEGMENT_BOUNDARIES_ONLY",
118});
119
120#[non_exhaustive]
121#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
122#[repr(u32)]
123pub enum ComparisonOperation {
124    Less = sys::NppCmpOp::NPP_CMP_LESS as _,
125    LessEqual = sys::NppCmpOp::NPP_CMP_LESS_EQ as _,
126    Equal = sys::NppCmpOp::NPP_CMP_EQ as _,
127    GreaterEqual = sys::NppCmpOp::NPP_CMP_GREATER_EQ as _,
128    Greater = sys::NppCmpOp::NPP_CMP_GREATER as _,
129}
130
131impl_enum_conversion!(sys::NppCmpOp, ComparisonOperation);
132
133impl_enum_display!(ComparisonOperation, {
134    ComparisonOperation::Less => "NPP_CMP_LESS",
135    ComparisonOperation::LessEqual => "NPP_CMP_LESS_EQ",
136    ComparisonOperation::Equal => "NPP_CMP_EQ",
137    ComparisonOperation::GreaterEqual => "NPP_CMP_GREATER_EQ",
138    ComparisonOperation::Greater => "NPP_CMP_GREATER",
139});
140
141#[non_exhaustive]
142#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
143#[repr(u32)]
144pub enum BorderType {
145    Undefined = sys::NppiBorderType::NPP_BORDER_UNDEFINED as _,
146    Constant = sys::NppiBorderType::NPP_BORDER_CONSTANT as _,
147    Replicate = sys::NppiBorderType::NPP_BORDER_REPLICATE as _,
148    Wrap = sys::NppiBorderType::NPP_BORDER_WRAP as _,
149    Mirror = sys::NppiBorderType::NPP_BORDER_MIRROR as _,
150}
151
152impl_enum_conversion!(sys::NppiBorderType, BorderType);
153
154impl_enum_display!(BorderType, {
155    BorderType::Undefined => "NPP_BORDER_UNDEFINED",
156    BorderType::Constant => "NPP_BORDER_CONSTANT",
157    BorderType::Replicate => "NPP_BORDER_REPLICATE",
158    BorderType::Wrap => "NPP_BORDER_WRAP",
159    BorderType::Mirror => "NPP_BORDER_MIRROR",
160});
161
162#[non_exhaustive]
163#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
164#[repr(u32)]
165pub enum MaskSize {
166    Mask1x3 = sys::NppiMaskSize::NPP_MASK_SIZE_1_X_3 as _,
167    Mask1x5 = sys::NppiMaskSize::NPP_MASK_SIZE_1_X_5 as _,
168    Mask3x1 = sys::NppiMaskSize::NPP_MASK_SIZE_3_X_1 as _,
169    Mask5x1 = sys::NppiMaskSize::NPP_MASK_SIZE_5_X_1 as _,
170    Mask3x3 = sys::NppiMaskSize::NPP_MASK_SIZE_3_X_3 as _,
171    Mask5x5 = sys::NppiMaskSize::NPP_MASK_SIZE_5_X_5 as _,
172    Mask7x7 = sys::NppiMaskSize::NPP_MASK_SIZE_7_X_7 as _,
173    Mask9x9 = sys::NppiMaskSize::NPP_MASK_SIZE_9_X_9 as _,
174    Mask11x11 = sys::NppiMaskSize::NPP_MASK_SIZE_11_X_11 as _,
175    Mask13x13 = sys::NppiMaskSize::NPP_MASK_SIZE_13_X_13 as _,
176    Mask15x15 = sys::NppiMaskSize::NPP_MASK_SIZE_15_X_15 as _,
177}
178
179impl_enum_conversion!(sys::NppiMaskSize, MaskSize);
180
181impl_enum_display!(MaskSize, {
182    MaskSize::Mask1x3 => "NPP_MASK_SIZE_1_X_3",
183    MaskSize::Mask1x5 => "NPP_MASK_SIZE_1_X_5",
184    MaskSize::Mask3x1 => "NPP_MASK_SIZE_3_X_1",
185    MaskSize::Mask5x1 => "NPP_MASK_SIZE_5_X_1",
186    MaskSize::Mask3x3 => "NPP_MASK_SIZE_3_X_3",
187    MaskSize::Mask5x5 => "NPP_MASK_SIZE_5_X_5",
188    MaskSize::Mask7x7 => "NPP_MASK_SIZE_7_X_7",
189    MaskSize::Mask9x9 => "NPP_MASK_SIZE_9_X_9",
190    MaskSize::Mask11x11 => "NPP_MASK_SIZE_11_X_11",
191    MaskSize::Mask13x13 => "NPP_MASK_SIZE_13_X_13",
192    MaskSize::Mask15x15 => "NPP_MASK_SIZE_15_X_15",
193});
194
195#[non_exhaustive]
196#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
197#[repr(u32)]
198pub enum Axis {
199    Horizontal = sys::NppiAxis::NPP_HORIZONTAL_AXIS as _,
200    Vertical = sys::NppiAxis::NPP_VERTICAL_AXIS as _,
201    Both = sys::NppiAxis::NPP_BOTH_AXIS as _,
202}
203
204impl_enum_conversion!(sys::NppiAxis, Axis);
205
206impl_enum_display!(Axis, {
207    Axis::Horizontal => "NPP_HORIZONTAL_AXIS",
208    Axis::Vertical => "NPP_VERTICAL_AXIS",
209    Axis::Both => "NPP_BOTH_AXIS",
210});
211
212#[non_exhaustive]
213#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
214#[repr(u32)]
215pub enum BayerGridPosition {
216    Bggr = sys::NppiBayerGridPosition::NPPI_BAYER_BGGR as _,
217    Rggb = sys::NppiBayerGridPosition::NPPI_BAYER_RGGB as _,
218    Gbrg = sys::NppiBayerGridPosition::NPPI_BAYER_GBRG as _,
219    Grbg = sys::NppiBayerGridPosition::NPPI_BAYER_GRBG as _,
220}
221
222impl_enum_conversion!(sys::NppiBayerGridPosition, BayerGridPosition);
223
224impl_enum_display!(BayerGridPosition, {
225    BayerGridPosition::Bggr => "NPPI_BAYER_BGGR",
226    BayerGridPosition::Rggb => "NPPI_BAYER_RGGB",
227    BayerGridPosition::Gbrg => "NPPI_BAYER_GBRG",
228    BayerGridPosition::Grbg => "NPPI_BAYER_GRBG",
229});
230
231#[non_exhaustive]
232#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
233#[repr(u32)]
234pub enum DifferentialKernel {
235    Sobel = sys::NppiDifferentialKernel::NPP_FILTER_SOBEL as _,
236    Scharr = sys::NppiDifferentialKernel::NPP_FILTER_SCHARR as _,
237}
238
239impl_enum_conversion!(sys::NppiDifferentialKernel, DifferentialKernel);
240
241impl_enum_display!(DifferentialKernel, {
242    DifferentialKernel::Sobel => "NPP_FILTER_SOBEL",
243    DifferentialKernel::Scharr => "NPP_FILTER_SCHARR",
244});
245
246#[non_exhaustive]
247#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
248#[repr(u32)]
249pub enum AlphaOperation {
250    Over = sys::NppiAlphaOp::NPPI_OP_ALPHA_OVER as _,
251    In = sys::NppiAlphaOp::NPPI_OP_ALPHA_IN as _,
252    Out = sys::NppiAlphaOp::NPPI_OP_ALPHA_OUT as _,
253    Atop = sys::NppiAlphaOp::NPPI_OP_ALPHA_ATOP as _,
254    Xor = sys::NppiAlphaOp::NPPI_OP_ALPHA_XOR as _,
255    Plus = sys::NppiAlphaOp::NPPI_OP_ALPHA_PLUS as _,
256    OverPremultiplied = sys::NppiAlphaOp::NPPI_OP_ALPHA_OVER_PREMUL as _,
257    InPremultiplied = sys::NppiAlphaOp::NPPI_OP_ALPHA_IN_PREMUL as _,
258    OutPremultiplied = sys::NppiAlphaOp::NPPI_OP_ALPHA_OUT_PREMUL as _,
259    AtopPremultiplied = sys::NppiAlphaOp::NPPI_OP_ALPHA_ATOP_PREMUL as _,
260    XorPremultiplied = sys::NppiAlphaOp::NPPI_OP_ALPHA_XOR_PREMUL as _,
261    PlusPremultiplied = sys::NppiAlphaOp::NPPI_OP_ALPHA_PLUS_PREMUL as _,
262    Premultiplied = sys::NppiAlphaOp::NPPI_OP_ALPHA_PREMUL as _,
263}
264
265impl_enum_conversion!(sys::NppiAlphaOp, AlphaOperation);
266
267impl_enum_display!(AlphaOperation, {
268    AlphaOperation::Over => "NPPI_OP_ALPHA_OVER",
269    AlphaOperation::In => "NPPI_OP_ALPHA_IN",
270    AlphaOperation::Out => "NPPI_OP_ALPHA_OUT",
271    AlphaOperation::Atop => "NPPI_OP_ALPHA_ATOP",
272    AlphaOperation::Xor => "NPPI_OP_ALPHA_XOR",
273    AlphaOperation::Plus => "NPPI_OP_ALPHA_PLUS",
274    AlphaOperation::OverPremultiplied => "NPPI_OP_ALPHA_OVER_PREMUL",
275    AlphaOperation::InPremultiplied => "NPPI_OP_ALPHA_IN_PREMUL",
276    AlphaOperation::OutPremultiplied => "NPPI_OP_ALPHA_OUT_PREMUL",
277    AlphaOperation::AtopPremultiplied => "NPPI_OP_ALPHA_ATOP_PREMUL",
278    AlphaOperation::XorPremultiplied => "NPPI_OP_ALPHA_XOR_PREMUL",
279    AlphaOperation::PlusPremultiplied => "NPPI_OP_ALPHA_PLUS_PREMUL",
280    AlphaOperation::Premultiplied => "NPPI_OP_ALPHA_PREMUL",
281});
282
283#[non_exhaustive]
284#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
285#[repr(u32)]
286pub enum ZeroCrossingType {
287    SignChange = sys::NppsZCType::nppZCR as _,
288    SignChangeXor = sys::NppsZCType::nppZCXor as _,
289    SignChangeCountZero = sys::NppsZCType::nppZCC as _,
290}
291
292impl_enum_conversion!(sys::NppsZCType, ZeroCrossingType);
293
294impl_enum_display!(ZeroCrossingType, {
295    ZeroCrossingType::SignChange => "nppZCR",
296    ZeroCrossingType::SignChangeXor => "nppZCXor",
297    ZeroCrossingType::SignChangeCountZero => "nppZCC",
298});
299
300#[non_exhaustive]
301#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, TryFromPrimitive, IntoPrimitive)]
302#[repr(u32)]
303pub enum HuffmanTableType {
304    Dc = sys::NppiHuffmanTableType::nppiDCTable as _,
305    Ac = sys::NppiHuffmanTableType::nppiACTable as _,
306}
307
308impl_enum_conversion!(sys::NppiHuffmanTableType, HuffmanTableType);
309
310impl_enum_display!(HuffmanTableType, {
311    HuffmanTableType::Dc => "nppiDCTable",
312    HuffmanTableType::Ac => "nppiACTable",
313});