当前位置: 首页>>代码示例>>C#>>正文


C# BitStream.WriteBits方法代码示例

本文整理汇总了C#中BitStream.WriteBits方法的典型用法代码示例。如果您正苦于以下问题:C# BitStream.WriteBits方法的具体用法?C# BitStream.WriteBits怎么用?C# BitStream.WriteBits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitStream的用法示例。


在下文中一共展示了BitStream.WriteBits方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Write

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        public override void Write(Stream output)
        {
            BitStream bits = new BitStream(output);
            BinaryWriter bw = new BinaryWriter(output);

            this.WriteTagHeader(output);
            bw.Write(this._shapeID);

            this._shapeBounds.Write(output);
            this._edgeBounds.Write(output);

            bits.WriteBits(5, 0); // reserved

            bits.WriteBits(1, this._usesFillWindingRule ? 1 : 0);
            bits.WriteBits(1, this._usesNonScalingStrokes ? 1 : 0);
            bits.WriteBits(1, this._usesScalingStrokes ? 1 : 0);

            this._shapes.Write(output);
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:23,代码来源:DefineShape4.cs

示例2: Write

        public void Write(System.IO.Stream output)
        {
            BinaryWriter bw = new BinaryWriter(output);

            BitStream bs = new BitStream(output);

            bs.WriteBits(1, 0);     // reserved
            bs.WriteBits(1, 0);     // reserved
            bs.WriteBits(1, _syncstop ? 1 : 0);
            bs.WriteBits(1, _syncnomultiple ? 1 : 0);
            bs.WriteBits(1, _hasEnvelope ? 1 : 0);
            bs.WriteBits(1, _hasLoops ? 1 : 0);
            bs.WriteBits(1, _hasOutPoint ? 1 : 0);
            bs.WriteBits(1, _hasInPoint ? 1 : 0);

            if (_hasInPoint)
            {
                byte[] data = BitConverter.GetBytes(this._inPoint);
                output.Write(data, 0, 4);
            }

            if (_hasOutPoint)
            {
                byte[] data = BitConverter.GetBytes(this._outPoint);
                output.Write(data, 0, 4);
            }

            if (_hasLoops)
            {
                byte[] data = BitConverter.GetBytes(this._loopCount);
                output.Write(data, 0, 2);
            }

            if (_hasEnvelope)
            {
                output.WriteByte(this._envelopePoints);
                for (int i = 0; i < this._envelopePoints; i++)
                    _envelopeRecords[i].Write(output);
            }
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:40,代码来源:SoundInfo.cs

示例3: Render

        /// <summary>
        /// Renders scene bias and play-flag back to an output stream
        /// </summary>
        /// <param name="outputStream">The output stream</param>
        /// <returns>The position of the output stream</returns>
        protected override ulong Render( System.IO.BinaryWriter outputStream )
        {
            long pos = outputStream.BaseStream.Position;

            BitStream bits = new BitStream( outputStream.BaseStream );
            bits.WriteBits( 6, 0 );
            bits.WriteBits( 1, ( _sceneBias ? 1 : 0 ) );
            bits.WriteBits( 1, ( _play ? 1 : 0 ) );
            bits.WriteFlush();

            if ( _sceneBias )
            {
                outputStream.Write( _sceneBiasAmount );
            }

            return ( ulong )( outputStream.BaseStream.Position - pos );
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:22,代码来源:ActionGotoFrame2.cs

示例4: Write

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        public override void Write( Stream output )
        {
            BinaryWriter bw = new BinaryWriter( output );
            bw.Write( ( byte )_FilterType );

            bw.Write( _BlurX );
            bw.Write( _BlurY );
            BitStream bits = new BitStream( output );
            bits.WriteBits( 5, _Passes );
            bits.WriteBits( 3, 0 );
            bits.WriteFlush();
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:16,代码来源:BlurFilter.cs

示例5: Write

        public override void Write(Stream output)
        {
            WriteTagHeader(output);

            BitStream bits = new BitStream(output);
            bits.WriteBits(4, 0);
            bits.WriteBits(2, DefineSound.getSoundRateID(PlaybackRate));
            bits.WriteBits(1, PlaybackSize == SoundSize.snd_8bit ? 0 : 1);
            bits.WriteBits(1, PlaybackType == SoundType.mono ? 0 : 1);

            bits.WriteBits(4, DefineSound.getFormatID(StreamCompression));
            bits.WriteBits(2, DefineSound.getSoundRateID(StreamRate));
            bits.WriteBits(1, StreamSize == SoundSize.snd_8bit ? 0 : 1);
            bits.WriteBits(1, StreamType == SoundType.mono ? 0 : 1);

            bits.WriteFlush();

            BinaryWriter bw = new BinaryWriter(output);

            bw.Write(AvarageCount);

            if(StreamCompression == SoundEncoding.MP3)
                bw.Write(this.LatencySeek);
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:24,代码来源:SoundStreamHead.cs

示例6: Render

        /// <summary>
        /// Renders the DefineFuntion parameters back to a output stream
        /// </summary>
        /// <param name="outputStream">The outputstream</param>
        /// <returns>The output stream position</returns>
        protected override ulong Render( BinaryWriter outputStream )
        {
            long pos = outputStream.BaseStream.Position;

            Helper.SwfStrings.SwfWriteString( this.Version, outputStream, _functionName );
            _numParams = ( ushort )_Parameters.Count;
            outputStream.Write( _numParams );
            outputStream.Write( _numRegister );

            BitStream bits = new BitStream( outputStream.BaseStream );
            bits.WriteBits( 1, ( _PreloadParentFlag ? 1 : 0 ) );
            bits.WriteBits( 1, ( _PreloadRootFlag ? 1 : 0 ) );
            bits.WriteBits( 1, ( _SuppressSuperFlag ? 1 : 0 ) );
            bits.WriteBits( 1, ( _PreloadSuperFlag ? 1 : 0 ) );
            bits.WriteBits( 1, ( _SuppressArgumentsFlag ? 1 : 0 ) );
            bits.WriteBits( 1, ( _PreloadArgumentsFlag ? 1 : 0 ) );
            bits.WriteBits( 1, ( _SuppressThisFlag ? 1 : 0 ) );
            bits.WriteBits( 1, ( _PreloadThisFlag ? 1 : 0 ) );
            bits.WriteBits( 7, 0 );
            bits.WriteBits( 1, ( _PreloadGlobalFlag ? 1 : 0 ) );
            bits.WriteFlush();

            for ( int i = 0; i < _Parameters.Count; i++ )
            {
                outputStream.Write( _Parameters[ i ].Register );
                Helper.SwfStrings.SwfWriteString( this.Version, outputStream, _Parameters[ i ].ParamName );
            }

            outputStream.Write( _codeSize );

            return ( ulong )( outputStream.BaseStream.Position - pos );
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:37,代码来源:ActionDefineFunction2.cs

示例7: Write

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        public override void Write( Stream output )
        {
            BinaryWriter bw = new BinaryWriter( output );
            bw.Write( ( byte )_FilterType );

            bw.Write( _MatrixX );
            bw.Write( _MatrixY );
            bw.Write( _DivisorFLOAT );
            bw.Write( _BiasFLOAT );

            if ( _MatrixValues.Count != ( _MatrixX * _MatrixY ) )
            {
                IndexOutOfRangeException e = new IndexOutOfRangeException( "_MatrixValues does not have " + (_MatrixX*_MatrixY).ToString("d") + " entries, does have " + _MatrixValues.Count.ToString( "d" ) );
                throw e;
            }

            for ( int i = 0; i < _MatrixValues.Count; i++ )
            {
                bw.Write( _MatrixValues[ i ] );
            }

            _DefaultColor.Write( output );
            BitStream bits = new BitStream( output );
            bits.WriteBits( 6, 0 );
            bits.WriteBits( 1, ( _Clamp ? 1 : 0 ) );
            bits.WriteBits( 1, ( _PreserveAlpha ? 1 : 0 ) );
            bits.WriteFlush();
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:32,代码来源:ConvolutionFilter.cs

示例8: Render

        /// <summary>
        /// Renders a try statement back to an output stream
        /// </summary>
        /// <param name="outputStream">The output stream</param>
        /// <returns>The output stream position</returns>
        protected override ulong Render( System.IO.BinaryWriter outputStream )
        {
            long pos = outputStream.BaseStream.Position;

            BitStream bits = new BitStream( outputStream.BaseStream );
            bits.WriteBits( 5, 0 );
            bits.WriteBits( 1, ( _CatchInRegisterFlag ? 1 : 0 ) );
            bits.WriteBits( 1, ( _FinallyBlockFlag ? 1 : 0 ) );
            bits.WriteBits( 1, ( _CatchBlockFlag ? 1 : 0 ) );
            bits.WriteFlush();

            outputStream.Write( _trySize );
            outputStream.Write( _catchSize );
            outputStream.Write( _finallySize );

            if ( _CatchInRegisterFlag )
            {
                outputStream.Write( _catchRegister );
            }
            else
            {
                Helper.SwfStrings.SwfWriteString( this.Version, outputStream, _catchName );
            }

            return ( ulong )( outputStream.BaseStream.Position - pos );
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:31,代码来源:ActionTry.cs

示例9: WriteFlags

 /// <summary>
 /// Writes the flags of this object to a stream.
 /// </summary>
 /// <param name="bw">A binary writer</param>
 /// <param name="bs">A bitstream</param>
 private void WriteFlags(BinaryWriter bw, BitStream bs)
 {
     bs.WriteBits(1, false == this._PlaceFlagHasClipActions ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasClipDepth ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasName ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasRatio ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasColorTransform ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasMatrix ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasCharacter ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagMove ? 0 : 1);
     bs.WriteBits(3, 0);//Reserved
     bs.WriteBits(1, false == this._PlaceFlagHasImage ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasClassName ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasCacheAsBitmap ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasBlendMode ? 0 : 1);
     bs.WriteBits(1, false == this._PlaceFlagHasFilterList ? 0 : 1);
 }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:22,代码来源:PlaceObject3.cs

示例10: Write

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        public override void Write( Stream output )
        {
            BinaryWriter bw = new BinaryWriter( output );
            bw.Write( ( byte )_FilterType );

            _GlowColor.Write( output );

            bw.Write( _BlurX );
            bw.Write( _BlurY );
            bw.Write( _Strength );
            BitStream bits = new BitStream( output );
            bits.WriteBits( 1, ( _InnerGlow ? 1 : 0 ) );
            bits.WriteBits( 1, ( _KnockOut ? 1 : 0 ) );
            bits.WriteBits( 1, ( _CompositeSource ? 1 : 0 ) );
            bits.WriteBits( 5, _Passes );
            bits.WriteFlush();
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:21,代码来源:GlowFilter.cs

示例11: Write

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        public override void Write(Stream output)
        {
            this.WriteTagHeader(output);

            if (!this._fontNameLen.Equals(this._fontName.Length))
            {
                SwfFormatException e = new SwfFormatException("The font name length field and the length of the font name array must be equal!");
               Log.Error(this, e.Message);
                throw e;
            }

            byte[] fontID = BitConverter.GetBytes(this._fontID);
            output.Write(fontID, 0, 2);
            output.WriteByte(this._fontNameLen);
            output.Write(this._fontName, 0, this._fontNameLen);

            BitStream bits = new BitStream(output);

            bits.WriteBits(2, 0); // reserved bits

            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsSmallText));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsShiftJIS));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsANSI));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsItalic));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsBold));
            bits.WriteBits(1, Convert.ToInt32(this._fontFlagsWideCodes));

            output.WriteByte((byte)this._languageCode);

            if (this._fontFlagsWideCodes)
            {
                byte[] tempArray = null;

                for (int i = 0; i < this._wideCodeTable.Count; i++)
                {
                    tempArray = BitConverter.GetBytes(this._codeTable[i]);
                    output.Write(tempArray, 0, 2);
                }
            }
            else
            {
                for (int i = 0; i < this._codeTable.Count; i++)
                {
                    output.WriteByte(this._codeTable[i]);
                }
            }
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:51,代码来源:DefineFontInfo2.cs

示例12: WriteFlags

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        protected virtual void WriteFlags(Stream output)
        {
            BinaryWriter bw = new BinaryWriter(output);
            BitStream bits = new BitStream(output);

            bw.Write(this._fontID);

            bits.WriteBits(1, this._fontFlagsHasLayout ? 1 : 0);
            bits.WriteBits(1, this._fontFlagsShiftJIS ? 1 : 0);
            bits.WriteBits(1, this._fontFlagsSmallText ? 1 : 0);
            bits.WriteBits(1, this._fontFlagsANSI ? 1 : 0);

            bits.WriteBits(1, this._fontFlagsWideOffsets ? 1 : 0);
            bits.WriteBits(1, this._fontFlagsWideCodes ? 1 : 0);
            bits.WriteBits(1, this._fontFlagsItalic ? 1 : 0);
            bits.WriteBits(1, this._fontFlagsBold ? 1 : 0);
            bits.WriteFlush();

            if (this._SwfVersion <= 5)
            {
                bw.Write((byte)0);
            }
            else
            {
                bw.Write((byte)this._languageCode);
            }

            bw.Write(this._fontNameLen);
            output.Write(this._fontName, 0, this._fontName.Length);

            bw.Write(this._numberOfGlyphs);

            if (this._hasGlyphs)
            {
                if (this._fontFlagsWideOffsets)
                {
                    for (int i = 0; i < this._wideOffsetTable.Length; i++)
                    {
                        bw.Write(this._wideOffsetTable[i]);
                    }

                    bw.Write(this._wideCodeTableOffset);
                }
                else
                {
                    for (int i = 0; i < this._offsetTable.Length; i++)
                    {
                        bw.Write(this._offsetTable[i]);
                    }

                    bw.Write(this._codeTableOffset);
                }

                for (int i = 0; i < this._glyphShapeTable.Length; i++)
                {
                    this._glyphShapeTable[i].Write(output);
                }
            }
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:63,代码来源:DefineFont2.cs

示例13: Write

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        public override void Write(Stream output)
        {
            //Log.Debug(this, "Writing DefineSound Tag");

            WriteTagHeader(output);

            byte[] id = BitConverter.GetBytes(this._soundID);
            output.Write(id, 0, 2);
            output.Flush();
            BitStream bits = new BitStream(output);

            bits.WriteBits(4, getFormatID(this._soundFormat));
            bits.WriteBits(2, getSoundRateID(this._soundRate));
            bits.WriteBits(1, this._soundSize == SoundSize.snd_8bit ?0 :1);
            bits.WriteBits(1, this._soundType == SoundType.mono ?0 :1);

            bits.WriteFlush();

            byte[] size = BitConverter.GetBytes(this._soundSampleCount);
            output.Write(size, 0, 4);
            output.Write(this._soundData, 0, this._soundData.Length);
            output.Flush();
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:27,代码来源:DefineSound.cs

示例14: Write

        /// <summary>
        /// 
        /// </summary>
        /// <param name="output"></param>
        public override void Write(Stream output)
        {
            this.WriteTagHeader(output);

            long pos = output.Position;

            BitStream bits = new BitStream(output);
            bits.WriteBits(1, (_PlaceFlagHasClipActions ? 1 : 0));
            bits.WriteBits(1, (_PlaceFlagHasClipDepth ? 1 : 0));
            bits.WriteBits(1, (_PlaceFlagHasName ? 1 : 0));
            bits.WriteBits(1, (_PlaceFlagHasRatio ? 1 : 0));
            bits.WriteBits(1, (_PlaceFlagHasColorTransform ? 1 : 0));
            bits.WriteBits(1, (_PlaceFlagHasMatrix ? 1 : 0));
            bits.WriteBits(1, (_PlaceFlagHasCharacter ? 1 : 0));
            bits.WriteBits(1, (_PlaceFlagMove ? 1 : 0));
            bits.WriteFlush();

            BinaryWriter bw = new BinaryWriter(output);
            bw.Write(_Depth);

            if (_PlaceFlagHasCharacter)
                bw.Write(_CharacterID);

            if (_PlaceFlagHasMatrix)
                base._TransformMatrix.Write(output);

            if (_PlaceFlagHasColorTransform)
                _CxFormWithAlpha.Write(output);

            if (_PlaceFlagHasRatio)
                bw.Write(_Ratio);

            if (_PlaceFlagHasName)
                Helper.SwfStrings.SwfWriteString(this.Version, bw, _Name);

            if (_PlaceFlagHasClipDepth)
                bw.Write(_ClipDepth);

            if (this.Version >= 5)
            {
                if (_PlaceFlagHasClipActions)
                    _ClipActions.Write(output);
            }
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:48,代码来源:PlaceObject2.cs

示例15: Write

        /// <summary>
        /// Writes this object back to a stream
        /// </summary>
        /// <param name="output">The stream to write to.</param>
        public override void Write(Stream output)
        {
            this.WriteTagHeader(output);
            BinaryWriter bw = new BinaryWriter(output);

            bw.Write(this._characterID);

            this._bounds.Write(output);

            BitStream bits = new BitStream(output);

            bits.WriteBits(1, Convert.ToInt32(this._hasText) );
            bits.WriteBits(1, Convert.ToInt32(this.Wordrap) );
            bits.WriteBits(1, Convert.ToInt32(this.MultiLine) );
            bits.WriteBits(1, Convert.ToInt32(this._password) );
            bits.WriteBits(1, Convert.ToInt32(this.ReadOnly) );
            bits.WriteBits(1, Convert.ToInt32(this._hasTextColor) );
            bits.WriteBits(1, Convert.ToInt32(this._hasMaxLength) );
            bits.WriteBits(1, Convert.ToInt32(this._hasFont) );

            bits.WriteBits(1, Convert.ToInt32(this._hasFontClass) );
            bits.WriteBits(1, Convert.ToInt32(this._autoSize) );
            bits.WriteBits(1, Convert.ToInt32(this._hasLayout) );
            bits.WriteBits(1, Convert.ToInt32(this.NoSelect) );
            bits.WriteBits(1, Convert.ToInt32(this._border) );
            bits.WriteBits(1, Convert.ToInt32(this._wasStatic) );
            bits.WriteBits(1, Convert.ToInt32(this.Html) );
            bits.WriteBits(1, Convert.ToInt32(this._hasOutlines) );

            if (this._hasFont)
            {
                bw.Write(this._fontID);
            }
            if (this._hasFontClass)
            {
                bw.Write(this._fontClass);
            }
            if (this._hasFont)
            {
                bw.Write(this._fontHeight);
            }
            if (this._hasTextColor)
            {
                this.TextColor.Write(output);
            }
            if (this._hasMaxLength)
            {
                bw.Write(this._maxLength);
            }
            if (this._hasLayout)
            {
                output.WriteByte((byte)this._align);

                bw.Write(this._leftMargin);
                bw.Write(this._rightMargin);
                bw.Write(this._indent);
                bw.Write(this._leading);
            }

            SwfStrings.SwfWriteString(this._SwfVersion, bw, this.VariableName);

            if (this._hasText)
            {
                SwfStrings.SwfWriteString(this._SwfVersion, bw, this.InitialText);
            }
        }
开发者ID:rtezli,项目名称:Blitzableiter,代码行数:70,代码来源:DefineEditText.cs


注:本文中的BitStream.WriteBits方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。