public void Convert( uint Width, uint Height, uint LineSize, IList <byte> SourceImg, int SourceTexPos, ref byte[] DestImg, Color4UByte[] _) { var DestTexPos = 0; DestImg = new byte[(int)(Width * Height * 8L + 1)]; for (int i = 0, loopTo = (int)(Height - 1L); i <= loopTo; i++) { for (int j = 0, loopTo1 = (int)(Width / 2L - 1L); j <= loopTo1; j++) { BitMath.Split(SourceImg[SourceTexPos], out var upper4, out var lower4); byte IAAlpha; if (Conversions.ToBoolean(upper4 & 1)) { IAAlpha = 255; } else { IAAlpha = 0; } var upperIntensity = (byte)Math.Round(IoUtil.ShiftR(upper4, 1, 3) * FACTOR); DestImg[DestTexPos] = upperIntensity; DestImg[DestTexPos + 1] = upperIntensity; DestImg[DestTexPos + 2] = upperIntensity; DestImg[DestTexPos + 3] = IAAlpha; var lowerIntensity = (byte)Math.Round(IoUtil.ShiftR(lower4, 1, 3) * FACTOR); if (Conversions.ToBoolean(lower4 & 1)) { IAAlpha = 255; } else { IAAlpha = 0; } DestImg[DestTexPos + 4] = lowerIntensity; DestImg[DestTexPos + 5] = lowerIntensity; DestImg[DestTexPos + 6] = lowerIntensity; DestImg[DestTexPos + 7] = IAAlpha; ++SourceTexPos; DestTexPos += 8; } SourceTexPos = (int)(SourceTexPos + (LineSize * 8L - Width / 2L)); } }
public void Convert( uint Width, uint Height, uint LineSize, IList <byte> SourceImg, int SourceTexPos, ref byte[] DestImg, Color4UByte[] _) { var DestTexPos = 0; DestImg = new byte[(int)(Width * Height * 8L + 1)]; for (int i = 0, loopTo = (int)(Height - 1L); i <= loopTo; i++) { for (int j = 0, loopTo1 = (int)(Width - 1L); j <= loopTo1; j++) { BitMath.Split(SourceImg[SourceTexPos], out var upper4, out var lower4); var intensity = (byte)(upper4 * FACTOR); var alpha = (byte)(lower4 * FACTOR); DestImg[DestTexPos] = intensity; DestImg[DestTexPos + 1] = intensity; DestImg[DestTexPos + 2] = intensity; DestImg[DestTexPos + 3] = alpha; ++SourceTexPos; DestTexPos += 4; } SourceTexPos = (int)(SourceTexPos + (LineSize * 8L - Width)); } }