1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! Pixel scalar type marker trait for zero-cost generic pixel handling.
/// Marker trait for pixel scalar types supported by ndspy.
///
/// This trait enables compile-time generic pixel handling with zero runtime
/// cost. Each implementation maps a Rust type to its corresponding ndspy
/// format constant.
///
/// # Safety
///
/// Implementors must ensure that:
/// - `NDSPY_TYPE` matches the memory layout of `Self`
/// - The type is `Copy`, `Default`, `Send`, `Sync`, and `'static`
///
/// These requirements are enforced by the trait bounds.
pub unsafe
// SAFETY: f32 matches PkDspyFloat32 (IEEE 754 single-precision)
unsafe
// SAFETY: u32 matches PkDspyUnsigned32
unsafe
// SAFETY: i32 matches PkDspySigned32
unsafe
// SAFETY: u16 matches PkDspyUnsigned16
unsafe
// SAFETY: i16 matches PkDspySigned16
unsafe
// SAFETY: u8 matches PkDspyUnsigned8
unsafe
// SAFETY: i8 matches PkDspySigned8
unsafe
// TODO: Add f16 support behind a feature flag
// #[cfg(feature = "half")]
// unsafe impl PixelType for half::f16 {
// const NDSPY_TYPE: u32 = 12; // PkDspyFloat16
// }