Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Decode()

Color[] Microsoft.Xna.Framework.Graphics.DxtDecoder.Decode ( byte[] source)
inline

Definition at line 44 of file DxtDecoder.cs.

45 {
46 Color[] result = new Color[width * height];
47 int num = 0;
48 for (int i = 0; i < height; i += 4)
49 {
50 for (int j = 0; j < width; j += 4)
51 {
52 int resultOffset = i * width + j;
53 switch (format)
54 {
55 case SurfaceFormat.Dxt1:
56 DecodeRgbBlock(source, num, result, resultOffset, isDxt1: true);
57 num += 8;
58 break;
59 case SurfaceFormat.Dxt3:
60 DecodeRgbBlock(source, num + 8, result, resultOffset, isDxt1: false);
61 DecodeExplicitAlphaBlock(source, num, result, resultOffset);
62 num += 16;
63 break;
64 case SurfaceFormat.Dxt5:
65 DecodeRgbBlock(source, num + 8, result, resultOffset, isDxt1: false);
66 DecodeInterpolatedAlphaBlock(source, num, result, resultOffset);
67 num += 16;
68 break;
69 }
70 }
71 }
72 return result;
73 }
void DecodeExplicitAlphaBlock(byte[] source, int sourceOffset, Color[] result, int resultOffset)
void DecodeRgbBlock(byte[] source, int sourceOffset, Color[] result, int resultOffset, bool isDxt1)
Definition DxtDecoder.cs:75
void DecodeInterpolatedAlphaBlock(byte[] source, int sourceOffset, Color[] result, int resultOffset)

References Microsoft.Xna.Framework.Graphics.DxtDecoder.DecodeExplicitAlphaBlock(), Microsoft.Xna.Framework.Graphics.DxtDecoder.DecodeInterpolatedAlphaBlock(), Microsoft.Xna.Framework.Graphics.DxtDecoder.DecodeRgbBlock(), Microsoft.Xna.Framework.Graphics.DxtDecoder.format, Microsoft.Xna.Framework.Graphics.DxtDecoder.height, System.source, and Microsoft.Xna.Framework.Graphics.DxtDecoder.width.

Referenced by Microsoft.Xna.Framework.Graphics.Texture2D.SaveAsImage().