Esempio n. 1
0
        public void ToSwf(SwfWriter w, bool isSwf6Plus)
        {
            if ((uint)ClipEvents == 0)
            {
                if (isSwf6Plus)
                {
                    w.AppendUI32(0);
                }
                else
                {
                    w.AppendUI16(0);
                }
            }
            else
            {
                w.AppendBits((uint)ClipEvents, 32);

                uint start = (uint)w.Position;
                w.AppendUI32(0);                 // write len after tag written

                if ((ClipEvents & ClipEvents.KeyPress) > 0)
                {
                    w.AppendByte(KeyCode);
                }
                ActionRecords.ToSwf(w);

                uint end = (uint)w.Position;
                w.Position = start;
                w.AppendUI32(end - start - 4);
                w.Position = end;
            }
        }
Esempio n. 2
0
        public void ToSwf(SwfWriter w)
        {
            w.AppendBits(0, 2); // reserved
            w.AppendBit(IsSyncStop);
            w.AppendBit(IsSyncNoMultiple);
            w.AppendBit(HasEnvelope);
            w.AppendBit(HasLoops);
            w.AppendBit(HasOutPoint);
            w.Align();

            if (HasInPoint)
            {
                w.AppendUI32(InPoint);
            }
            if (HasOutPoint)
            {
                w.AppendUI32(OutPoint);
            }
            if (HasLoops)
            {
                w.AppendUI16(LoopCount);
            }
            if (HasEnvelope)
            {
                w.AppendByte((byte)LoopCount);
                uint count = (uint)EnvelopeRecords.Length;
                for (int i = 0; i < EnvelopeRecords.Length; i++)
                {
                    w.AppendUI32(EnvelopeRecords[i].Pos44);
                    w.AppendUI16(EnvelopeRecords[i].LeftLevel);
                    w.AppendUI16(EnvelopeRecords[i].RightLevel);
                }
            }
        }
Esempio n. 3
0
        public void ToSwf(SwfWriter w)
        {
            uint start = (uint)w.Position;

            w.AppendTagIDAndLength(this.TagType, 0, true);

            w.AppendUI16(CharacterId);

            if (!HasAlphaData)
            {
                if (!HasOwnTable)
                {
                    w.AppendByte(0xFF);
                    w.AppendByte(0xD8);

                    w.AppendBytes(JpegData);

                    w.AppendByte(0xFF);
                    w.AppendByte(0xD9);
                }
                else
                {
                    w.AppendBytes(JpegData);
                }
            }
            else
            {
                w.AppendUI32((uint)JpegData.Length);
                w.AppendBytes(JpegData);

                w.AppendBytes(CompressedAlphaData);
            }

            w.ResetLongTagLength(this.TagType, start, true);
        }
Esempio n. 4
0
        public void ToSwf(SwfWriter w)
        {
            uint len = 4;

            w.AppendTagIDAndLength(this.TagType, len, false);
            w.AppendUI32(this.flags);
        }
Esempio n. 5
0
        public void ToSwf(SwfWriter w)
        {
            if (IsCompressed)
            {
                w.AppendByte((byte)'C');
            }
            else
            {
                w.AppendByte((byte)'F');
            }
            w.AppendByte((byte)'W');
            w.AppendByte((byte)'S');

            w.AppendByte(this.Version);

            w.AppendUI32(this.FileLength);
            this.FrameSize.ToSwf(w);

            ushort frateWhole = (ushort)this.FrameRate;
            uint   frateDec   = (((uint)this.FrameRate * 0x100) & 0xFF);

            w.AppendUI16((uint)((frateWhole << 8) + frateDec));

            w.AppendUI16(this.FrameCount);
        }
Esempio n. 6
0
        public void ToSwf(SwfWriter w)
        {
            // write header
            this.Header.ToSwf(w);

            for (int i = 0; i < Tags.Count; i++)
            {
                //if (i == 0x2de)//w.Position >= 0x3cd20)//
                //{
                //    i = i;
                //}
                if (Tags[i] is PlaceObject2Tag)
                {
                    bool is6Plus = this.Header.Version > 5;
                    ((PlaceObject2Tag)Tags[i]).ToSwf(w, is6Plus);
                }
                else
                {
                    Tags[i].ToSwf(w);
                }
            }

            if (Header.IsCompressed)
            {
                w.Zip();
            }

            uint len = (uint)w.Position;

            w.Position = 4;
            w.AppendUI32(len);
            w.Position = len;
        }
Esempio n. 7
0
        public void ToSwf(SwfWriter w)
        {
            uint start = (uint)w.Position;

            w.AppendTagIDAndLength(this.TagType, 0, true);

            w.AppendUI16(SoundId);

            w.AppendBits((uint)SoundFormat, 4);
            switch (SoundRate)
            {
            case 5512:
                w.AppendBits(0, 2);
                break;

            case 11025:
                w.AppendBits(1, 2);
                break;

            case 22050:
                w.AppendBits(2, 2);
                break;

            case 44100:
                w.AppendBits(3, 2);
                break;
            }
            w.AppendBit(SoundSize == 16U);
            w.AppendBit(IsStereo);
            w.Align();

            w.AppendUI32(SoundSampleCount);
            w.AppendBytes(SoundData);

            w.ResetLongTagLength(this.TagType, start);
        }
Esempio n. 8
0
        public void ToSwf(SwfWriter w)
        {
            // write header
            this.Header.ToSwf(w);

            for (int i = 0; i < Tags.Count; i++)
            {
                //if (i == 0x2de)//w.Position >= 0x3cd20)//
                //{
                //    i = i;
                //}
                if (Tags[i] is PlaceObject2Tag)
                {
                    bool is6Plus = this.Header.Version > 5;
                    ((PlaceObject2Tag)Tags[i]).ToSwf(w, is6Plus);
                }
                else
                {
                    Tags[i].ToSwf(w);
                }
            }

            if (Header.IsCompressed)
            {
                w.Zip();
            }

            uint len = (uint)w.Position;
            w.Position = 4;
            w.AppendUI32(len);
            w.Position = len;
        }
Esempio n. 9
0
        public void ToSwf(SwfWriter w)
        {
            uint start = (uint)w.Position;

            w.AppendTagIDAndLength(this.TagType, 0, true);

            w.AppendUI16(FontId);

            w.AppendBit(FontFlagsHasLayout);
            w.AppendBit(FontFlagsShiftJIS);
            w.AppendBit(FontFlagsSmallText);
            w.AppendBit(FontFlagsANSI);
            w.AppendBit(FontFlagsWideOffsets);
            w.AppendBit(FontFlagsWideCodes);
            w.AppendBit(FontFlagsItalic);
            w.AppendBit(FontFlagsBold);
            w.Align();

            w.AppendByte((byte)LanguageCode);
            w.AppendByte((byte)(FontName.Length + 1)); // add trailing /0
            w.AppendString(FontName, (uint)FontName.Length);

            w.AppendUI16(NumGlyphs);
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                if (this.FontFlagsWideOffsets)
                {
                    w.AppendUI32(this.OffsetTable[i]);
                }
                else
                {
                    w.AppendUI16(this.OffsetTable[i]);
                }
            }


            if (this.FontFlagsWideOffsets)
            {
                w.AppendUI32(this.CodeTableOffset);
            }
            else
            {
                w.AppendUI16(this.CodeTableOffset);
            }

            for (int i = 0; i < this.NumGlyphs; i++)
            {
                GlyphShapeTable[i].ToSwf(w);
            }

            for (int i = 0; i < this.NumGlyphs; i++)
            {
                w.AppendUI16(this.CodeTable[i]);
            }

            if (this.FontFlagsHasLayout)
            {
                w.AppendInt16(FontAscent);
                w.AppendInt16(FontDescent);
                w.AppendInt16(FontLeading);

                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    w.AppendInt16(this.FontAdvanceTable[i]);
                }

                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    this.FontBoundsTable[i].ToSwf(w);
                }

                w.AppendUI16(this.KerningCount);

                if (this.FontFlagsWideCodes)
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        w.AppendUI16(this.FontKerningTable[i].FontKerningCode1);
                        w.AppendUI16(this.FontKerningTable[i].FontKerningCode2);
                        w.AppendInt16(this.FontKerningTable[i].FontKerningAdjustment);
                    }
                }
                else
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        w.AppendByte((byte)this.FontKerningTable[i].FontKerningCode1);
                        w.AppendByte((byte)this.FontKerningTable[i].FontKerningCode2);
                        w.AppendInt16(this.FontKerningTable[i].FontKerningAdjustment);
                    }
                }
            }

            w.ResetLongTagLength(this.TagType, start, true);
        }
Esempio n. 10
0
 public void ToSwf(SwfWriter w)
 {
     uint len = 4;
     w.AppendTagIDAndLength(this.TagType, len, false);
     w.AppendUI32(this.flags);
 }
Esempio n. 11
0
        public void ToSwf(SwfWriter w)
        {
            w.AppendBits(0, 2); // reserved
            w.AppendBit(IsSyncStop);
            w.AppendBit(IsSyncNoMultiple);
            w.AppendBit(HasEnvelope);
            w.AppendBit(HasLoops);
            w.AppendBit(HasOutPoint);
            w.Align();

            if (HasInPoint)
            {
                w.AppendUI32(InPoint);
            }
            if (HasOutPoint)
            {
                w.AppendUI32(OutPoint);
            }
            if (HasLoops)
            {
                w.AppendUI16(LoopCount);
            }
            if (HasEnvelope)
            {
                w.AppendByte((byte)LoopCount);
                uint count = (uint)EnvelopeRecords.Length;
                for (int i = 0; i < EnvelopeRecords.Length; i++)
                {
                    w.AppendUI32(EnvelopeRecords[i].Pos44);
                    w.AppendUI16(EnvelopeRecords[i].LeftLevel);
                    w.AppendUI16(EnvelopeRecords[i].RightLevel);
                }
            }
        }
Esempio n. 12
0
        public void ToSwf(SwfWriter w, bool isSwf6Plus)
        {
            if ((uint)ClipEvents == 0)
            {
                if (isSwf6Plus)
                {
                    w.AppendUI32(0);
                }
                else
                {
                    w.AppendUI16(0);
                }
            }
            else
            {
                w.AppendBits((uint)ClipEvents, 32);

                uint start = (uint)w.Position;
                w.AppendUI32(0); // write len after tag written

                if ((ClipEvents & ClipEvents.KeyPress) > 0)
                {
                    w.AppendByte(KeyCode);
                }
                ActionRecords.ToSwf(w);

                uint end = (uint)w.Position;
                w.Position = start;
                w.AppendUI32(end - start - 4);
                w.Position = end;
            }
        }
Esempio n. 13
0
        public void ToSwf(SwfWriter w)
        {
            uint start = (uint)w.Position;
            w.AppendTagIDAndLength(this.TagType, 0, true);

            w.AppendUI16(SoundId);

            w.AppendBits((uint)SoundFormat, 4);
            switch (SoundRate)
            {
                case 5512:
                    w.AppendBits(0, 2);
                    break;
                case 11025:
                    w.AppendBits(1, 2);
                    break;
                case 22050:
                    w.AppendBits(2, 2);
                    break;
                case 44100:
                    w.AppendBits(3, 2);
                    break;
            }
            w.AppendBit(SoundSize == 16U);
            w.AppendBit(IsStereo);
            w.Align();

            w.AppendUI32(SoundSampleCount);
            w.AppendBytes(SoundData);

            w.ResetLongTagLength(this.TagType, start);
        }
Esempio n. 14
0
        public void ToSwf(SwfWriter w)
        {
            uint start = (uint)w.Position;
            w.AppendTagIDAndLength(this.TagType, 0, true);

            w.AppendUI16(FontId);

            w.AppendBit(FontFlagsHasLayout);
            w.AppendBit(FontFlagsShiftJIS);
            w.AppendBit(FontFlagsSmallText);
            w.AppendBit(FontFlagsANSI);
            w.AppendBit(FontFlagsWideOffsets);
            w.AppendBit(FontFlagsWideCodes);
            w.AppendBit(FontFlagsItalic);
            w.AppendBit(FontFlagsBold);
            w.Align();

            w.AppendByte((byte)LanguageCode);
            w.AppendByte((byte)(FontName.Length + 1)); // add trailing /0
            w.AppendString(FontName, (uint)FontName.Length);

            w.AppendUI16(NumGlyphs);
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                if (this.FontFlagsWideOffsets)
                {
                    w.AppendUI32(this.OffsetTable[i]);
                }
                else
                {
                    w.AppendUI16(this.OffsetTable[i]);
                }
            }

            if (this.FontFlagsWideOffsets)
            {
                w.AppendUI32(this.CodeTableOffset);
            }
            else
            {
                w.AppendUI16(this.CodeTableOffset);
            }

            for (int i = 0; i < this.NumGlyphs; i++)
            {
                GlyphShapeTable[i].ToSwf(w);
            }

            for (int i = 0; i < this.NumGlyphs; i++)
            {
                w.AppendUI16(this.CodeTable[i]);
            }

            if (this.FontFlagsHasLayout)
            {
                w.AppendInt16(FontAscent);
                w.AppendInt16(FontDescent);
                w.AppendInt16(FontLeading);

                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    w.AppendInt16(this.FontAdvanceTable[i]);
                }

                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    this.FontBoundsTable[i].ToSwf(w);
                }

                w.AppendUI16(this.KerningCount);

                if(this.FontFlagsWideCodes)
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        w.AppendUI16(this.FontKerningTable[i].FontKerningCode1);
                        w.AppendUI16(this.FontKerningTable[i].FontKerningCode2);
                        w.AppendInt16(this.FontKerningTable[i].FontKerningAdjustment);
                    }
                }
                else
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        w.AppendByte((byte)this.FontKerningTable[i].FontKerningCode1);
                        w.AppendByte((byte)this.FontKerningTable[i].FontKerningCode2);
                        w.AppendInt16(this.FontKerningTable[i].FontKerningAdjustment);
                    }
                }
            }

            w.ResetLongTagLength(this.TagType, start, true);
        }
Esempio n. 15
0
        public void ToSwf(SwfWriter w)
        {
            if (IsCompressed)
            {
                w.AppendByte((byte)'C');
            }
            else
            {
                w.AppendByte((byte)'F');
            }
            w.AppendByte((byte)'W');
            w.AppendByte((byte)'S');

            w.AppendByte(this.Version);

            w.AppendUI32(this.FileLength);
            this.FrameSize.ToSwf(w);

            ushort frateWhole = (ushort)this.FrameRate;
            uint frateDec = (((uint)this.FrameRate * 0x100) & 0xFF);
            w.AppendUI16((uint)((frateWhole << 8) + frateDec));

            w.AppendUI16(this.FrameCount);
        }
Esempio n. 16
0
        public void ToSwf(SwfWriter w)
        {
            uint start = (uint)w.Position;
            w.AppendTagIDAndLength(this.TagType, 0, true);

            w.AppendUI16(CharacterId);

            if (!HasAlphaData)
            {
                if (!HasOwnTable)
                {
                    w.AppendByte(0xFF);
                    w.AppendByte(0xD8);

                    w.AppendBytes(JpegData);

                    w.AppendByte(0xFF);
                    w.AppendByte(0xD9);
                }
                else
                {
                    w.AppendBytes(JpegData);
                }
            }
            else
            {
                w.AppendUI32((uint)JpegData.Length);
                w.AppendBytes(JpegData);

                w.AppendBytes(CompressedAlphaData);
            }

            w.ResetLongTagLength(this.TagType, start, true);
        }