private void Load(BufferedBinaryReader br) { this.chunkSize = this.fileMajorVersion > PSPConstants.majorVersion5 ? br.ReadUInt32() : 0; this.width = br.ReadInt32(); this.height = br.ReadInt32(); this.resValue = br.ReadDouble(); this.resUnits = (ResolutionMetric)br.ReadByte(); this.compressionType = (PSPCompression)br.ReadUInt16(); this.bitDepth = br.ReadUInt16(); this.planeCount = br.ReadUInt16(); this.colorCount = br.ReadUInt32(); this.grayScale = br.ReadByte(); this.totalImageSize = br.ReadUInt32(); this.activeLayer = br.ReadInt32(); this.layerCount = br.ReadUInt16(); if (this.fileMajorVersion > PSPConstants.majorVersion5) { this.graphicContents = (PSPGraphicContents)br.ReadUInt32(); } else { this.graphicContents = PSPGraphicContents.None; } long minChunkSize = this.fileMajorVersion > PSPConstants.majorVersion5 ? Version6HeaderSize : Version5HeaderSize; long dif = this.chunkSize - minChunkSize; if (dif > 0 && this.fileMajorVersion > PSPConstants.majorVersion5) // skip any unknown chunks { br.Position += dif; } }
public GeneralImageAttributes(int width, int height, PSPCompression compType, int activeLayer, int layerCount, ushort majorVersion) { this.chunkSize = majorVersion > PSPConstants.majorVersion5 ? Version6HeaderSize : Version5HeaderSize; this.width = width; this.height = height; this.compressionType = compType; this.activeLayer = activeLayer; this.layerCount = (ushort)layerCount; this.bitDepth = 24; this.colorCount = (1U << this.bitDepth); this.graphicContents |= PSPGraphicContents.RasterLayers; this.fileMajorVersion = majorVersion; }
public void SetGraphicContentFlag(PSPGraphicContents flag) { this.graphicContents |= flag; }