コード例 #1
0
ファイル: FRsResourcePicture.cs プロジェクト: whztt07/MoCross
        //============================================================
        // <T>序列化信息。</T>
        //
        // @param output 流信息
        // @author TYFNG 20120409
        //============================================================
        public override void Serialize(IOutput output)
        {
            // 序列化内容
            base.Serialize(output);
            // 写入属性
            output.WriteBool(_optionPadding);
            output.WriteBool(_optionAlpha);
            // 写入大小
            int width  = _bitmap.Width;
            int height = _bitmap.Height;

            output.WriteUint16((ushort)width);
            output.WriteUint16((ushort)height);
            // 写入范围
            output.WriteUint16((ushort)_validRectangle.Left);
            output.WriteUint16((ushort)_validRectangle.Top);
            output.WriteUint16((ushort)_validRectangle.Width);
            output.WriteUint16((ushort)_validRectangle.Height);
            // 写入数据
            _bitmap.SerializeData(output);
        }
コード例 #2
0
        //============================================================
        // <T>序列化动画数据。</T>
        //
        // @param output 输出流
        //============================================================
        public override void Serialize(IOutput output)
        {
            base.Serialize(output);
            // 写入属性
            FRsResourceClip firstClip = FristClip;

            _size.Serialize16(output);
            _validBarycenter.Serialize16(output);
            _mergeSize.Serialize16(output);
            // 写入帧延迟
            if (firstClip != null)
            {
                output.WriteUint16((ushort)firstClip.FrameCount);
            }
            else
            {
                output.WriteUint16((ushort)0);
            }
            if (firstClip != null)
            {
                firstClip.SerializeDelay(output);
            }
            // 写入剪辑集合
            int clipCount = ClipCount;

            output.WriteUint8((byte)clipCount);
            foreach (FRsResourceClip clip in _clips)
            {
                if (clip != null)
                {
                    clip.Serialize(output);
                }
            }
            // 序列化位图
            using (FBitmap bitmap = new FBitmap(_mergeFileName)){
                bitmap.SerializeData(output);
            }
        }