/// <summary> /// Writes this component to the supplied output stream. /// </summary> /// <param name="outputStream"> /// The output stream to write to. /// </param> public override void WriteToStream(Stream outputStream) { WriteByte(_blockSize, outputStream); PackedFields packed = new PackedFields(); packed.SetBits(3, 3, (int)_disposalMethod); packed.SetBit(6, _expectsUserInput); packed.SetBit(7, _hasTransparentColour); WriteByte(packed.Byte, outputStream); WriteShort(_delayTime, outputStream); WriteByte(_transparentColourIndex, outputStream); WriteByte(0, outputStream); // block terminator }
/// <summary> /// Writes this component to the supplied output stream. /// </summary> /// <param name="outputStream"> /// The output stream to write to. /// </param> public override void WriteToStream(Stream outputStream) { // Position and size of the image in this frame WriteShort(_position.X, outputStream); WriteShort(_position.Y, outputStream); WriteShort(_size.Width, outputStream); WriteShort(_size.Height, outputStream); PackedFields packed = new PackedFields(); packed.SetBit(0, _hasLocalColourTable); packed.SetBit(1, _isInterlaced); packed.SetBit(2, _isSorted); packed.SetBits(5, 3, _localColourTableSizeBits); WriteByte(packed.Byte, outputStream); }
public void SetBitTestIndexTooSmall() { ReportStart(); try { _pf.SetBit(-1, true); } catch (ArgumentOutOfRangeException ex) { string message = "Index must be between 0 and 7. Supplied index: -1"; Assert.AreEqual("index", ex.ParamName); StringAssert.Contains(message, ex.Message); ReportEnd(); throw; } }
/// <summary> /// Writes this component to the supplied output stream. /// </summary> /// <param name="outputStream"> /// The output stream to write to. /// </param> public override void WriteToStream(Stream outputStream) { // logical screen size WriteShort(_screenSize.Width, outputStream); WriteShort(_screenSize.Height, outputStream); // Packed fields PackedFields packed = new PackedFields(); packed.SetBit(0, _hasGlobalColourTable); packed.SetBits(1, 3, _colourResolution); packed.SetBit(4, _gctIsSorted); packed.SetBits(5, 3, _gctSizeBits); WriteByte(packed.Byte, outputStream); WriteByte(_backgroundColourIndex, outputStream); WriteByte(_pixelAspectRatio, outputStream); }
public void GetSetBitTest() { ReportStart(); for (int i = 0; i < 8; i++) { _pf = new PackedFields(); _pf.SetBit(i, true); Assert.AreEqual(true, _pf.GetBit(i)); } ReportEnd(); }
/// <summary> /// Writes this component to the supplied output stream. /// </summary> /// <param name="outputStream"> /// The output stream to write to. /// </param> public override void WriteToStream( Stream outputStream ) { WriteByte( _blockSize, outputStream ); PackedFields packed = new PackedFields(); packed.SetBits( 3, 3, (int) _disposalMethod ); packed.SetBit( 6, _expectsUserInput ); packed.SetBit( 7, _hasTransparentColour ); WriteByte( packed.Byte, outputStream ); WriteShort( _delayTime , outputStream); WriteByte( _transparentColourIndex, outputStream ); WriteByte( 0, outputStream ); // block terminator }
/// <summary> /// Writes this component to the supplied output stream. /// </summary> /// <param name="outputStream"> /// The output stream to write to. /// </param> public override void WriteToStream( Stream outputStream ) { // logical screen size WriteShort( _screenSize.Width, outputStream ); WriteShort( _screenSize.Height, outputStream ); // Packed fields PackedFields packed = new PackedFields(); packed.SetBit( 0, _hasGlobalColourTable ); packed.SetBits( 1, 3, _colourResolution ); packed.SetBit( 4, _gctIsSorted ); packed.SetBits( 5, 3, _gctSizeBits ); WriteByte( packed.Byte, outputStream ); WriteByte( _backgroundColourIndex, outputStream ); WriteByte( _pixelAspectRatio, outputStream ); }
/// <summary> /// Writes this component to the supplied output stream. /// </summary> /// <param name="outputStream"> /// The output stream to write to. /// </param> public override void WriteToStream( Stream outputStream ) { // Position and size of the image in this frame WriteShort( _position.X, outputStream ); WriteShort( _position.Y, outputStream ); WriteShort( _size.Width, outputStream ); WriteShort( _size.Height, outputStream ); PackedFields packed = new PackedFields(); packed.SetBit( 0, _hasLocalColourTable ); packed.SetBit( 1, _isInterlaced ); packed.SetBit( 2, _isSorted ); packed.SetBits( 5, 3, _localColourTableSizeBits ); WriteByte( packed.Byte, outputStream ); }