Esempio n. 1
0
        public GlyphEntry[] GlyphEntries;               // GLYPHENTRY[GlyphCount]

        public TextRecord(SwfReader r, uint glyphBits, uint advanceBits, bool hasAlpha)
        {
            TextRecordType       = r.GetBit();
            StyleFlagsReserved   = r.GetBits(3);
            StyleFlagsHasFont    = r.GetBit();
            StyleFlagsHasColor   = r.GetBit();
            StyleFlagsHasYOffset = r.GetBit();
            StyleFlagsHasXOffset = r.GetBit();

            if (StyleFlagsHasFont)
            {
                FontID = r.GetUI16();
            }
            if (StyleFlagsHasColor)
            {
                TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte());
                if (hasAlpha)
                {
                    TextColor.A = r.GetByte();
                }
            }
            if (StyleFlagsHasXOffset)
            {
                XOffset = r.GetInt16();
            }
            if (StyleFlagsHasYOffset)
            {
                YOffset = r.GetInt16();
            }
            if (StyleFlagsHasFont)
            {
                TextHeight = r.GetUI16();
            }

            GlyphCount   = (uint)r.GetByte();
            GlyphEntries = new GlyphEntry[GlyphCount];
            for (int i = 0; i < GlyphCount; i++)
            {
                uint index   = r.GetBits(glyphBits);
                int  advance = r.GetSignedNBits(advanceBits);
                GlyphEntries[i] = new GlyphEntry(index, advance);
            }
            r.Align();//
        }
Esempio n. 2
0
        private bool TextRecordType; // UB[1]

        #endregion Fields

        #region Constructors

        public TextRecord(SwfReader r,  uint glyphBits, uint advanceBits, bool hasAlpha)
        {
            TextRecordType = r.GetBit();
            StyleFlagsReserved = r.GetBits(3);
            StyleFlagsHasFont = r.GetBit();
            StyleFlagsHasColor = r.GetBit();
            StyleFlagsHasYOffset = r.GetBit();
            StyleFlagsHasXOffset = r.GetBit();

            if(StyleFlagsHasFont)
            {
                FontID = r.GetUI16();
            }
            if(StyleFlagsHasColor)
            {
                TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte());
                if(hasAlpha)
                {
                    TextColor.A = r.GetByte();
                }
            }
            if(StyleFlagsHasXOffset)
            {
                XOffset = r.GetInt16();
            }
            if(StyleFlagsHasYOffset)
            {
                YOffset = r.GetInt16();
            }
            if(StyleFlagsHasFont)
            {
                TextHeight = r.GetUI16();
            }

            GlyphCount = (uint)r.GetByte();
            GlyphEntries = new GlyphEntry[GlyphCount];
            for (int i = 0; i < GlyphCount; i++)
            {
                uint index = r.GetBits(glyphBits);
                int advance = r.GetSignedNBits(advanceBits);
                GlyphEntries[i] = new GlyphEntry(index, advance);
            }
            r.Align();//
        }
Esempio n. 3
0
        public DefineEditTextTag(SwfReader r)
        {
            CharacterID = r.GetUI16();
            Bounds      = new Rect(r);

            HasText      = r.GetBit();
            WordWrap     = r.GetBit();
            Multiline    = r.GetBit();
            Password     = r.GetBit();
            ReadOnly     = r.GetBit();
            HasTextColor = r.GetBit();
            HasMaxLength = r.GetBit();
            HasFont      = r.GetBit();
            r.GetBit();            // resreved
            AutoSize  = r.GetBit();
            HasLayout = r.GetBit();
            NoSelect  = r.GetBit();
            Border    = r.GetBit();
            r.GetBit();            // resreved
            HTML        = r.GetBit();
            UseOutlines = r.GetBit();

            if (HasFont)
            {
                FontID     = r.GetUI16();
                FontHeight = r.GetUI16();
            }
            if (HasTextColor)
            {
                TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            }
            if (HasMaxLength)
            {
                MaxLength = r.GetUI16();
            }
            if (HasLayout)
            {
                Align       = (uint)r.GetByte();
                LeftMargin  = r.GetUI16();
                RightMargin = r.GetUI16();
                Indent      = r.GetUI16();
                Leading     = r.GetInt16();
            }
            VariableName = r.GetString();
            if (HasText)
            {
                InitialText = r.GetString();
            }
        }
Esempio n. 4
0
        public DefineFont2_3(SwfReader r, bool isHighRes)
        {
            this.IsHighRes = isHighRes; // true;
            if (isHighRes)
            {
                this.tagType = TagType.DefineFont3;
            }
            this.FontId               = r.GetUI16();
            this.FontFlagsHasLayout   = r.GetBit();
            this.FontFlagsShiftJIS    = r.GetBit();
            this.FontFlagsSmallText   = r.GetBit();
            this.FontFlagsANSI        = r.GetBit();
            this.FontFlagsWideOffsets = r.GetBit();
            this.FontFlagsWideCodes   = r.GetBit();
            this.FontFlagsItalic      = r.GetBit();
            this.FontFlagsBold        = r.GetBit();

            r.Align();

            this.LanguageCode = (uint)r.GetByte();
            uint fontNameLen = (uint)r.GetByte();

            this.FontName  = r.GetString(fontNameLen);
            this.NumGlyphs = r.GetUI16();

            this.OffsetTable = new uint[this.NumGlyphs];
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                this.OffsetTable[i] = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16();
            }

            this.CodeTableOffset = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16();

            GlyphShapeTable = new List <Shape>();
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                Shape s = new Shape(r);
                GlyphShapeTable.Add(s);
            }

            this.CodeTable = new uint[this.NumGlyphs];
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                this.CodeTable[i] = r.GetUI16();
            }

            if (this.FontFlagsHasLayout)
            {
                this.FontAscent  = r.GetInt16();
                this.FontDescent = r.GetInt16();
                this.FontLeading = r.GetInt16();

                this.FontAdvanceTable = new int[this.NumGlyphs];
                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    this.FontAdvanceTable[i] = r.GetInt16();
                }

                this.FontBoundsTable = new Rect[this.NumGlyphs];
                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    this.FontBoundsTable[i] = new Rect(r);
                }

                this.KerningCount = r.GetUI16();

                this.FontKerningTable = new KerningRecord[this.KerningCount];
                if (this.FontFlagsWideCodes)
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        this.FontKerningTable[i] = new KerningRecord(r.GetUI16(), r.GetUI16(), r.GetInt16());
                    }
                }
                else
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        this.FontKerningTable[i] = new KerningRecord((uint)r.GetByte(), (uint)r.GetByte(), r.GetInt16());
                    }
                }
            }
        }
Esempio n. 5
0
 public Jump(SwfReader r)
 {
     BranchOffset = r.GetInt16();
 }
Esempio n. 6
0
        public DefineEditTextTag(SwfReader r)
        {
            CharacterID = r.GetUI16();
            Bounds = new Rect(r);

            HasText = r.GetBit();
            WordWrap = r.GetBit();
            Multiline = r.GetBit();
            Password = r.GetBit();
            ReadOnly = r.GetBit();
            HasTextColor = r.GetBit();
            HasMaxLength = r.GetBit();
            HasFont = r.GetBit();
            r.GetBit();// resreved
            AutoSize = r.GetBit();
            HasLayout = r.GetBit();
            NoSelect = r.GetBit();
            Border = r.GetBit();
            r.GetBit();// resreved
            HTML = r.GetBit();
            UseOutlines = r.GetBit();

            if (HasFont)
            {
                FontID = r.GetUI16();
                FontHeight = r.GetUI16();
            }
            if (HasTextColor)
            {
                TextColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            }
            if (HasMaxLength)
            {
                MaxLength = r.GetUI16();
            }
            if (HasLayout)
            {
                Align = (uint)r.GetByte();
                LeftMargin = r.GetUI16();
                RightMargin = r.GetUI16();
                Indent = r.GetUI16();
                Leading = r.GetInt16();
            }
            VariableName = r.GetString();
            if (HasText)
            {
                InitialText = r.GetString();
            }
        }
Esempio n. 7
0
 public GotoFrame(SwfReader r)
 {
     Frame = r.GetInt16();
 }
Esempio n. 8
0
 public If(SwfReader r)
 {
     BranchOffset = r.GetInt16();
 }
Esempio n. 9
0
 public GotoFrame(SwfReader r)
 {
     Frame = r.GetInt16();
 }
Esempio n. 10
0
        private TagType tagType = TagType.DefineFont2; // may be 3

        #endregion Fields

        #region Constructors

        public DefineFont2_3(SwfReader r, bool isHighRes)
        {
            this.IsHighRes = isHighRes; // true;
            if (isHighRes)
            {
                this.tagType = TagType.DefineFont3;
            }
            this.FontId = r.GetUI16();
            this.FontFlagsHasLayout = r.GetBit();
            this.FontFlagsShiftJIS = r.GetBit();
            this.FontFlagsSmallText = r.GetBit();
            this.FontFlagsANSI = r.GetBit();
            this.FontFlagsWideOffsets = r.GetBit();
            this.FontFlagsWideCodes = r.GetBit();
            this.FontFlagsItalic = r.GetBit();
            this.FontFlagsBold = r.GetBit();

            r.Align();

            this.LanguageCode = (uint)r.GetByte();
            uint fontNameLen = (uint)r.GetByte();
            this.FontName = r.GetString(fontNameLen);
            this.NumGlyphs = r.GetUI16();

            this.OffsetTable = new uint[this.NumGlyphs];
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                this.OffsetTable[i] = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16();
            }

            this.CodeTableOffset = this.FontFlagsWideOffsets ? r.GetUI32() : r.GetUI16();

            GlyphShapeTable = new List<Shape>();
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                Shape s = new Shape(r);
                GlyphShapeTable.Add(s);
            }

            this.CodeTable = new uint[this.NumGlyphs];
            for (int i = 0; i < this.NumGlyphs; i++)
            {
                this.CodeTable[i] = r.GetUI16();
            }

            if (this.FontFlagsHasLayout)
            {
                this.FontAscent = r.GetInt16();
                this.FontDescent = r.GetInt16();
                this.FontLeading = r.GetInt16();

                this.FontAdvanceTable = new int[this.NumGlyphs];
                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    this.FontAdvanceTable[i] = r.GetInt16();
                }

                this.FontBoundsTable = new Rect[this.NumGlyphs];
                for (int i = 0; i < this.NumGlyphs; i++)
                {
                    this.FontBoundsTable[i] = new Rect(r);
                }

                this.KerningCount = r.GetUI16();

                this.FontKerningTable = new KerningRecord[this.KerningCount];
                if(this.FontFlagsWideCodes)
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        this.FontKerningTable[i] = new KerningRecord(r.GetUI16(), r.GetUI16(), r.GetInt16());
                    }
                }
                else
                {
                    for (int i = 0; i < this.KerningCount; i++)
                    {
                        this.FontKerningTable[i] = new KerningRecord((uint)r.GetByte(), (uint)r.GetByte(), r.GetInt16());
                    }
                }
            }
        }