Class DirectDrawSurface
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
pngDataReadOnlyMemory<byte>The data of the Portable Network Graphic
Returns
Exceptions
- InvalidDataException
pngDatais 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
pngDataReadOnlyMemory<byte>The data of the Portable Network Graphic
cancellationTokenCancellationTokenThe token to monitor for cancellation requests
Returns
Exceptions
- InvalidDataException
pngDatais 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
ddsDataReadOnlyMemory<byte>The data of a DirectDraw Surface
Returns
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
ddsDataReadOnlyMemory<byte>The data of a DirectDraw Surface
cancellationTokenCancellationTokenThe token to monitor for cancellation requests
Returns
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
ddsDataReadOnlyMemory<byte>The data of a DirectDraw Surface, shuffled or not
Returns
Exceptions
- InvalidDataException
ddsDatais not a DirectDraw Surface