rhwp/emf/parser/objects/
logpen.rs1use crate::emf::parser::Cursor;
4use crate::emf::Error;
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub enum PenWidthKind {
9 Logical,
10 DevicePixel,
11}
12
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub struct LogPen {
15 pub style: u32, pub width: i32, pub width_kind: PenWidthKind,
18 pub _reserved: i32, pub color: u32, }
21
22impl LogPen {
23 pub fn read(c: &mut Cursor<'_>) -> Result<Self, Error> {
24 let style = c.u32()?;
25 let width = c.i32()?;
26 Ok(Self {
27 style,
28 width,
29 width_kind: if width == 0 {
30 PenWidthKind::DevicePixel
31 } else {
32 PenWidthKind::Logical
33 },
34 _reserved: c.i32()?,
35 color: c.u32()?,
36 })
37 }
38}