1 | use crate::util::*; |
---|---|
2 | use crate::{ImageResult, ImageSize}; |
3 | |
4 | use std::io::{BufRead, Seek, SeekFrom}; |
5 | |
6 | pub fn size<R: BufRead + Seek>(reader: &mut R) -> ImageResult<ImageSize> { |
7 | reader.seek(pos:SeekFrom::Start(0x12))?; |
8 | |
9 | Ok(ImageSize { |
10 | width: read_u32(reader, &Endian::Little)? as usize, |
11 | height: read_u32(reader, &Endian::Little)? as usize, |
12 | }) |
13 | } |
14 | |
15 | pub fn matches(header: &[u8]) -> bool { |
16 | header.starts_with(needle:b"\x42\x4D ") |
17 | } |
18 |