/// <inheritdoc /> public void CreateTexture(out Texture2D texture) { texture = new Texture2D(Width, Height, UnityEngine.TextureFormat.RGBA32, false); byte[] colors = new byte[Width * Height * 4]; for (int i = 0, j = 0; i < ColorIndexes.Length; i++) { colors[j++] = ColorPalette[ColorIndexes[i]].r; colors[j++] = ColorPalette[ColorIndexes[i]].g; colors[j++] = ColorPalette[ColorIndexes[i]].b; colors[j++] = ColorPalette[ColorIndexes[i]].a; } texture.LoadRawTextureData(TextureUtility.FlipBytes(colors, (ushort)Width, (ushort)Height, 4)); texture.Apply(); }
/// <inheritdoc /> public Texture2D CreateTexture() { byte[] textureBytes = new byte[Width * Height * 3]; for (int i = 0, j = 0; i < ImageData.Length; i++) { textureBytes[j++] = Palette[ImageData[i]].r; textureBytes[j++] = Palette[ImageData[i]].g; textureBytes[j++] = Palette[ImageData[i]].b; } Texture2D texture = new Texture2D(Width, Height, UnityEngine.TextureFormat.RGB24, false); texture.LoadRawTextureData(TextureUtility.FlipBytes(textureBytes, Width, Height, 3)); texture.Apply(); return(texture); }
/// <inheritdoc /> public override byte[] FlipBytes(byte[] inputBytes, ushort imageWidth, ushort imageHeight) { return(TextureUtility.FlipBytes(inputBytes, imageWidth, imageHeight, 2)); }