Exemplo n.º 1
0
        public override void Draw(Graphics g, int time)
        {
            int num1 = 0;
            int num2 = 0;

            AnimFunc.CreateAnimateValues(this, time, out num1, out num2);
            GraphicsContainer container1 = g.BeginContainer();

            g.SmoothingMode     = base.OwnerDocument.SmoothingMode;
            g.TextRenderingHint = base.OwnerDocument.TextRenderingHint;
            ISvgBrush brush1  = base.GraphBrush;
            float     single1 = base.Size;

            this.GPath = new GraphicsPath();
            GraphicsPath path1   = new GraphicsPath();
            StringFormat format1 = base.GetGDIStringFormat();
            FontFamily   family1 = base.GetGDIFontFamily();

            this.currentPostion.X += (base.X + base.Dx);
            this.currentPostion.Y += (base.Y + base.Dy);
            SvgElement element1 = this.RefElement;
            string     text1    = string.Empty;

            if (element1 is Text)
            {
                text1 = base.TrimText(element1.FirstChild.Value);
            }
            if (text1 != string.Empty)
            {
                float single2 = 0f;
                if (format1.Alignment == StringAlignment.Near)
                {
                    single2 = (single1 * 1f) / 6f;
                }
                else if (format1.Alignment == StringAlignment.Far)
                {
                    single2 = (-single1 * 1f) / 6f;
                }
                float single3 = (((float)family1.GetCellAscent(FontStyle.Regular)) / ((float)family1.GetEmHeight(FontStyle.Regular))) * single1;
                if (text1 != null)
                {
                    path1.AddString(text1, family1, base.GetGDIStyle(), single1, new PointF(this.currentPostion.X - single2, this.currentPostion.Y - single3), format1);
                }
                this.currentPostion.X -= single2;
                RectangleF ef1 = path1.GetBounds();
                if (!ef1.IsEmpty)
                {
                    RectangleF ef2     = path1.GetBounds();
                    float      single4 = ef2.Width;
                    if (format1.Alignment == StringAlignment.Center)
                    {
                        single4 /= 2f;
                    }
                    else if (format1.Alignment == StringAlignment.Far)
                    {
                        single4 = 0f;
                    }
                    this.currentPostion.X += (single4 + (single1 / 4f));
                }
                brush1.Paint(path1, g, time);
//                Stroke stroke1 = Stroke.GetStroke(this);
                base.GraphStroke.Paint(g, this, path1, time);
                this.GPath.StartFigure();
                this.GPath.AddPath(path1, false);
            }
            g.EndContainer(container1);
        }
Exemplo n.º 2
0
        public override void Draw(Graphics g, int time)
        {
            if (base.DrawVisible)
            {
                GraphicsContainer container1 = g.BeginContainer();
//				if (this.pretime != time)
//				{
//					int num1 = 0;
//					int num2 = 0;
//					AnimFunc.CreateAnimateValues(this, time, out num1, out num2);
//				}
                Matrix matrix1 = this.Transform.Matrix.Clone();
                base.GraphTransform.Matrix.Multiply(matrix1, MatrixOrder.Prepend);
                if (!this.editMode)
                {
                    g.SmoothingMode = base.OwnerDocument.SmoothingMode;

                    if (this == this.OwnerTextElement)
                    {
                        ClipPath.Clip(g, time, this);
                    }
                    if (!base.Visible)
                    {
                        g.SetClip(Rectangle.Empty);
                    }
                    ISvgBrush brush1 = base.GraphBrush;

                    if (this == this.OwnerTextElement)
                    {
                        this.currentPostion = PointF.Empty;
                    }
                    float single1 = this.Size;
                    this.GPath = new GraphicsPath();
                    using (StringFormat format1 = this.GetGDIStringFormat())
                    {
                        using (FontFamily family1 = this.GetGDIFontFamily())
                        {
                            if (this.X == 0)
                            {
                                this.currentPostion.X = this.currentPostion.X + this.Dx;
                            }
                            else
                            {
                                this.currentPostion.X = (this.X + this.Dx);
                            }
                            if (this.Y == 0)
                            {
                                this.currentPostion.Y = this.currentPostion.Y + this.Dy;
                            }
                            else
                            {
                                this.currentPostion.Y = (this.Y + this.Dy);
                            }
                            //this.currentPostion.Y += (this.Y + this.Dy);
                            int num3 = this.GetGDIStyle();
                            base.TempFillOpacity   = Math.Min(1f, base.FillOpacity);
                            base.TempOpacity       = Math.Min(1f, base.Opacity);
                            base.TempStrokeOpacity = Math.Min(1f, base.StrokeOpacity);
                            this.old = true;
//							this.OwnerDocument.BeginPrint=true;
                            bool flag = false;
                            foreach (XmlNode node1 in this.ChildNodes)
                            {
                                GraphicsPath path1 = new GraphicsPath();
                                if (node1 is Text)
                                {
                                    ((Text)node1).currentPostion        = this.currentPostion;
                                    ((Text)node1).GraphTransform.Matrix = base.GraphTransform.Matrix.Clone();
                                    ((Text)node1).Draw(g, time);
                                    this.currentPostion = ((Text)node1).currentPostion;
                                    if (((Text)node1).GPath.PointCount > 0)
                                    {
                                        this.GPath.StartFigure();
                                        this.GPath.AddPath(((Text)node1).GPath, false);
                                    }
                                    continue;
                                }
                                if (node1.NodeType == XmlNodeType.Text)
                                {
                                    string text1 = "t";                                    //this.TrimText(node1.Value);
                                    Font   font1 = null;
                                    try
                                    {
                                        font1 = new Font(family1.Name, single1, (FontStyle)num3, GraphicsUnit.Pixel);
                                    }
                                    catch
                                    {
                                        int ii = 0;
                                        ii++;
                                    }
                                    float single2 = (((float)family1.GetCellAscent(FontStyle.Regular)) / ((float)family1.GetEmHeight(FontStyle.Regular))) * single1;
                                    SizeF ef1     = g.MeasureString(text1, font1, new PointF(this.currentPostion.X, this.currentPostion.Y - single2), format1);
                                    float single3 = ef1.Width;

                                    float single5 = (((float)family1.GetLineSpacing(FontStyle.Regular)) / ((float)family1.GetEmHeight(FontStyle.Regular))) * single1;                                        //Ðоà

                                    float offy = this.currentPostion.Y - single2;
                                    float offx = this.currentPostion.X;

                                    for (int i = 0; i < Lines.Length; i++)
                                    {
                                        if (!base.ShowBound && (this.OwnerDocument.BeginPrint || LimitSize))
                                        {
                                            GraphicsContainer gc = g.BeginContainer();
                                            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                                            g.Transform         = base.GraphTransform.Matrix;
                                            //g.DrawString(lines[i], font1,new SolidBrush(Color.Black),100,100);
                                            Color color1 = Color.Black;
                                            if (this.SvgAttributes.Contains("stroke"))
                                            {
                                                color1 = Stroke.GetStroke(this).StrokeColor;
                                                if (color1.IsEmpty || color1 == Color.Transparent || color1 == Color.Empty)
                                                {
                                                    color1 = Color.Black;
                                                }
                                            }

                                            g.DrawString(lines[i], font1, new SolidBrush(color1), new PointF(offx, offy), format1);
                                            g.EndContainer(gc);
                                            SizeF ef2 = g.MeasureString(lines[i], font1, new PointF(offx, offy), format1);
                                            path1.AddString(lines[i], family1, num3, single1, new PointF(offx, offy), format1);
                                        }
                                        else
                                        {
                                            flag = true;
                                            path1.AddString(lines[i], family1, num3, single1, new PointF(offx, offy), format1);
                                        }
                                        if (Vertical)
                                        {
                                            offx += single5;
                                        }
                                        else
                                        {
                                            offy += single5;
                                        }
                                    }
                                    this.currentPostion.X += ((single3 * 3f) / 4f);
                                    this.GPath.StartFigure();
                                    this.GPath.AddPath(path1, false);
                                    float single4 = base.Opacity;
                                    if (this.svgAnimAttributes.ContainsKey("fill-opacity"))
                                    {
                                        single4 = Math.Min(single4, base.FillOpacity);
                                    }
                                    path1.Transform(base.GraphTransform.Matrix);
                                    if (!base.ShowBound && !(this.OwnerDocument.BeginPrint || LimitSize))
                                    {
                                        brush1.Paint(path1, g, time, single4);
                                        //								Stroke stroke1 = Stroke.GetStroke(this);
                                        //								stroke1.Paint(g, this,path1, time);
                                        base.GraphStroke.Paint(g, this, path1, 0);
                                        continue;
                                    }
                                    else if (flag)
                                    {
                                        g.DrawPath(new Pen(base.BoundColor), path1);
                                    }
                                }
                                path1.Dispose();
                            }
                        }
                    }

                    matrix1.Dispose();
                    ClipPath.DrawClip(g, time, this);
                    g.EndContainer(container1);
                    this.pretime = time;
                    this.old     = false;
                }
            }
        }
Exemplo n.º 3
0
        public override void Draw(Graphics g, int time)
        {
            if (base.DrawVisible)
            {
                Matrix matrix1 = base.Transform.Matrix.Clone();

                GraphicsContainer container1 = g.BeginContainer();

                g.SmoothingMode = base.OwnerDocument.SmoothingMode;

                Matrix matrix2 = base.GraphTransform.Matrix.Clone();
                base.GraphTransform.Matrix.Multiply(matrix1, MatrixOrder.Prepend);


                ClipAndMask.ClipPath.Clip(g, time, this);
                bool flag1 = base.Visible;
                if (!base.Visible)
                {
                    g.SetClip(Rectangle.Empty);
                }
                float single1 = this.Opacity;
                if (this.svgAnimAttributes.ContainsKey("fill-opacity"))
                {
                    single1 = Math.Min(single1, (float)this.svgAnimAttributes["fill-opacity"]);
                }
                ISvgBrush brush1  = this.GraphBrush;
                Stroke    stroke1 = this.graphStroke;
                using (GraphicsPath path1 = (GraphicsPath)this.GPath.Clone())
                {
                    path1.Transform(base.GraphTransform.Matrix);
                    if (!base.ShowBound)
                    {
                        if (this.IsMarkerChild)
                        {
                            Marker marker = this.ParentNode as Marker;
                            this.IsChanged = false;
                            this.pretime   = time;
                            stroke1        = marker.GraphStroke;
                            if (brush1 != null && !brush1.IsEmpty())
                            {
                                brush1 = marker.GraphBrush;
                            }
                        }
                        if (((brush1 != null) && !(this is Line)) && !(this is Polyline))
                        {
                            brush1.Paint(path1, g, time, single1);
                        }

                        stroke1.Paint(g, this, path1, time);

                        if (this is Polyline)
                        {
                            if (LineType == "1")
                            {
                                //平行线,
                                using (Pen p = new Pen(brush1.Pen.Color)) {
                                    p.Width         = this.graphStroke.StrokePen.Width;
                                    p.CompoundArray = new float[] { 0f, 0.1f, 0.9f, 1f };
                                    g.DrawPath(p, path1);
                                }
                            }
                            else if (LineType == "2")   //铁路效果
                            {
                                using (Pen p = new Pen(Color.FromArgb(120, 120, 120))) {
                                    p.Width         = this.graphStroke.StrokePen.Width;
                                    p.CompoundArray = new float[] { 0f, 0.1f, 0.9f, 1f };
                                    g.DrawPath(p, path1);
                                }
                            }
                        }
                    }
                    else
                    {
                        g.DrawPath(new Pen(base.BoundColor), path1);
                    }
                    this.DrawConnect(g);
                }
                matrix1.Dispose();
                ClipAndMask.ClipPath.DrawClip(g, time, this);
                g.EndContainer(container1);
                this.pretime = time;
            }
        }