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