Table of Contents

Class TextureExtract

Namespace
ValveResourceFormat.IO
Assembly
ValveResourceFormat.dll

Handles extraction of texture resources to various formats.

public sealed class TextureExtract

Inheritance

Inherited Members

Constructors

TextureExtract(Resource)

Initializes a new instance of the ValveResourceFormat.IO.TextureExtract class.

public TextureExtract(Resource resource)

Parameters

resource Resource

Properties

DecodeFlags

Gets or sets the decode flags for texture extraction.

public TextureCodec DecodeFlags { get; set; }

Property Value

TextureCodec

ExportExr

Gets whether the texture should be exported as EXR format.

public bool ExportExr { get; }

Property Value

bool

IgnoreVtexFile

Should the vtex file be ignored. Defaults to true for files flagged as child resources.

public bool IgnoreVtexFile { get; set; }

Property Value

bool

ImageOutputExtension

Gets the output file extension for the texture.

public string ImageOutputExtension { get; }

Property Value

string

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

srcPixels SKPixmap
srcChannel ChannelMapping
dstPixels SKPixmap
dstChannel ChannelMapping

GetImageOutputExtension(Texture)

Gets the appropriate image output extension for a texture.

public static string GetImageOutputExtension(Texture texture)

Parameters

texture Texture

Returns

string

SubsetToPngImage(SKBitmap, SKRectI)

Converts a subset of a bitmap to PNG image bytes.

public static byte[] SubsetToPngImage(SKBitmap bitmap, SKRectI spriteRect)

Parameters

bitmap SKBitmap
spriteRect SKRectI

Returns

byte[]

ToContentFile()

The vtex content file. Input image(s) come as subfiles.

public ContentFile ToContentFile()

Returns

ContentFile

ToExrImage(SKBitmap)

Converts a bitmap to EXR image bytes.

public static byte[] ToExrImage(SKBitmap bitmap)

Parameters

bitmap SKBitmap

Returns

byte[]

ToExrImage(SKPixmap)

Converts pixmap data to EXR image bytes.

public static byte[] ToExrImage(SKPixmap pixels)

Parameters

pixels SKPixmap

Returns

byte[]

ToMaterialMaps(IEnumerable<UnpackInfo>)

Extracts texture to material map files by unpacking channels.

public ContentFile ToMaterialMaps(IEnumerable<MaterialExtract.UnpackInfo> mapsToUnpack)

Parameters

mapsToUnpack IEnumerable<MaterialExtract.UnpackInfo>

Returns

ContentFile

ToPngImage(SKBitmap)

Converts a bitmap to PNG image bytes.

public static byte[] ToPngImage(SKBitmap bitmap)

Parameters

bitmap SKBitmap

Returns

byte[]

ToPngImageChannels(SKBitmap, ChannelMapping)

Converts specific channels of a bitmap to PNG image bytes.

public static byte[] ToPngImageChannels(SKBitmap bitmap, ChannelMapping channel)

Parameters

bitmap SKBitmap
channel ChannelMapping

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

sprites Dictionary<SKRectI, string>
mks string

Returns

bool