Class TextureExtract
- Namespace
- ValveResourceFormat.IO
- Assembly
- ValveResourceFormat.dll
Handles extraction of texture resources to various formats.
public sealed class TextureExtractInheritance
Inherited Members
Constructors
TextureExtract(Resource)
Initializes a new instance of the ValveResourceFormat.IO.TextureExtract class.
public TextureExtract(Resource resource)Parameters
resourceResource
Properties
DecodeFlags
Gets or sets the decode flags for texture extraction.
public TextureCodec DecodeFlags { get; set; }Property Value
ExportExr
Gets whether the texture should be exported as EXR format.
public bool ExportExr { get; }Property Value
IgnoreVtexFile
Should the vtex file be ignored. Defaults to true for files flagged as child resources.
public bool IgnoreVtexFile { get; set; }Property Value
ImageOutputExtension
Gets the output file extension for the texture.
public string ImageOutputExtension { get; }Property Value
Methods
CopyChannel(SKPixmap, ChannelMapping, SKPixmap, ChannelMapping)
Copies a single channel from source pixmap to destination pixmap.
public static void CopyChannel(SKPixmap srcPixels, ChannelMapping srcChannel, SKPixmap dstPixels, ChannelMapping dstChannel)Parameters
srcPixelsSKPixmapsrcChannelChannelMappingdstPixelsSKPixmapdstChannelChannelMapping
GetImageOutputExtension(Texture)
Gets the appropriate image output extension for a texture.
public static string GetImageOutputExtension(Texture texture)Parameters
textureTexture
Returns
SubsetToPngImage(SKBitmap, SKRectI)
Converts a subset of a bitmap to PNG image bytes.
public static byte[] SubsetToPngImage(SKBitmap bitmap, SKRectI spriteRect)Parameters
Returns
- byte[]
ToContentFile()
The vtex content file. Input image(s) come as subfiles.
public ContentFile ToContentFile()Returns
ToExrImage(SKBitmap)
Converts a bitmap to EXR image bytes.
public static byte[] ToExrImage(SKBitmap bitmap)Parameters
bitmapSKBitmap
Returns
- byte[]
ToExrImage(SKPixmap)
Converts pixmap data to EXR image bytes.
public static byte[] ToExrImage(SKPixmap pixels)Parameters
pixelsSKPixmap
Returns
- byte[]
ToMaterialMaps(IEnumerable<UnpackInfo>)
Extracts texture to material map files by unpacking channels.
public ContentFile ToMaterialMaps(IEnumerable<MaterialExtract.UnpackInfo> mapsToUnpack)Parameters
mapsToUnpackIEnumerable<MaterialExtract.UnpackInfo>
Returns
ToPngImage(SKBitmap)
Converts a bitmap to PNG image bytes.
public static byte[] ToPngImage(SKBitmap bitmap)Parameters
bitmapSKBitmap
Returns
- byte[]
ToPngImageChannels(SKBitmap, ChannelMapping)
Converts specific channels of a bitmap to PNG image bytes.
public static byte[] ToPngImageChannels(SKBitmap bitmap, ChannelMapping channel)Parameters
bitmapSKBitmapchannelChannelMapping
Returns
- byte[]
ToValveTexture()
Converts the texture to a Valve texture (vtex) configuration string.
public string ToValveTexture()Returns
- string
-
A vtex configuration string in KeyValues2 format.
TryGetMksData(out Dictionary<SKRectI, string>, out string)
Attempts to extract sprite sheet data and MKS texture script.
public bool TryGetMksData(out Dictionary<SKRectI, string> sprites, out string mks)Parameters
spritesDictionary<SKRectI, string>mksstring