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(16))?; |
8 | |
9 | Ok(ImageSize { |
10 | width: read_u16(reader, &Endian::Little)? as usize, |
11 | height: read_u16(reader, &Endian::Little)? as usize, |
12 | }) |
13 | } |
14 | |
15 | pub fn matches(header: &[u8]) -> bool { |
16 | header.starts_with(needle:b"VTF\0 ") |
17 | } |
18 |