Пример #1
0
 public CompositeImageInfoChunk()
 {
     this.chunkSize       = HeaderSize;
     this.bitmapCount     = 1;
     this.channelCount    = 3;
     this.paletteSubBlock = null;
     this.channelBlocks   = null;
 }
Пример #2
0
        public CompositeImageInfoChunk(BufferedBinaryReader br, CompositeImageAttributesChunk attr, ushort majorVersion)
        {
            this.chunkSize       = br.ReadUInt32();
            this.bitmapCount     = br.ReadUInt16();
            this.channelCount    = br.ReadUInt16();
            this.paletteSubBlock = null;
            this.channelBlocks   = new ChannelSubBlock[this.channelCount];

            long dif = (long)this.chunkSize - HeaderSize;

            if (dif > 0)
            {
                br.Position += dif;
            }

            int index = 0;

            do
            {
                uint blockSig = br.ReadUInt32();
                if (blockSig != PSPConstants.blockIdentifier)
                {
                    throw new FormatException(Properties.Resources.InvalidBlockSignature);
                }
                PSPBlockID blockType = (PSPBlockID)br.ReadUInt16();
#pragma warning disable IDE0059 // Value assigned to symbol is never used
                uint chunkLength = br.ReadUInt32();
#pragma warning restore IDE0059 // Value assigned to symbol is never used

                switch (blockType)
                {
                case PSPBlockID.ColorPalette:
                    this.paletteSubBlock = new ColorPaletteBlock(br, majorVersion);
                    break;

                case PSPBlockID.Channel:
                    ChannelSubBlock block = new ChannelSubBlock(br, attr.compressionType, majorVersion);
                    this.channelBlocks[index] = block;
                    index++;
                    break;
                }
            }while (index < this.channelCount);
        }