private static void RGBAToString(SFImage obj, StringBuilder builder) { for (var p = 0; p < obj.Width * obj.Height; p++) { builder.AppendFormat(" 0x{0:X2}{1:X2}{2:X2}{3:X2}", obj.Pixels[0, p], obj.Pixels[1, p], obj.Pixels[2, p], obj.Pixels[3, p]); } }
private static void GrayscaleToString(SFImage obj, StringBuilder builder) { for (var p = 0; p < obj.Width * obj.Height; p++) { builder.AppendFormat(" 0x{0:X2}", obj.Pixels[0, p]); } }
private static void GrayscaleFromString(SFImage obj, string[] tokens) { obj.Pixels = new byte[obj.Width, obj.Height]; for (var pos = 0; pos < (obj.Width * obj.Height); pos++) { obj.Pixels[0, pos] = Convert.ToByte(tokens[pos + 3].Substring(2, 2), 16); } }