C# Class CSharpImageLibrary.DDS.DDS_BlockHelpers

Show file Open project: KFreon/CSharpImageLibrary Class Usage Examples

Public Methods

Method Description
BuildRGBPalette ( int Colour0, int Colour1, bool isDXT1 ) : int[]

Builds an RGB palette from the min and max colours of a texel.

Compress8BitBlock ( byte source, int sourcePosition, int sourceLineLength, byte destination, int destPosition, int channel, bool isSigned ) : void

Private Methods

Method Description
Build8BitPalette ( byte min, byte max, bool isSigned ) : byte[]

Builds palette for 8 bit channel.

BuildDXTColour ( byte r, byte g, byte b ) : int

Creates a packed DXT colour from RGB.

CheckDXT1TexelFullTransparency ( byte imgData, int sourcePosition, int sourceLineLength, byte destination, int destPosition, AlphaSettings alphaSetting, double alphaRef ) : int
CompressRGBTexel ( byte imgData, int sourcePosition, int sourceLineLength, byte destination, int destPosition, bool isDXT1, double alphaRef, AlphaSettings alphaSetting ) : void
Decode565 ( uint wColour ) : RGBColour
Decompress8BitBlock ( byte source, int sourceStart, bool isSigned ) : byte[]
Decompress8BitBlock ( byte source, int sourceStart, byte destination, int decompressedStart, int decompressedLineLength, bool isSigned ) : void
DecompressRGBBlock ( byte source, int sourcePosition, byte destination, int destinationStart, int destinationLineLength, bool isDXT1, bool isPremultiplied ) : void
DoColourFixErrorCorrection ( RGBColour Colour, byte imgData, int sourcePosition, int sourceLineLength, AlphaSettings alphaSetting ) : void

Not exactly sure what this does or why.

DoOtherColourFixErrorCorrection ( byte imgData, int sourcePosition, int sourceLineLength, int uSteps, double alphaRef, AlphaSettings alphaSetting, RGBColour step, RGBColour Dir ) : uint
DoSomeDithering ( RGBColour current, int index, RGBColour InnerColour, int InnerIndex, RGBColour Error ) : void
DoSomethingWithPalette ( int uSteps, uint wColourA, uint wColourB, RGBColour ColourA, RGBColour ColourB ) : RGBColour[]
Encode565 ( RGBColour colour ) : uint
GetClosestValue ( byte arr, byte c ) : int
OptimiseRGB ( RGBColour Colour, int uSteps ) : RGBColour[]
ReadColourFromTexel ( byte texel, int i, bool premultiply ) : RGBColour
ReadDXTColour ( int colour, byte &red, byte &blue, byte &green ) : void

Reads a packed DXT colour into RGB

UnpackDXTColour ( int colour, byte destination, int position, bool isPremultiplied ) : void

Reads a packed DXT colour into RGB

Method Details

BuildRGBPalette() public static method

Builds an RGB palette from the min and max colours of a texel.
public static BuildRGBPalette ( int Colour0, int Colour1, bool isDXT1 ) : int[]
Colour0 int First colour, usually the min.
Colour1 int Second colour, usually the max.
isDXT1 bool True = for DXT1 texels. Changes how the internals are calculated.
return int[]

Compress8BitBlock() public static method

public static Compress8BitBlock ( byte source, int sourcePosition, int sourceLineLength, byte destination, int destPosition, int channel, bool isSigned ) : void
source byte
sourcePosition int
sourceLineLength int
destination byte
destPosition int
channel int
isSigned bool
return void