|
@@ -0,0 +1,75 @@
|
|
|
+use binrw::{binread, BinRead, BinWrite, FilePtr64};
|
|
|
+
|
|
|
+use crate::{
|
|
|
+ array_of::ArrayOf,
|
|
|
+ basic_field::{Field, Rgba},
|
|
|
+ field_of::FieldOf,
|
|
|
+};
|
|
|
+
|
|
|
+#[derive(BinRead, Debug)]
|
|
|
+pub struct Header {
|
|
|
+ _magic: [u16; 8],
|
|
|
+ _unknown_1: [u8; 0x150],
|
|
|
+ pub thumbnail_offset: FilePtr64<Thumbnail>,
|
|
|
+ pub pens_offset: FilePtr64<PenHeader>,
|
|
|
+ _unknown_offset: FilePtr64<()>,
|
|
|
+ pub layers_offset: FilePtr64<Layers>,
|
|
|
+ _unknown_2: [u8; 0x1A8],
|
|
|
+}
|
|
|
+
|
|
|
+#[derive(BinRead, BinWrite, Debug)]
|
|
|
+pub struct Thumbnail {
|
|
|
+ _zeros_1: u32,
|
|
|
+ dimension_x: u32,
|
|
|
+ dimension_y: u32,
|
|
|
+ _unknown_1: u32, // 0x320?
|
|
|
+ _unknown_2: u32, // 0x200001?
|
|
|
+ _zeros_2: [u32; 3],
|
|
|
+
|
|
|
+ #[br(count = dimension_x * dimension_y)]
|
|
|
+ pixels: Vec<Rgba>,
|
|
|
+}
|
|
|
+
|
|
|
+#[derive(BinRead, Debug)]
|
|
|
+pub struct PenHeader {
|
|
|
+ pen_count: u32,
|
|
|
+ #[br(args {
|
|
|
+ inner: binrw::args! {
|
|
|
+ pen_count
|
|
|
+ }
|
|
|
+ })]
|
|
|
+ start_offset: FilePtr64<Pens>,
|
|
|
+}
|
|
|
+
|
|
|
+#[derive(BinRead, BinWrite, Debug)]
|
|
|
+#[br(import {pen_count: u32})]
|
|
|
+pub struct Pens {
|
|
|
+ #[br(count = pen_count)]
|
|
|
+ pens: Vec<Pen>
|
|
|
+}
|
|
|
+
|
|
|
+#[derive(BinRead, BinWrite, Debug)]
|
|
|
+pub struct Pen {
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#[derive(BinRead, BinWrite, Debug)]
|
|
|
+pub struct Layers {}
|
|
|
+
|
|
|
+// #[binread]
|
|
|
+// #[derive(Debug)]
|
|
|
+// pub struct File {
|
|
|
+// header: Header,
|
|
|
+
|
|
|
+// #[br(count = 40000)] // 200x200?
|
|
|
+// thumbnail: Vec<u32>,
|
|
|
+// _padding: u32,
|
|
|
+
|
|
|
+// // #[br(temp)]
|
|
|
+// // #[bw(try_calc(u32::try_from(pens.len())))]
|
|
|
+// pen_count: u32, // Number of pens
|
|
|
+// pen_offset: u64, // Offset from start of file of pens (should immediately follow this)
|
|
|
+
|
|
|
+// // #[br(count = pen_count)]
|
|
|
+// // pens: Vec<ArrayOf<Field>>,
|
|
|
+// }
|