Recurity.Swf.Pix15.Parse C# (CSharp) Method

Parse() public method

Parses this object out of a stream
public Parse ( Stream input ) : void
input Stream The input stream.
return void
        public override void Parse( Stream input )
        {
            BitStream bits = new BitStream(input);

            bits.GetBits( 1 ); // reserved
            this._Red   = (Byte)bits.GetBits( 5 );
            this._Green = (Byte)bits.GetBits( 5 );
            this._Blue  = (Byte)bits.GetBits( 5 );
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <param name="imageDataSize"></param>
        /// <param name="bitmapFormat"></param>
        public virtual void Parse(Stream input, UInt64 imageDataSize, byte bitmapFormat)
        {
            if (bitmapFormat.Equals(0x04))
            {
                Pix15 temp = null;

                for (UInt64 i = 0; i < imageDataSize; i++)
                {
                    temp = new Pix15(this._SwfVersion);
                    temp.Parse(input);
                    this._bitmapPixelData.Add(temp);
                }

            }
            else if (bitmapFormat.Equals(0x05))
            {
                for (UInt64 i = 0; i < imageDataSize; i++)
                {
                    Pix24 temp = new Pix24(this._SwfVersion);
                    temp.Parse(input);
                    this._bitmapPixelData.Add(temp);
                }
            }
            else
            {
                SwfFormatException e = new SwfFormatException("BITMAPDATA can not contain any other bitmap formats than 15-bit RGB images or 24-bit RGB images ");
               Log.Error(this, e.Message);
                throw e;
            }
        }