public void visit(SFImage field) { throw new NotImplementedException(); }
public void visit(SFImage field) { int width = context.ReadInt32(); int height = context.ReadInt32(); int components = context.ReadInt32(); byte[, ,] value = new byte[height, width, components]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { uint pixel = context.ReadHexaDecimal(); switch (components) { case 1: value[height - y - 1, x, 0] = (byte)(pixel & 0xff); break; case 2: value[height - y - 1, x, 3] = (byte)(pixel & 0xff); value[height - y - 1, x, 0] = (byte)((pixel >> 8) & 0xff); break; case 3: value[height - y - 1, x, 2] = (byte)(pixel & 0xff); value[height - y - 1, x, 1] = (byte)((pixel >> 8) & 0xff); value[height - y - 1, x, 0] = (byte)((pixel >> 16) & 0xff); break; case 4: value[height - y - 1, x, 3] = (byte)(pixel & 0xff); value[height - y - 1, x, 2] = (byte)((pixel >> 8) & 0xff); value[height - y - 1, x, 1] = (byte)((pixel >> 16) & 0xff); value[height - y - 1, x, 0] = (byte)((pixel >> 24) & 0xff); break; } } } field.Value = value; }