pub struct Vtf<'a> {
pub header: Header,
pub resources: Vec<Resource>,
/* private fields */
}Expand description
A parsed VTF over borrowed or owned file bytes
Fields§
§header: Header§resources: Vec<Resource>In dictionary order. 7.0-7.2 have no dictionary, there the thumbnail and image come from the fixed layout
Implementations§
Source§impl<'a> Vtf<'a>
impl<'a> Vtf<'a>
Sourcepub fn from_bytes(bytes: &'a [u8]) -> Result<Self>
pub fn from_bytes(bytes: &'a [u8]) -> Result<Self>
Parses a VTF without copying its file data
Sourcepub fn resource(&self, tag: ResourceTag) -> Option<&[u8]>
pub fn resource(&self, tag: ResourceTag) -> Option<&[u8]>
Data of the first resource with tag: the 4 inline bytes, or its range of the file
pub fn thumbnail(&self) -> Option<RawImage<'_>>
Sourcepub fn subresource(
&self,
mip: u8,
frame: u16,
face: u8,
slice: u16,
) -> Result<RawImage<'_>>
pub fn subresource( &self, mip: u8, frame: u16, face: u8, slice: u16, ) -> Result<RawImage<'_>>
One mip of one frame, cubemap face and depth slice, mip 0 being the full-size image
Sourcepub fn base_image(&self) -> Result<RawImage<'_>>
pub fn base_image(&self) -> Result<RawImage<'_>>
The full-resolution image of the primary frame, cubemap face and volume slice
Sourcepub fn into_owned(self) -> OwnedVtf
pub fn into_owned(self) -> OwnedVtf
Trait Implementations§
impl<'a> StructuralPartialEq for Vtf<'a>
Auto Trait Implementations§
impl<'a> Freeze for Vtf<'a>
impl<'a> RefUnwindSafe for Vtf<'a>
impl<'a> Send for Vtf<'a>
impl<'a> Sync for Vtf<'a>
impl<'a> Unpin for Vtf<'a>
impl<'a> UnsafeUnpin for Vtf<'a>
impl<'a> UnwindSafe for Vtf<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more