protected IList <byte> GetPaletteBytes(Set <Color> colors, Palette.ColorDepth depth) { List <byte> result = new List <byte>(); if (depth == Palette.ColorDepth._16bit) { foreach (Color c in colors) { result.AddRange(Palette.ColorToBytes(c)); } } else if (depth == Palette.ColorDepth._32bit) { foreach (Color c in colors) { result.Add(c.R); result.Add(c.G); result.Add(c.B); result.Add(c.A); } } result.AddRange(new byte[Math.Max(0, (int)depth * 256 - result.Count)]); return(result); }
protected override void WriteImageToIsoInner(System.IO.Stream iso, System.Drawing.Image image) { byte[] originalBytes = position.ReadIso(iso); IList <Color> pixels = new Color[Width * Height]; using (Bitmap bmp = new Bitmap(image)) { for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { pixels[y * Width + x] = bmp.GetPixel(x, y); } } } byte[] result = new byte[pixels.Count * 2]; for (int i = 0; i < pixels.Count; i++) { byte alphaByte = originalBytes[i * 2 + 1]; byte[] bytes = Palette.ColorToBytes(pixels[i], alphaByte, FFTPatcher.SpriteEditor.Palette.ColorDepth._16bit); result[i * 2] = bytes[0]; result[i * 2 + 1] = bytes[1]; } position.PatchIso(iso, result); }
protected new List <byte> GetPaletteBytes(IEnumerable <Color> colors, IList <Byte> originalPaletteBytes) { List <byte> result = new List <byte>(); int index = 0; foreach (Color c in colors) { byte alphaByte = originalPaletteBytes[index * 2 + 1]; result.AddRange(Palette.ColorToBytes(c, alphaByte, FFTPatcher.SpriteEditor.Palette.ColorDepth._16bit)); index++; } return(result); }
protected List <byte> GetPaletteBytes(IEnumerable <System.Drawing.Color> colors, IList <byte> originalPaletteBytes) { List <byte> result = new List <byte>(); int index = 0; foreach (System.Drawing.Color c in colors) { byte alphaByte = originalPaletteBytes[index * 2 + 1]; result.AddRange(Palette.ColorToBytes(c, alphaByte, Palette.ColorDepth._16bit)); index++; } return(result); }
protected List <byte> GetPaletteBytes(IEnumerable <Color> colors, IList <byte> originalPaletteBytes) { List <byte> result = new List <byte>(); int index = 0; foreach (Color c in colors) { //byte alphaByte = originalPaletteBytes[index * 2 + 1]; byte alphaByte = (depth == FFTPatcher.SpriteEditor.Palette.ColorDepth._32bit ? originalPaletteBytes[index * 4 + 3] : originalPaletteBytes[index * 2 + 1]); result.AddRange(Palette.ColorToBytes(c, alphaByte, depth)); index++; } return(result); }
public List <byte> GetPaletteBytes(IList <Color> colors, IList <byte> originalPaletteBytes, Palette.ColorDepth depth) { List <byte> result = new List <byte>(); int index = 0; foreach (Color c in colors) { byte alphaByte = (depth == Palette.ColorDepth._32bit ? originalPaletteBytes[index * 4 + 3] : originalPaletteBytes[index * 2 + 1]); result.AddRange(Palette.ColorToBytes(c, alphaByte, depth)); index++; } if (colors[0] == Color.Transparent) { result[0] = 0x00; result[1] = 0x00; } return(result); }
private IList <byte> GetPaletteBytes(Set <Color> colors) { List <byte> result = new List <byte>(colors.Count * 2); if (depth == Palette.ColorDepth._16bit) { foreach (Color c in colors) { result.AddRange(Palette.ColorToBytes(c)); } } else if (depth == Palette.ColorDepth._32bit) { foreach (Color c in colors) { result.AddRange(new byte[] { c.R, c.G, c.B, c.A }); } } result.AddRange(new byte[Math.Max(0, 16 * (int)depth - result.Count)]); return(result); }