コード例 #1
0
        private MorphLineStyle ReadMorphLineStyle2(SWFDataTypeReader shapeReader)
        {
            int startwidth = shapeReader.ReadUI16();
            int endwidth   = shapeReader.ReadUI16();

            CapStyle  startCap = (CapStyle)shapeReader.ReadUBits(2);
            JoinStyle join     = (JoinStyle)shapeReader.ReadUBits(2);

            bool hasFill       = shapeReader.ReadBit();
            bool noHScaling    = shapeReader.ReadBit();
            bool noVScaling    = shapeReader.ReadBit();
            bool hasPixelHints = shapeReader.ReadBit();

            shapeReader.ReadUBits(5); // Reserved: 0
            bool noClose = shapeReader.ReadBit();

            CapStyle endCap = (CapStyle)shapeReader.ReadUBits(2);

            int?miterLimit = null;

            if (join == JoinStyle.Miter)
            {
                miterLimit = shapeReader.ReadUI16();
            }

            Color?         startColour = null;
            Color?         endColour   = null;
            MorphFillStyle fs          = null;

            if (hasFill)
            {
                fs = this.ReadMorphFillStyle(shapeReader);
            }
            else
            {
                startColour = shapeReader.ReadRGBA();
                endColour   = shapeReader.ReadRGBA();
            }

            return(new MorphLineStyle()
            {
                StartWidth = startwidth,
                EndWidth = endwidth,
                StartColour = startColour,
                EndColour = endColour,
                StartCap = startCap,
                EndCap = endCap,
                Join = join,
                HasFill = hasFill,
                NoHScaling = noHScaling,
                NoVScaling = noVScaling,
                HasPixelHints = hasPixelHints,
                FillStyle = fs,
                MiterLimit = miterLimit
            });
        }
コード例 #2
0
 private MorphLineStyle ReadMorphLineStyle(SWFDataTypeReader shapeReader)
 {
     return(new MorphLineStyle()
     {
         StartWidth = shapeReader.ReadUI16(),
         EndWidth = shapeReader.ReadUI16(),
         StartColour = shapeReader.ReadRGBA(),
         EndColour = shapeReader.ReadRGBA()
     });
 }
コード例 #3
0
        private LineStyle ReadLineStyle2(SWFDataTypeReader shapeReader, Tag format)
        {
            int       width         = shapeReader.ReadUI16();
            CapStyle  startCap      = (CapStyle)shapeReader.ReadUBits(2);
            JoinStyle join          = (JoinStyle)shapeReader.ReadUBits(2);
            bool      hasFill       = shapeReader.ReadBit();
            bool      noHScaling    = shapeReader.ReadBit();
            bool      noVScaling    = shapeReader.ReadBit();
            bool      hasPixelHints = shapeReader.ReadBit();

            shapeReader.ReadUBits(5); /* Reserved: 0 */
            bool     noClose = shapeReader.ReadBit();
            CapStyle endCap  = (CapStyle)shapeReader.ReadUBits(2);

            int?miterLimit = null;

            if (join == JoinStyle.Miter)
            {
                miterLimit = shapeReader.ReadUI16();
            }

            Color?    c  = null;
            FillStyle fs = null;

            if (hasFill)
            {
                fs = this.ReadFillStyle(shapeReader, format);
            }
            else
            {
                c = shapeReader.ReadRGBA();
            }

            return(new LineStyle()
            {
                Width = width,
                StartCap = startCap,
                EndCap = endCap,
                Join = join,
                HasFill = hasFill,
                NoHScaling = noHScaling,
                NoVScaling = noVScaling,
                HasPixelHints = hasPixelHints,
                Colour = c,
                FillStyle = fs,
                MiterLimit = miterLimit
            });
        }
コード例 #4
0
        private MorphLineStyle[] ReadMorphLineStyleArray(SWFDataTypeReader shapeReader, Tag format)
        {
            int lineCount = shapeReader.ReadUI8();

            if (lineCount == 0xFF)
            {
                lineCount = shapeReader.ReadUI16();
            }

            MorphLineStyle[] lineStyles = new MorphLineStyle[lineCount];
            if (format == Tag.DefineMorphShape)
            {
                for (int i = 0; i < lineCount; i++)
                {
                    lineStyles[i] = this.ReadMorphLineStyle(shapeReader);
                }
            }
            else /* Else Tag.DefineMorphShape2 */
            {
                for (int i = 0; i < lineCount; i++)
                {
                    lineStyles[i] = this.ReadMorphLineStyle2(shapeReader);
                }
            }

            return(lineStyles);
        }
コード例 #5
0
        private LineStyle[] ReadLineStyleArray(SWFDataTypeReader shapeReader, Tag format)
        {
            int lineCount = shapeReader.ReadUI8();

            if (lineCount == 0xFF)
            {
                lineCount = shapeReader.ReadUI16();
            }

            LineStyle[] lineStyles = new LineStyle[lineCount];
            if (format == Tag.DefineShape4)
            {
                for (int i = 0; i < lineCount; i++)
                {
                    lineStyles[i] = this.ReadLineStyle2(shapeReader, format);
                }
            }
            else
            {
                for (int i = 0; i < lineCount; i++)
                {
                    lineStyles[i] = this.ReadLineStyle(shapeReader, format);
                }
            }

            return(lineStyles);
        }
コード例 #6
0
        private FillStyle ReadFillStyle(SWFDataTypeReader shapeReader, Tag format)
        {
            FillStyle style = new FillStyle();

            style.Type = (FillType)shapeReader.ReadUI8();

            if (style.Type == FillType.Solid)
            {
                if (format == Tag.DefineShape3 || format == Tag.DefineShape4) /* Assuming shape4 goes here. Spec is ambiguous. */
                {
                    style.Colour = shapeReader.ReadRGBA();
                }
                else if (format == Tag.DefineShape || format == Tag.DefineShape2)
                {
                    style.Colour = shapeReader.ReadRGB();
                }
                else
                {
                    throw new SWFModellerException(SWFModellerError.SWFParsing, "Bad tag format for fill style");
                }
            }

            if (style.Type == FillType.LinearGradient ||
                style.Type == FillType.RadialGradient ||
                style.Type == FillType.FocalGradient)
            {
                style.FillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();

                if (style.Type == FillType.LinearGradient ||
                    style.Type == FillType.RadialGradient)
                {
                    style.Gradient = this.ReadGradient(shapeReader, format);
                }
                else /* FocalGradient */
                {
                    style.Gradient = this.ReadFocalGradient(shapeReader);
                }
            }

            if (FillTypes.IsBitmap(style.Type))
            {
                int cid = shapeReader.ReadUI16();

                /* Some fills have this magic number in them which seems to deliberately not
                 * reference a bitmap. The spec is silent on the matter. Oh flash, you
                 * stammering ape. */
                if (cid != 0x0000FFFF)
                {
                    style.Bitmap = this.ImageFinder.FindImage(cid);
                }

                style.FillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();
            }

            return(style);
        }
コード例 #7
0
        private MorphFillStyle ReadMorphFillStyle(SWFDataTypeReader shapeReader)
        {
            MorphFillStyle style = new MorphFillStyle();

            style.Type = (FillType)shapeReader.ReadUI8();

            if (style.Type == FillType.Solid)
            {
                style.StartColour = shapeReader.ReadRGBA();
                style.EndColour   = shapeReader.ReadRGBA();
            }

            if (style.Type == FillType.LinearGradient ||
                style.Type == FillType.RadialGradient)
            {
                style.StartFillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();

                style.EndFillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();

                if (style.Type == FillType.LinearGradient ||
                    style.Type == FillType.RadialGradient)
                {
                    style.Gradient = this.ReadMorphGradient(shapeReader);
                }
            }

            if (FillTypes.IsBitmap(style.Type))
            {
                int cid = shapeReader.ReadUI16();

                /* Some fills have this magic number in them which seems to deliberately not
                 * reference a bitmap. The spec is silent on the matter. Oh flash, you
                 * bumbling simian. */
                if (cid != 0x0000FFFF)
                {
                    style.Bitmap = this.ImageFinder.FindImage(cid);
                }

                style.StartFillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();

                style.EndFillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();
            }

            return(style);
        }
コード例 #8
0
        /* ISSUE 20: Instead of passing the format and reader around, perhaps they should be
         * members? Perhaps? Hmm? */
        private FillStyle[] ReadFillStyleArray(SWFDataTypeReader shapeReader, Tag format)
        {
            int fillCount = shapeReader.ReadUI8();

            if (fillCount == 0xFF && (format == Tag.DefineShape3 || format == Tag.DefineShape2))
            {
                fillCount = shapeReader.ReadUI16();
            }

            FillStyle[] fillStyles = new FillStyle[fillCount];
            for (int i = 0; i < fillCount; i++)
            {
                fillStyles[i] = this.ReadFillStyle(shapeReader, format);
            }

            return(fillStyles);
        }
コード例 #9
0
        private MorphFillStyle[] ReadMorphFillStyleArray(SWFDataTypeReader shapeReader)
        {
            int fillCount = shapeReader.ReadUI8();

            if (fillCount == 0xFF)
            {
                fillCount = shapeReader.ReadUI16();
            }

            MorphFillStyle[] fillStyles = new MorphFillStyle[fillCount];
            for (int i = 0; i < fillCount; i++)
            {
                fillStyles[i] = this.ReadMorphFillStyle(shapeReader);
            }

            return(fillStyles);
        }
コード例 #10
0
        private LineStyle ReadLineStyle(SWFDataTypeReader shapeReader, Tag format)
        {
            LineStyle ls = new LineStyle();

            ls.Width = shapeReader.ReadUI16();

            if (format == Tag.DefineShape || format == Tag.DefineShape2)
            {
                ls.Colour = shapeReader.ReadRGB();
            }
            else if (format == Tag.DefineShape3 || format == Tag.DefineShape4)
            {
                ls.Colour = shapeReader.ReadRGBA();
            }
            else
            {
                throw new SWFModellerException(SWFModellerError.Internal, "Can't line style in shape format " + format.ToString());
            }

            return(ls);
        }
コード例 #11
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
        private FillStyle ReadFillStyle(SWFDataTypeReader shapeReader, Tag format)
        {
            FillStyle style = new FillStyle();

            style.Type = (FillType)shapeReader.ReadUI8();

            if (style.Type == FillType.Solid)
            {
                if (format == Tag.DefineShape3 || format == Tag.DefineShape4) /* Assuming shape4 goes here. Spec is ambiguous. */
                {
                    style.Colour = shapeReader.ReadRGBA();
                }
                else if (format == Tag.DefineShape || format == Tag.DefineShape2)
                {
                    style.Colour = shapeReader.ReadRGB();
                }
                else
                {
                    throw new SWFModellerException(SWFModellerError.SWFParsing, "Bad tag format for fill style");
                }
            }

            if (style.Type == FillType.LinearGradient
                    || style.Type == FillType.RadialGradient
                    || style.Type == FillType.FocalGradient)
            {
                style.FillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();

                if (style.Type == FillType.LinearGradient
                        || style.Type == FillType.RadialGradient)
                {
                    style.Gradient = this.ReadGradient(shapeReader, format);
                }
                else /* FocalGradient */
                {
                    style.Gradient = this.ReadFocalGradient(shapeReader);
                }
            }

            if (FillTypes.IsBitmap(style.Type))
            {
                int cid = shapeReader.ReadUI16();
                /* Some fills have this magic number in them which seems to deliberately not
                 * reference a bitmap. The spec is silent on the matter. Oh flash, you
                 * stammering ape. */
                if (cid != 0x0000FFFF)
                {
                    style.Bitmap = this.ImageFinder.FindImage(cid);
                }

                style.FillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();
            }

            return style;
        }
コード例 #12
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
        private LineStyle ReadLineStyle2(SWFDataTypeReader shapeReader, Tag format)
        {
            int width = shapeReader.ReadUI16();
            CapStyle startCap = (CapStyle)shapeReader.ReadUBits(2);
            JoinStyle join = (JoinStyle)shapeReader.ReadUBits(2);
            bool hasFill = shapeReader.ReadBit();
            bool noHScaling = shapeReader.ReadBit();
            bool noVScaling = shapeReader.ReadBit();
            bool hasPixelHints = shapeReader.ReadBit();
            shapeReader.ReadUBits(5); /* Reserved: 0 */
            bool noClose = shapeReader.ReadBit();
            CapStyle endCap = (CapStyle)shapeReader.ReadUBits(2);

            int? miterLimit = null;
            if (join == JoinStyle.Miter)
            {
                miterLimit = shapeReader.ReadUI16();
            }

            Color? c = null;
            FillStyle fs = null;

            if (hasFill)
            {
                fs = this.ReadFillStyle(shapeReader, format);
            }
            else
            {
                c = shapeReader.ReadRGBA();
            }

            return new LineStyle()
            {
                Width = width,
                StartCap = startCap,
                EndCap = endCap,
                Join = join,
                HasFill = hasFill,
                NoHScaling = noHScaling,
                NoVScaling = noVScaling,
                HasPixelHints = hasPixelHints,
                Colour = c,
                FillStyle = fs,
                MiterLimit = miterLimit
            };
        }
コード例 #13
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
        private LineStyle ReadLineStyle(SWFDataTypeReader shapeReader, Tag format)
        {
            LineStyle ls = new LineStyle();

            ls.Width = shapeReader.ReadUI16();

            if (format == Tag.DefineShape || format == Tag.DefineShape2)
            {
                ls.Colour = shapeReader.ReadRGB();
            }
            else if (format == Tag.DefineShape3 || format == Tag.DefineShape4)
            {
                ls.Colour = shapeReader.ReadRGBA();
            }
            else
            {
                throw new SWFModellerException(SWFModellerError.Internal, "Can't line style in shape format " + format.ToString());
            }

            return ls;
        }
コード例 #14
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
        private MorphLineStyle[] ReadMorphLineStyleArray(SWFDataTypeReader shapeReader, Tag format)
        {
            int lineCount = shapeReader.ReadUI8();
            if (lineCount == 0xFF)
            {
                lineCount = shapeReader.ReadUI16();
            }

            MorphLineStyle[] lineStyles = new MorphLineStyle[lineCount];
            if (format == Tag.DefineMorphShape)
            {
                for (int i = 0; i < lineCount; i++)
                {
                    lineStyles[i] = this.ReadMorphLineStyle(shapeReader);
                }
            }
            else /* Else Tag.DefineMorphShape2 */
            {
                for (int i = 0; i < lineCount; i++)
                {
                    lineStyles[i] = this.ReadMorphLineStyle2(shapeReader);
                }
            }

            return lineStyles;
        }
コード例 #15
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
        /* ISSUE 20: Instead of passing the format and reader around, perhaps they should be
         * members? Perhaps? Hmm? */
        private FillStyle[] ReadFillStyleArray(SWFDataTypeReader shapeReader, Tag format)
        {
            int fillCount = shapeReader.ReadUI8();
            if (fillCount == 0xFF && (format == Tag.DefineShape3 || format == Tag.DefineShape2))
            {
                fillCount = shapeReader.ReadUI16();
            }

            FillStyle[] fillStyles = new FillStyle[fillCount];
            for (int i = 0; i < fillCount; i++)
            {
                fillStyles[i] = this.ReadFillStyle(shapeReader, format);
            }

            return fillStyles;
        }
コード例 #16
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
        private MorphLineStyle ReadMorphLineStyle2(SWFDataTypeReader shapeReader)
        {
            int startwidth = shapeReader.ReadUI16();
            int endwidth = shapeReader.ReadUI16();

            CapStyle startCap = (CapStyle)shapeReader.ReadUBits(2);
            JoinStyle join = (JoinStyle)shapeReader.ReadUBits(2);

            bool hasFill = shapeReader.ReadBit();
            bool noHScaling = shapeReader.ReadBit();
            bool noVScaling = shapeReader.ReadBit();
            bool hasPixelHints = shapeReader.ReadBit();
            shapeReader.ReadUBits(5); // Reserved: 0
            bool noClose = shapeReader.ReadBit();

            CapStyle endCap = (CapStyle)shapeReader.ReadUBits(2);

            int? miterLimit = null;
            if (join == JoinStyle.Miter)
            {
                miterLimit = shapeReader.ReadUI16();
            }

            Color? startColour = null;
            Color? endColour = null;
            MorphFillStyle fs = null;

            if (hasFill)
            {
                fs = this.ReadMorphFillStyle(shapeReader);
            }
            else
            {
                startColour = shapeReader.ReadRGBA();
                endColour = shapeReader.ReadRGBA();
            }

            return new MorphLineStyle()
            {
                StartWidth = startwidth,
                EndWidth = endwidth,
                StartColour = startColour,
                EndColour = endColour,
                StartCap = startCap,
                EndCap = endCap,
                Join = join,
                HasFill = hasFill,
                NoHScaling = noHScaling,
                NoVScaling = noVScaling,
                HasPixelHints = hasPixelHints,
                FillStyle = fs,
                MiterLimit = miterLimit
            };
        }
コード例 #17
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
 private MorphLineStyle ReadMorphLineStyle(SWFDataTypeReader shapeReader)
 {
     return new MorphLineStyle()
     {
         StartWidth = shapeReader.ReadUI16(),
         EndWidth = shapeReader.ReadUI16(),
         StartColour = shapeReader.ReadRGBA(),
         EndColour = shapeReader.ReadRGBA()
     };
 }
コード例 #18
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
        private MorphFillStyle[] ReadMorphFillStyleArray(SWFDataTypeReader shapeReader)
        {
            int fillCount = shapeReader.ReadUI8();
            if (fillCount == 0xFF)
            {
                fillCount = shapeReader.ReadUI16();
            }

            MorphFillStyle[] fillStyles = new MorphFillStyle[fillCount];
            for (int i = 0; i < fillCount; i++)
            {
                fillStyles[i] = this.ReadMorphFillStyle(shapeReader);
            }

            return fillStyles;
        }
コード例 #19
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
        private MorphFillStyle ReadMorphFillStyle(SWFDataTypeReader shapeReader)
        {
            MorphFillStyle style = new MorphFillStyle();

            style.Type = (FillType)shapeReader.ReadUI8();

            if (style.Type == FillType.Solid)
            {
                style.StartColour = shapeReader.ReadRGBA();
                style.EndColour = shapeReader.ReadRGBA();
            }

            if (style.Type == FillType.LinearGradient
                    || style.Type == FillType.RadialGradient)
            {
                style.StartFillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();

                style.EndFillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();

                if (style.Type == FillType.LinearGradient
                        || style.Type == FillType.RadialGradient)
                {
                    style.Gradient = this.ReadMorphGradient(shapeReader);
                }
            }

            if (FillTypes.IsBitmap(style.Type))
            {
                int cid = shapeReader.ReadUI16();
                /* Some fills have this magic number in them which seems to deliberately not
                 * reference a bitmap. The spec is silent on the matter. Oh flash, you
                 * bumbling simian. */
                if (cid != 0x0000FFFF)
                {
                    style.Bitmap = this.ImageFinder.FindImage(cid);
                }

                style.StartFillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();

                style.EndFillMatrix = shapeReader.ReadMatrix();
                shapeReader.Align8();
            }

            return style;
        }
コード例 #20
0
ファイル: ShapeParser.cs プロジェクト: WeeWorld/Swiffotron
        private LineStyle[] ReadLineStyleArray(SWFDataTypeReader shapeReader, Tag format)
        {
            int lineCount = shapeReader.ReadUI8();
            if (lineCount == 0xFF)
            {
                lineCount = shapeReader.ReadUI16();
            }

            LineStyle[] lineStyles = new LineStyle[lineCount];
            if (format == Tag.DefineShape4)
            {
                for (int i = 0; i < lineCount; i++)
                {
                    lineStyles[i] = this.ReadLineStyle2(shapeReader, format);
                }
            }
            else
            {
                for (int i = 0; i < lineCount; i++)
                {
                    lineStyles[i] = this.ReadLineStyle(shapeReader, format);
                }
            }

            return lineStyles;
        }