use crate::emf::parser::Cursor;
use crate::emf::Error;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum PenWidthKind {
Logical,
DevicePixel,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct LogPen {
pub style: u32, pub width: i32, pub width_kind: PenWidthKind,
pub _reserved: i32, pub color: u32, }
impl LogPen {
pub fn read(c: &mut Cursor<'_>) -> Result<Self, Error> {
let style = c.u32()?;
let width = c.i32()?;
Ok(Self {
style,
width,
width_kind: if width == 0 {
PenWidthKind::DevicePixel
} else {
PenWidthKind::Logical
},
_reserved: c.i32()?,
color: c.u32()?,
})
}
}