Table of Contents

Class DirectDrawSurface

Namespace
LlamaLogic.Packages.Formats
Assembly
LlamaLogic.Packages.dll

Provides methods for dealing with diffuse surface textures in Direct Draw Surfaces

public static class DirectDrawSurface
Inheritance
DirectDrawSurface
Inherited Members

Remarks

Adapted from S4S by Andrew

Methods

GetDstDataFromPngData(ReadOnlyMemory<byte>)

Convert a Portable Network Graphic to a shuffled DirectDraw Surface compatible with The Sims 4

public static ReadOnlyMemory<byte> GetDstDataFromPngData(ReadOnlyMemory<byte> pngData)

Parameters

pngData ReadOnlyMemory<byte>

The data of the Portable Network Graphic

Returns

ReadOnlyMemory<byte>

Exceptions

InvalidDataException

pngData is not a PNG, could not be decoded, or has more than 67,108,864 (8,192 by 8,192) pixels

GetDstDataFromPngDataAsync(ReadOnlyMemory<byte>, CancellationToken)

Convert a Portable Network Graphic to a shuffled DirectDraw Surface compatible with The Sims 4, asynchronously

public static Task<ReadOnlyMemory<byte>> GetDstDataFromPngDataAsync(ReadOnlyMemory<byte> pngData, CancellationToken cancellationToken = default)

Parameters

pngData ReadOnlyMemory<byte>

The data of the Portable Network Graphic

cancellationToken CancellationToken

The token to monitor for cancellation requests

Returns

Task<ReadOnlyMemory<byte>>

Exceptions

InvalidDataException

pngData is not a PNG, could not be decoded, or has more than 67,108,864 (8,192 by 8,192) pixels

GetPngDataFromDdsData(ReadOnlyMemory<byte>)

Convert a DirectDraw Surface to a Portable Network Graphic

public static ReadOnlyMemory<byte> GetPngDataFromDdsData(ReadOnlyMemory<byte> ddsData)

Parameters

ddsData ReadOnlyMemory<byte>

The data of a DirectDraw Surface

Returns

ReadOnlyMemory<byte>

Exceptions

InvalidDataException

The surface has no pixels or more than 67,108,864 (8,192 by 8,192) pixels, or declares more than 32 mipmap levels

GetPngDataFromDdsDataAsync(ReadOnlyMemory<byte>, CancellationToken)

Convert a DirectDraw Surface to a Portable Network Graphic, asynchronously

public static Task<ReadOnlyMemory<byte>> GetPngDataFromDdsDataAsync(ReadOnlyMemory<byte> ddsData, CancellationToken cancellationToken = default)

Parameters

ddsData ReadOnlyMemory<byte>

The data of a DirectDraw Surface

cancellationToken CancellationToken

The token to monitor for cancellation requests

Returns

Task<ReadOnlyMemory<byte>>

Exceptions

InvalidDataException

The surface has no pixels or more than 67,108,864 (8,192 by 8,192) pixels, or declares more than 32 mipmap levels

GetUnshuffledDdsData(ReadOnlyMemory<byte>)

Gets a DirectDraw Surface the way other tools expect it, unshuffling it if it is shuffled the way The Sims 4 stores images (DSTImage)

public static ReadOnlyMemory<byte> GetUnshuffledDdsData(ReadOnlyMemory<byte> ddsData)

Parameters

ddsData ReadOnlyMemory<byte>

The data of a DirectDraw Surface, shuffled or not

Returns

ReadOnlyMemory<byte>

Exceptions

InvalidDataException

ddsData is not a DirectDraw Surface