Ejemplo n.º 1
0
        public DefineSoundTag(SwfReader r, uint tagLen)
        {
            SoundId = r.GetUI16();
            SoundFormat = (SoundCompressionType)r.GetBits(4);
            uint sr = r.GetBits(2);
            switch (sr)
            {
                case 0:
                    SoundRate = 5512; // ?
                    break;
                case 1:
                    SoundRate = 11025;
                    break;
                case 2:
                    SoundRate = 22050;
                    break;
                case 3:
                    SoundRate = 44100;
                    break;
            }
            SoundSize = r.GetBit() ? 16U : 8U;
            IsStereo = r.GetBit();
            r.Align();

            SoundSampleCount = r.GetUI32();
            // todo: this needs to decompress if mp3 etc
            SoundData = r.GetBytes(tagLen - 7);
        }
Ejemplo n.º 2
0
 public DefineShape3Tag(SwfReader r)
 {
     this.ShapeId = r.GetUI16();
     this.ShapeBounds = new Rect(r);
     this.Shapes = new ShapeWithStyle(r, ShapeType.DefineShape3);
     r.Align();
 }
Ejemplo n.º 3
0
        public FilterGradientGlow(SwfReader r)
        {
            NumColors = (uint)r.GetByte();
            GradientColors = new RGBA[NumColors];
            for (int i = 0; i < NumColors; i++)
            {
                GradientColors[i] = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            }

            GradientRatio = new uint[NumColors];
            for (int i = 0; i < NumColors; i++)
            {
                GradientRatio[i] = (uint)r.GetByte();
            }

            BlurX = r.GetFixed16_16();
            BlurY = r.GetFixed16_16();
            Angle = r.GetFixed16_16();
            Distance = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerShadow = r.GetBit();
            Knockout = r.GetBit();
            CompositeSource = r.GetBit();
            OnTop = r.GetBit();
            Passes = r.GetBits(4);

            r.Align();
        }
Ejemplo n.º 4
0
        public FilterGradientGlow(SwfReader r)
        {
            NumColors      = (uint)r.GetByte();
            GradientColors = new RGBA[NumColors];
            for (int i = 0; i < NumColors; i++)
            {
                GradientColors[i] = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            }

            GradientRatio = new uint[NumColors];
            for (int i = 0; i < NumColors; i++)
            {
                GradientRatio[i] = (uint)r.GetByte();
            }

            BlurX    = r.GetFixed16_16();
            BlurY    = r.GetFixed16_16();
            Angle    = r.GetFixed16_16();
            Distance = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerShadow     = r.GetBit();
            Knockout        = r.GetBit();
            CompositeSource = r.GetBit();
            OnTop           = r.GetBit();
            Passes          = r.GetBits(4);

            r.Align();
        }
Ejemplo n.º 5
0
 public DefineShape3Tag(SwfReader r)
 {
     this.ShapeId     = r.GetUI16();
     this.ShapeBounds = new Rect(r);
     this.Shapes      = new ShapeWithStyle(r, ShapeType.DefineShape3);
     r.Align();
 }
Ejemplo n.º 6
0
        public DefineSoundTag(SwfReader r, uint tagLen)
        {
            SoundId     = r.GetUI16();
            SoundFormat = (SoundCompressionType)r.GetBits(4);
            uint sr = r.GetBits(2);

            switch (sr)
            {
            case 0:
                SoundRate = 5512;                         // ?
                break;

            case 1:
                SoundRate = 11025;
                break;

            case 2:
                SoundRate = 22050;
                break;

            case 3:
                SoundRate = 44100;
                break;
            }
            SoundSize = r.GetBit() ? 16U : 8U;
            IsStereo  = r.GetBit();
            r.Align();

            SoundSampleCount = r.GetUI32();
            // todo: this needs to decompress if mp3 etc
            SoundData = r.GetBytes(tagLen - 7);
        }
Ejemplo n.º 7
0
 public GetURL2(SwfReader r)
 {
     SendVarsMethod = (SendVarsMethod)r.GetBits(2);
     r.GetBits(4);             // reserved
     TargetIsSprite = r.GetBit();
     LoadVariables  = r.GetBit();
     r.Align();
 }
Ejemplo n.º 8
0
        public ShapeWithStyle(SwfReader r, ShapeType shapeType)
        {
            this.shapeType = shapeType;

            // parse fill defs
            FillStyles = new FillStyleArray(r, shapeType);

            // parse line defs
            LineStyles = new LineStyleArray(r, shapeType);

            r.Align();
            fillBits = r.GetBits(4);
            lineBits = r.GetBits(4);
            r.Align();

            ParseShapeRecords(r);
        }
Ejemplo n.º 9
0
 public FilterBlur(SwfReader r)
 {
     BlurX  = r.GetFixed16_16();
     BlurY  = r.GetFixed16_16();
     Passes = r.GetBits(5);
     r.GetBits(3);             // reserved
     r.Align();
 }
Ejemplo n.º 10
0
        public ShapeWithStyle(SwfReader r, ShapeType shapeType)
        {
            this.shapeType = shapeType;

            // parse fill defs
            FillStyles = new FillStyleArray(r, shapeType);

            // parse line defs
            LineStyles = new LineStyleArray(r, shapeType);

            r.Align();
            fillBits = r.GetBits(4);
            lineBits = r.GetBits(4);
            r.Align();

            ParseShapeRecords(r);
        }
Ejemplo n.º 11
0
 public FilterBlur(SwfReader r)
 {
     BlurX = r.GetFixed16_16();
     BlurY = r.GetFixed16_16();
     Passes = r.GetBits(5);
     r.GetBits(3); // reserved
     r.Align();
 }
Ejemplo n.º 12
0
        // only used for glyphs
        public Shape(SwfReader r)
        {
            r.Align();
            fillBits = r.GetBits(4); // always one
            lineBits = r.GetBits(4); // always zero

            ParseShapeRecords(r);
        }
Ejemplo n.º 13
0
        // only used for glyphs
        public Shape(SwfReader r)
        {
            r.Align();
            fillBits = r.GetBits(4);             // always one
            lineBits = r.GetBits(4);             // always zero

            ParseShapeRecords(r);
        }
Ejemplo n.º 14
0
        public bool TargetIsSprite; // or sprite

        #endregion Fields

        #region Constructors

        public GetURL2(SwfReader r)
        {
            SendVarsMethod = (SendVarsMethod)r.GetBits(2);
            r.GetBits(4); // reserved
            TargetIsSprite = r.GetBit();
            LoadVariables = r.GetBit();
            r.Align();
        }
Ejemplo n.º 15
0
 public Rect(SwfReader r)
 {
     byte minBits = (byte)r.GetBits(5);
     XMin = r.GetSignedNBits(minBits);
     XMax = r.GetSignedNBits(minBits);
     YMin = r.GetSignedNBits(minBits);
     YMax = r.GetSignedNBits(minBits);
     r.Align();
 }
Ejemplo n.º 16
0
        public Rect(SwfReader r)
        {
            byte minBits = (byte)r.GetBits(5);

            XMin = r.GetSignedNBits(minBits);
            XMax = r.GetSignedNBits(minBits);
            YMin = r.GetSignedNBits(minBits);
            YMax = r.GetSignedNBits(minBits);
            r.Align();
        }
Ejemplo n.º 17
0
        public DefineShape4Tag(SwfReader r)
        {
            this.ShapeId = r.GetUI16();
            this.ShapeBounds = new Rect(r);
            this.EdgeBounds = new Rect(r);

            r.SkipBits(6);
            this.UsesNonScalingStrokes = r.GetBit();
            this.UsesScalingStrokes = r.GetBit();
            this.Shapes = new ShapeWithStyle(r, ShapeType.DefineShape4);
            r.Align();
        }
Ejemplo n.º 18
0
        public DefineShape4Tag(SwfReader r)
        {
            this.ShapeId     = r.GetUI16();
            this.ShapeBounds = new Rect(r);
            this.EdgeBounds  = new Rect(r);

            r.SkipBits(6);
            this.UsesNonScalingStrokes = r.GetBit();
            this.UsesScalingStrokes    = r.GetBit();
            this.Shapes = new ShapeWithStyle(r, ShapeType.DefineShape4);
            r.Align();
        }
Ejemplo n.º 19
0
        public Matrix(SwfReader r)
        {
            float sx = 1.0F;
            float sy = 1.0F;
            float r0 = 0.0F;
            float r1 = 0.0F;
            float tx = 0.0F;
            float ty = 0.0F;

            r.Align();
            bool hasScale = r.GetBit();

            if (hasScale)
            {
                uint scaleBits = r.GetBits(5);
                sx = r.GetFixedNBits(scaleBits);
                sy = r.GetFixedNBits(scaleBits);
            }
            bool hasRotate = r.GetBit();

            if (hasRotate)
            {
                uint nRotateBits = r.GetBits(5);
                r0 = r.GetFixedNBits(nRotateBits);
                r1 = r.GetFixedNBits(nRotateBits);
            }
            // always has translation
            uint nTranslateBits = r.GetBits(5);

            tx = r.GetSignedNBits(nTranslateBits);
            ty = r.GetSignedNBits(nTranslateBits);
            r.Align();

            this.ScaleX     = sx;
            this.Rotate0    = r0;
            this.Rotate1    = r1;
            this.ScaleY     = sy;
            this.TranslateX = tx;
            this.TranslateY = ty;
        }
Ejemplo n.º 20
0
        public CSMTextSettingsTag(SwfReader r)
        {
            TextId = r.GetUI16();
            UseFlashType = r.GetBits(2);
            GridFit = r.GetBits(3);
            r.GetBits(3); // reserved
            r.Align();

            Thickness = r.GetFixedNBits(32);
            Sharpness = r.GetFixedNBits(32);

            r.GetByte(); // reserved
        }
Ejemplo n.º 21
0
        public ZoneRecord(SwfReader r)
        {
            NumZoneData = r.GetByte();
            AlignmentCoordinate1 = r.GetFixedNBits(16);
            Range1 = r.GetFixedNBits(16);
            AlignmentCoordinate2 = r.GetFixedNBits(16);
            Range2 = r.GetFixedNBits(16);

            r.GetBits(6); // reserved
            ZoneMaskX = r.GetBit();
            ZoneMaskY = r.GetBit();
            r.Align();
        }
Ejemplo n.º 22
0
        public CSMTextSettingsTag(SwfReader r)
        {
            TextId       = r.GetUI16();
            UseFlashType = r.GetBits(2);
            GridFit      = r.GetBits(3);
            r.GetBits(3);             // reserved
            r.Align();

            Thickness = r.GetFixedNBits(32);
            Sharpness = r.GetFixedNBits(32);

            r.GetByte();             // reserved
        }
Ejemplo n.º 23
0
        public ZoneRecord(SwfReader r)
        {
            NumZoneData          = r.GetByte();
            AlignmentCoordinate1 = r.GetFixedNBits(16);
            Range1 = r.GetFixedNBits(16);
            AlignmentCoordinate2 = r.GetFixedNBits(16);
            Range2 = r.GetFixedNBits(16);

            r.GetBits(6); // reserved
            ZoneMaskX = r.GetBit();
            ZoneMaskY = r.GetBit();
            r.Align();
        }
Ejemplo n.º 24
0
 public GotoFrame2(SwfReader r)
 {
     r.GetBits(6);             // reserved
     SceneBiasFlag = r.GetBit();
     PlayFlag      = r.GetBit();
     r.Align();
     if (SceneBiasFlag)
     {
         SceneBias = r.GetUI16();
     }
     else
     {
         SceneBias = 0;
     }
 }
Ejemplo n.º 25
0
 public GotoFrame2(SwfReader r)
 {
     r.GetBits(6); // reserved
     SceneBiasFlag = r.GetBit();
     PlayFlag = r.GetBit();
     r.Align();
     if (SceneBiasFlag)
     {
         SceneBias = r.GetUI16();
     }
     else
     {
         SceneBias = 0;
     }
 }
Ejemplo n.º 26
0
        public FilterGlow(SwfReader r)
        {
            GlowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            BlurX    = r.GetFixed16_16();
            BlurY    = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerGlow       = r.GetBit();
            Knockout        = r.GetBit();
            CompositeSource = r.GetBit();
            Passes          = r.GetBits(5);

            r.Align();
        }
Ejemplo n.º 27
0
        public FilterGlow(SwfReader r)
        {
            GlowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            BlurX = r.GetFixed16_16();
            BlurY = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerGlow = r.GetBit();
            Knockout = r.GetBit();
            CompositeSource = r.GetBit();
            Passes = r.GetBits(5);

            r.Align();
        }
Ejemplo n.º 28
0
        public FilterDropShadow(SwfReader r)
        {
            DropShadowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            BlurX    = r.GetFixed16_16();
            BlurY    = r.GetFixed16_16();
            Angle    = r.GetFixed16_16();
            Distance = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerShadow     = r.GetBit();
            Knockout        = r.GetBit();
            CompositeSource = r.GetBit();
            Passes          = (uint)r.GetBits(5);

            r.Align();
        }
Ejemplo n.º 29
0
        public FilterDropShadow(SwfReader r)
        {
            DropShadowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            BlurX = r.GetFixed16_16();
            BlurY = r.GetFixed16_16();
            Angle = r.GetFixed16_16();
            Distance = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerShadow = r.GetBit();
            Knockout = r.GetBit();
            CompositeSource = r.GetBit();
            Passes = (uint)r.GetBits(5);

            r.Align();
        }
Ejemplo n.º 30
0
        public DefineFontAlignZonesTag(SwfReader r, Dictionary <uint, DefineFont2_3> fonts)
        {
            Fonts = fonts;

            FontId       = r.GetUI16();
            CSMTableHint = r.GetBits(2);
            r.SkipBits(6);
            r.Align();

            DefineFont2_3 font       = Fonts[FontId];
            uint          glyphCount = font.NumGlyphs;

            ZoneTable = new ZoneRecord[glyphCount];
            for (int i = 0; i < glyphCount; i++)
            {
                ZoneTable[i] = new ZoneRecord(r);
            }
        }
Ejemplo n.º 31
0
        public DefineFontAlignZonesTag(SwfReader r, Dictionary<uint, DefineFont2_3> fonts)
        {
            Fonts = fonts;

            FontId = r.GetUI16();
            CSMTableHint = r.GetBits(2);
            r.SkipBits(6);
            r.Align();

            DefineFont2_3 font = Fonts[FontId];
            uint glyphCount = font.NumGlyphs;

            ZoneTable = new ZoneRecord[glyphCount];
            for (int i = 0; i < glyphCount; i++)
            {
                ZoneTable[i] = new ZoneRecord(r);
            }
        }
Ejemplo n.º 32
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();//
        }
Ejemplo n.º 33
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();//
        }
Ejemplo n.º 34
0
        public FilterBevel(SwfReader r)
        {
            ShadowColor    = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            HighlightColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            BlurX    = r.GetFixed16_16();
            BlurY    = r.GetFixed16_16();
            Angle    = r.GetFixed16_16();
            Distance = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerShadow     = r.GetBit();
            Knockout        = r.GetBit();
            CompositeSource = r.GetBit();
            OnTop           = r.GetBit();
            Passes          = r.GetBits(4);

            r.Align();
        }
Ejemplo n.º 35
0
        public FilterBevel(SwfReader r)
        {
            ShadowColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());
            HighlightColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            BlurX = r.GetFixed16_16();
            BlurY = r.GetFixed16_16();
            Angle = r.GetFixed16_16();
            Distance = r.GetFixed16_16();
            Strength = r.GetFixed8_8();

            InnerShadow = r.GetBit();
            Knockout = r.GetBit();
            CompositeSource = r.GetBit();
            OnTop = r.GetBit();
            Passes = r.GetBits(4);

            r.Align();
        }
Ejemplo n.º 36
0
        public SoundInfo(SwfReader r)
        {
            r.GetBits(2); // reserved

            IsSyncStop = r.GetBit();
            IsSyncNoMultiple = r.GetBit();
            HasEnvelope = r.GetBit();
            HasLoops = r.GetBit();
            HasOutPoint = r.GetBit();

            r.Align();
            if(HasInPoint)
            {
                InPoint = r.GetUI32();
            }
            if(HasOutPoint)
            {
                OutPoint = r.GetUI32();
            }
            if(HasLoops)
            {
                LoopCount = r.GetUI16();
            }
            if(HasEnvelope)
            {
                uint count = (uint)r.GetByte();

                uint pos;
                uint left;
                uint right;
                EnvelopeRecords = new SoundEnvelope[count];
                for (int i = 0; i < count; i++)
                {
                    pos = r.GetUI32();
                    left = r.GetUI16();
                    right = r.GetUI16();
                    EnvelopeRecords[i] = new SoundEnvelope(pos, left, right);
                }
            }
        }
Ejemplo n.º 37
0
        public SoundInfo(SwfReader r)
        {
            r.GetBits(2);             // reserved

            IsSyncStop       = r.GetBit();
            IsSyncNoMultiple = r.GetBit();
            HasEnvelope      = r.GetBit();
            HasLoops         = r.GetBit();
            HasOutPoint      = r.GetBit();

            r.Align();
            if (HasInPoint)
            {
                InPoint = r.GetUI32();
            }
            if (HasOutPoint)
            {
                OutPoint = r.GetUI32();
            }
            if (HasLoops)
            {
                LoopCount = r.GetUI16();
            }
            if (HasEnvelope)
            {
                uint count = (uint)r.GetByte();

                uint pos;
                uint left;
                uint right;
                EnvelopeRecords = new SoundEnvelope[count];
                for (int i = 0; i < count; i++)
                {
                    pos   = r.GetUI32();
                    left  = r.GetUI16();
                    right = r.GetUI16();
                    EnvelopeRecords[i] = new SoundEnvelope(pos, left, right);
                }
            }
        }
Ejemplo n.º 38
0
        public FilterConvolution(SwfReader r)
        {
            MatrixX = (uint)r.GetByte();
            MatrixY = (uint)r.GetByte();
            Divisor = r.GetFloat32();
            Bias = r.GetFloat32();

            uint mxCount = MatrixX * MatrixY;
            Matrix = new float[mxCount];
            for (int i = 0; i < mxCount; i++)
            {
                Matrix[i] = r.GetFloat32();
            }

            DefaultColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            r.GetBits(6);
            Clamp = r.GetBit();
            PreserveAlpha = r.GetBit();

            r.Align();
        }
Ejemplo n.º 39
0
        public FilterConvolution(SwfReader r)
        {
            MatrixX = (uint)r.GetByte();
            MatrixY = (uint)r.GetByte();
            Divisor = r.GetFloat32();
            Bias    = r.GetFloat32();

            uint mxCount = MatrixX * MatrixY;

            Matrix = new float[mxCount];
            for (int i = 0; i < mxCount; i++)
            {
                Matrix[i] = r.GetFloat32();
            }

            DefaultColor = new RGBA(r.GetByte(), r.GetByte(), r.GetByte(), r.GetByte());

            r.GetBits(6);
            Clamp         = r.GetBit();
            PreserveAlpha = r.GetBit();

            r.Align();
        }
Ejemplo n.º 40
0
        public Matrix(SwfReader r)
        {
            float sx = 1.0F;
            float sy = 1.0F;
            float r0 = 0.0F;
            float r1 = 0.0F;
            float tx = 0.0F;
            float ty = 0.0F;
            r.Align();
            bool hasScale = r.GetBit();
            if (hasScale)
            {
                uint scaleBits = r.GetBits(5);
                sx = r.GetFixedNBits(scaleBits);
                sy = r.GetFixedNBits(scaleBits);
            }
            bool hasRotate = r.GetBit();
            if (hasRotate)
            {
                uint nRotateBits = r.GetBits(5);
                r0 = r.GetFixedNBits(nRotateBits);
                r1 = r.GetFixedNBits(nRotateBits);
            }
            // always has translation
            uint nTranslateBits = r.GetBits(5);
            tx = r.GetSignedNBits(nTranslateBits);
            ty = r.GetSignedNBits(nTranslateBits);
            r.Align();

            this.ScaleX = sx;
            this.Rotate0 = r0;
            this.Rotate1 = r1;
            this.ScaleY = sy;
            this.TranslateX = tx;
            this.TranslateY = ty;
        }
Ejemplo n.º 41
0
        public ColorTransform(SwfReader r, bool useAlpha)
        {
            this.HasAddTerms  = r.GetBit();
            this.HasMultTerms = r.GetBit();
            uint nbits = r.GetBits(4);

            if (HasMultTerms)
            {
                RMultTerm = r.GetSignedNBits(nbits);
                GMultTerm = r.GetSignedNBits(nbits);
                BMultTerm = r.GetSignedNBits(nbits);
                AMultTerm = (useAlpha) ? r.GetSignedNBits(nbits) : 0xFF;
            }
            else
            {
                RMultTerm = 0;
                GMultTerm = 0;
                BMultTerm = 0;
                AMultTerm = 0;
            }
            if (HasAddTerms)
            {
                RAddTerm = r.GetSignedNBits(nbits);
                GAddTerm = r.GetSignedNBits(nbits);
                BAddTerm = r.GetSignedNBits(nbits);
                AAddTerm = (useAlpha) ? r.GetSignedNBits(nbits) : 0xFF;
            }
            else
            {
                RAddTerm = 0;
                GAddTerm = 0;
                BAddTerm = 0;
                AAddTerm = 0;
            }
            r.Align();
        }
Ejemplo n.º 42
0
        public SoundStreamHeadTag(SwfReader r)
        {
            SoundId = soundIdCounter++;

            r.GetBits(4);             // reserved

            PlaybackSoundRate      = rates[r.GetBits(2)];
            PlaybackSoundSize      = r.GetBit() ? 16u : 0u;
            IsStereo               = r.GetBit();
            StreamSoundCompression = (SoundCompressionType)r.GetBits(4);             // Mp3 == 2

            StreamSoundRate = rates[r.GetBits(2)];
            StreamSoundSize = r.GetBit() ? 16u : 8u;
            StreamIsStereo  = r.GetBit();

            r.Align();

            StreamSoundSampleCount = r.GetUI16();

            if (StreamSoundCompression == SoundCompressionType.MP3)
            {
                LatencySeek = r.GetUI16();
            }
        }
Ejemplo n.º 43
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());
                    }
                }
            }
        }
Ejemplo n.º 44
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());
                    }
                }
            }
        }
Ejemplo n.º 45
0
        public SoundStreamHeadTag(SwfReader r)
        {
            SoundId = soundIdCounter++;

            r.GetBits(4); // reserved

            PlaybackSoundRate = rates[r.GetBits(2)];
            PlaybackSoundSize = r.GetBit() ? 16u : 0u;
            IsStereo = r.GetBit();
            StreamSoundCompression = (SoundCompressionType)r.GetBits(4); // Mp3 == 2

            StreamSoundRate = rates[r.GetBits(2)];
            StreamSoundSize = r.GetBit() ? 16u : 8u;
            StreamIsStereo = r.GetBit();

            r.Align();

            StreamSoundSampleCount = r.GetUI16();

            if (StreamSoundCompression == SoundCompressionType.MP3)
            {
                LatencySeek = r.GetUI16();
            }
        }
Ejemplo n.º 46
0
        public ColorTransform(SwfReader r, bool useAlpha)
        {
            this.HasAddTerms = r.GetBit();
            this.HasMultTerms = r.GetBit();
            uint nbits = r.GetBits(4);

            if (HasMultTerms)
            {
                RMultTerm = r.GetSignedNBits(nbits);
                GMultTerm = r.GetSignedNBits(nbits);
                BMultTerm = r.GetSignedNBits(nbits);
                AMultTerm = (useAlpha) ? r.GetSignedNBits(nbits) : 0xFF;
            }
            else
            {
                RMultTerm = 0;
                GMultTerm = 0;
                BMultTerm = 0;
                AMultTerm = 0;
            }
            if (HasAddTerms)
            {
                RAddTerm = r.GetSignedNBits(nbits);
                GAddTerm = r.GetSignedNBits(nbits);
                BAddTerm = r.GetSignedNBits(nbits);
                AAddTerm = (useAlpha) ? r.GetSignedNBits(nbits) : 0xFF;
            }
            else
            {
                RAddTerm = 0;
                GAddTerm = 0;
                BAddTerm = 0;
                AAddTerm = 0;
            }
            r.Align();
        }