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

◆ DecodeInterpolatedAlphaBlock()

void Microsoft.Xna.Framework.Graphics.DxtDecoder.DecodeInterpolatedAlphaBlock ( byte[] source,
int sourceOffset,
Color[] result,
int resultOffset )
inlineprivate

Definition at line 132 of file DxtDecoder.cs.

133 {
134 byte b = source[sourceOffset];
135 byte b2 = source[sourceOffset + 1];
136 alphaPalette[0] = b;
137 alphaPalette[1] = b2;
138 if (b > b2)
139 {
140 alphaPalette[2] = (byte)((6 * b + b2 + 3) / 7);
141 alphaPalette[3] = (byte)((5 * b + 2 * b2 + 3) / 7);
142 alphaPalette[4] = (byte)((4 * b + 3 * b2 + 3) / 7);
143 alphaPalette[5] = (byte)((3 * b + 4 * b2 + 3) / 7);
144 alphaPalette[6] = (byte)((2 * b + 5 * b2 + 3) / 7);
145 alphaPalette[7] = (byte)((b + 6 * b2 + 3) / 7);
146 }
147 else
148 {
149 alphaPalette[2] = (byte)((4 * b + b2 + 2) / 5);
150 alphaPalette[3] = (byte)((3 * b + 2 * b2 + 2) / 5);
151 alphaPalette[4] = (byte)((2 * b + 3 * b2 + 2) / 5);
152 alphaPalette[5] = (byte)((b + 4 * b2 + 2) / 5);
153 alphaPalette[6] = 0;
154 alphaPalette[7] = byte.MaxValue;
155 }
156 ulong num = Read48(source, sourceOffset + 2);
157 for (int i = 0; i < 4; i++)
158 {
159 for (int j = 0; j < 4; j++)
160 {
161 int num2 = (int)num & 7;
162 num >>= 3;
163 result[resultOffset + i * width + j].A = alphaPalette[num2];
164 }
165 }
166 }
static ulong Read48(byte[] source, int offset)

References Microsoft.Xna.Framework.Color.A, Microsoft.Xna.Framework.Graphics.DxtDecoder.alphaPalette, Microsoft.Xna.Framework.Graphics.DxtDecoder.Read48(), System.source, and Microsoft.Xna.Framework.Graphics.DxtDecoder.width.

Referenced by Microsoft.Xna.Framework.Graphics.DxtDecoder.Decode().