#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub struct GdsTransformFlag {
pub reflect: bool, pub absolute_magnification: bool, pub absolute_angle: bool, }
impl GdsTransformFlag {
pub fn from_u16(bits: u16) -> Self {
Self {
reflect: (bits & (1 << 15)) != 0, absolute_magnification: (bits & (1 << 2)) != 0, absolute_angle: (bits & (1 << 1)) != 0, }
}
pub fn to_u16(&self) -> u16 {
let mut bits = 0u16;
if self.reflect {
bits |= 1 << 15; }
if self.absolute_magnification {
bits |= 1 << 2; }
if self.absolute_angle {
bits |= 1 << 1; }
bits
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct GdsTransform {
pub flag: GdsTransformFlag,
pub magnification: f64,
pub angle: f64,
}
impl GdsTransform {
pub fn with_flag(bits: u16) -> Self {
Self {
flag: GdsTransformFlag::from_u16(bits),
magnification: 1.0,
angle: 0.0,
}
}
}