/* Image Data Section * Len Description Value * 2 Compression Mode CompressionModes * n Image Data */ private static void ReadImageData(ref PsdInfo info, PSDReader reader) { info.CompressionMode = (CompressionModes)reader.ReadInt16(); int i; info.ImageData = new byte[info.Channels][]; switch (info.CompressionMode) { case CompressionModes.Raw: for (i = 0; i < info.Channels; ++i) { info.ImageData[i] = reader.ReadBytes(info.SizePerChannel); } break; case CompressionModes.RLE: reader.Position += info.Height * info.Channels * 2; for (i = 0; i < info.Channels; ++i) { info.ImageData[i] = new byte[info.SizePerChannel]; RLEDecompress(reader, info.ImageData[i], info.SizePerChannel); } break; case CompressionModes.ZipWithoutPrediction: case CompressionModes.ZipWithPrediction: throw new NotSupportedException(); } }
/* Image Data Section * Len Description Value * 2 Compression Mode CompressionModes * n Image Data */ private static void ReadImageData(ref PsdInfo info, PSDReader reader) { info.CompressionMode = (CompressionModes)reader.ReadInt16(); int i; info.ImageData = new byte[info.Channels][]; switch (info.CompressionMode) { case CompressionModes.Raw: for (i = 0; i < info.Channels; ++i) info.ImageData[i] = reader.ReadBytes(info.SizePerChannel); break; case CompressionModes.RLE: reader.Position += info.Height * info.Channels * 2; for (i = 0; i < info.Channels; ++i) { info.ImageData[i] = new byte[info.SizePerChannel]; RLEDecompress(reader, info.ImageData[i], info.SizePerChannel); } break; case CompressionModes.ZipWithoutPrediction: case CompressionModes.ZipWithPrediction: throw new NotSupportedException(); } }
/* Color Mode Data Section * Len Description Value * 4 Length * n Color Data */ private static void ReadColorData(ref PsdInfo info, PSDReader reader) { var len = reader.ReadInt32(); info.ColorData = reader.ReadBytes(len); }
/* Color Mode Data Section * Len Description Value * 4 Length * n Color Data */ private static void ReadColorData(ref PsdInfo info, PSDReader reader) { var len = reader.ReadInt32(); info.ColorData = reader.ReadBytes(len); }