//添加localScale动画 public AnimElement AddScaleAnimation(Vector3 from, Vector3 to) { _fromScale = from; _toScale = to; _animFunc += Anim_LocalScale; return(this); }
//localRotate动画 public AnimElement AddLocalRotateAnimation(Vector3 from, Vector3 to) { _fromRotation = from; _toRotation = to; _animFunc += Anim_LocalRotate; return(this); }
//世界坐标动画 public AnimElement Init(Vector3 begin, Vector3 end, Transform trans, float progressLR, int duration = 60) { startPos = begin; endPos = end; _animTarget = trans; Progress = progressLR; _currentFrame = Progress * duration; _animDuration = duration; MapFunc = DefaultMapFunc; _animFunc = Anim_Mover; //返回自己,方便这种用法 xxx.Init().Play(); return(this); }
//局部坐标动画 public AnimElement InitLocal(Vector3 localBegin, Vector3 localEnd, Transform localTrans, float progress, int duration = 60) { startPos = localBegin; endPos = localEnd; _animTarget = localTrans; Progress = progress; _currentFrame = Progress * duration; _animDuration = duration; MapFunc = DefaultMapFunc; _animFunc = Anim_LocalMover; //返回自己,方便这种用法 xxx.Init().Play(); return(this); }
//颜色动画 public AnimElement Init(Color begin, Color end, Transform trans, float progressLR, int duration = 60) { startPos = new Vector3(begin.r, begin.g, begin.b); endPos = new Vector3(end.r, end.g, end.b); beginAlpha = begin.a; endAlpha = end.a; _animTargetSPR = trans.GetComponent <SpriteRenderer>(); Progress = progressLR; _currentFrame = Progress * duration; _animDuration = duration; MapFunc = DefaultMapFunc; _animFunc = Anim_Color; //返回自己,方便这种用法 xxx.Init().Play(); return(this); }
//Bounces right portrait IEnumerator rightBounce() { rightAnimFuncPtr = new AnimFunc(BounceUp); yield return(new WaitForSeconds(.1f)); rightAnimFuncPtr = new AnimFunc(BounceDown); yield return(new WaitForSeconds(.1f)); rightAnimFuncPtr = new AnimFunc(BounceUp); yield return(new WaitForSeconds(.1f)); rightAnimFuncPtr = new AnimFunc(BounceDown); yield return(new WaitForSeconds(.1f)); rightPortrait.rectTransform.anchoredPosition = rPortPos; RightIsAnimating = false; }
//Bounces left portrait IEnumerator leftBounce() { leftAnimFuncPtr = new AnimFunc(BounceUp); yield return(new WaitForSeconds(.1f)); leftAnimFuncPtr = new AnimFunc(BounceDown); yield return(new WaitForSeconds(.1f)); leftAnimFuncPtr = new AnimFunc(BounceUp); yield return(new WaitForSeconds(.1f)); leftAnimFuncPtr = new AnimFunc(BounceDown); yield return(new WaitForSeconds(.1f)); leftPortrait.rectTransform.anchoredPosition = lPortPos; LeftIsAnimating = false; }
public GraphicsPath GetGraphicsPath(Graphics g, int time) { if ((this.gp == null) || (this.pretime != base.OwnerDocument.ControlTime)) { this.gp = new GraphicsPath(); foreach (XmlNode node1 in this.ChildNodes) { if (node1 is IGraph) { IGraph graph1 = (IGraph)node1; int num1 = 0; int num2 = 0; AnimFunc.CreateAnimateValues(graph1, time, out num1, out num2); ClipPath.Clip(g, time, graph1); GraphicsPath path1 = (GraphicsPath)graph1.GPath.Clone(); path1.Transform(graph1.Transform.Matrix); this.gp.FillMode = (this.ClipRule == "evenodd") ? FillMode.Alternate : FillMode.Winding; this.gp.AddPath(path1, true); } } } return(this.gp); }
public static Stroke GetStroke(IGraphPath path) { Pen pen1 = null; string text1 = AttributeFunc.ParseAttribute("stroke", (SvgElement)path, false).ToString(); Color color1 = Color.Empty; ISvgBrush brush1 = new SolidColor(Color.Empty); if ((text1 != null) || (text1 != string.Empty)) { brush1 = BrushManager.Parsing(text1, ((SvgElement)path).OwnerDocument); } text1 = AttributeFunc.ParseAttribute("stroke-opacity", (SvgElement)path, false).ToString(); float single1 = 1f; if ((text1 != string.Empty) && (text1 != null)) { single1 = Math.Max((float)0f, Math.Min((float)255f, ItopVector.Core.Func.Number.ParseFloatStr(text1))); } if (single1 > 1f) { single1 /= 255f; } single1 = Math.Min(path.Opacity, path.StrokeOpacity); float single2 = 1f; object obj1 = AttributeFunc.ParseAttribute("stroke-width", (SvgElement)path, false); if (obj1 is float) { single2 = (float)obj1; } pen1 = new Pen(Color.Empty, single2); pen1.Alignment = PenAlignment.Outset; string text2 = AttributeFunc.FindAttribute("stroke-linecap", (SvgElement)path).ToString(); if (text2 == "round") { LineCap cap1; pen1.EndCap = cap1 = LineCap.Round; pen1.StartCap = cap1; } else if (text2 == "square") { LineCap cap2; pen1.EndCap = cap2 = LineCap.Square; pen1.StartCap = cap2; } else { LineCap cap3; pen1.EndCap = cap3 = LineCap.Flat; pen1.StartCap = cap3; } string text3 = AttributeFunc.FindAttribute("stroke-linejoin", (SvgElement)path).ToString(); if (text3 == "round") { pen1.LineJoin = LineJoin.Round; } else if (text3 == "bevel") { pen1.LineJoin = LineJoin.Bevel; } else { pen1.LineJoin = LineJoin.Miter; } string text4 = AttributeFunc.FindAttribute("stroke-miterlimit", (SvgElement)path).ToString(); if (text4 == "") { text4 = "4"; } float single3 = ItopVector.Core.Func.Number.parseToFloat(text4, (SvgElement)path, SvgLengthDirection.Horizontal); if (single3 < 1f) { throw new Exception("stroke-miterlimit " + ItopVector.Core.Config.Config.GetLabelForName("notlowerstr") + " 1:" + text4); } pen1.MiterLimit = single3; string text5 = AttributeFunc.FindAttribute("stroke-dasharray", (SvgElement)path).ToString(); if ((text5 != "") && (text5 != "none")) { Regex regex1 = new Regex(@"[\s\,]+"); text5 = regex1.Replace(text5, ","); char[] chArray1 = new char[1] { ',' }; string[] textArray1 = text5.Split(chArray1); float[] singleArray1 = new float[textArray1.GetLength(0)]; for (int num1 = 0; num1 < textArray1.GetLength(0); num1++) { singleArray1[num1] = ItopVector.Core.Func.Number.ParseFloatStr(textArray1[num1]) / pen1.Width; } if ((singleArray1.GetLength(0) % 2) == 1) { float[] singleArray2 = new float[singleArray1.GetLength(0) * 2]; singleArray1.CopyTo(singleArray2, 0); singleArray1.CopyTo(singleArray2, singleArray1.GetLength(0)); singleArray1 = singleArray2; } pen1.DashPattern = singleArray1; } string text6 = AttributeFunc.FindAttribute("stroke-dashoffset", (SvgElement)path).ToString(); float single4 = 0f; if (text6 != "") { single4 = ItopVector.Core.Func.Number.parseToFloat(text6, (SvgElement)path, SvgLengthDirection.Horizontal); } float single5 = Math.Abs((float)AnimFunc.GetAnimateValue((SvgElement)path, "stroke-dashoffset", DomType.SvgNumber, single4)) / pen1.Width; pen1.DashOffset = single5 / single2; if (brush1 != null) { brush1.Pen = pen1; } Stroke stroke1 = new Stroke(brush1); stroke1.Opacity = single1; return(stroke1); }
public void Paint(GraphicsPath path, Graphics g, int time, float opacity) { int num1 = 0; int num2 = 0; GraphicsContainer container1 = g.BeginContainer(); AnimFunc.CreateAnimateValues(this, time, out num1, out num2); g.SmoothingMode = base.OwnerDocument.SmoothingMode; bool flag1 = this.Units == Units.UserSpaceOnUse; float single1 = this.X; float single2 = this.Y; float single3 = this.Width; float single4 = this.Height; ItopVector.Core.Types.ViewBox box1 = TypeFunc.ParseViewBox(this); Matrix matrix1 = new Matrix(); if (box1 != null) { matrix1 = box1.GetViewMatrix(this); } RectangleF ef1 = path.GetBounds(); if (!flag1) { single1 *= ef1.Width; single2 *= ef1.Height; single3 = (int)Math.Min((float)(single3 * ef1.Width), ef1.Width); single4 = (int)Math.Min((float)(single4 * ef1.Height), ef1.Height); } this.coord = matrix1.Clone(); PointF[] tfArray1 = new PointF[7] { new PointF(single1 + (single3 / 2f), single2 + (single4 / 2f)), new PointF(single1, single2 + (single4 / 2f)), new PointF(single1 + single3, single2), new PointF(single1 + (single3 / 2f), single2), new PointF(single1 + single3, single2 + (single4 / 2f)), new PointF(single1 + (single3 / 2f), single2 + single4), new PointF(single1, single2 + single4) }; this.boundsPoints = tfArray1; this.graidentPath = new GraphicsPath(); this.graidentPath.AddRectangle(new RectangleF(single1, single2, single3, single4)); Bitmap bitmap1 = new Bitmap((int)single3, (int)single4); Graphics graphics1 = Graphics.FromImage(bitmap1); Matrix matrix2 = matrix1.Clone(); graphics1.Transform = matrix2; SvgElementCollection.ISvgElementEnumerator enumerator1 = this.graphList.GetEnumerator(); while (enumerator1.MoveNext()) { IGraph graph1 = (IGraph)enumerator1.Current; graph1.Draw(graphics1, time); } TextureBrush brush1 = new TextureBrush(bitmap1, new RectangleF(single1, single2, single3, single4)); brush1.WrapMode = WrapMode.Tile; brush1.Transform = this.Transform.Matrix; Matrix matrix3 = new Matrix(1f, 0f, 0f, 1f, ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f)); this.graidentPath.Transform(matrix3); matrix3.TransformPoints(this.boundsPoints); g.FillPath(brush1, path); bitmap1.Dispose(); brush1.Dispose(); g.EndContainer(container1); }
public void Paint(GraphicsPath path, Graphics g, int time, float opacity) { int num1 = 0; int num2 = 0; AnimFunc.CreateAnimateValues(this, time, out num1, out num2); path.FillMode = FillMode.Alternate; g.SmoothingMode = base.OwnerDocument.SmoothingMode; SpreadMethods methods1 = this.SpreadMethod; bool flag1 = this.Units == Units.UserSpaceOnUse; float single1 = this.CX; float single2 = this.CY; float single3 = this.R; float single4 = this.FX; float single5 = this.FY; PointF[] tfArray2 = new PointF[7] { new PointF(single1, single2), new PointF(single1 + single3, single2), new PointF(single1 + (single3 * ((float)Math.Sin(1.8325957145940459))), single2 + (single3 * ((float)Math.Cos(1.8325957145940459)))), new PointF(single1 + (single3 * ((float)Math.Sin(1.3089969389957472))), single2 + (single3 * ((float)Math.Cos(1.3089969389957472)))), new PointF(single1, single2 + single3), PointF.Empty, PointF.Empty }; this.boundsPoints = tfArray2; GraphicsPath path1 = this.gradientpath; path1.Reset(); path1.AddEllipse((float)(single1 - single3), (float)(single2 - single3), (float)(2f * single3), (float)(2f * single3)); RectangleF ef1 = RectangleF.Empty; RectangleF ef2 = PathFunc.GetBounds(path); RectangleF ef3 = RectangleF.Empty; this.coord.Reset(); if (flag1) { ef3 = ((SVG)base.OwnerDocument.DocumentElement).ViewPort; } else { ef2 = new RectangleF(0f, 0f, 1f, 1f); ef3 = ef2; ef1 = PathFunc.GetBounds(path); this.coord.Translate(ef1.X, ef1.Y); this.coord.Scale(ef1.Width, ef1.Height); } //if (this.stops.Count==0)return; ColorBlend blend1 = new ColorBlend(this.Stops.Count); Color[] colorArray1 = new Color[this.Stops.Count]; float[] singleArray1 = new float[this.Stops.Count]; SvgElementCollection collection1 = this.Stops; for (int num3 = 0; num3 < collection1.Count; num3++) { GradientStop stop1 = (GradientStop)collection1[num3]; AnimFunc.CreateAnimateValues(stop1, time, out num1, out num2); int num4 = 0xff; if ((stop1.Opacity >= 0f) && (stop1.Opacity <= 255f)) { if (stop1.Opacity <= 1f) { num4 = (int)(stop1.Opacity * 255f); } else { num4 = (int)stop1.Opacity; } } num4 = (int)Math.Min((float)(opacity * 255f), (float)num4); Color color1 = stop1.Color; float single6 = Math.Min((float)1f, Math.Max((float)0f, stop1.ColorOffset)); colorArray1[num3] = Color.FromArgb(num4, color1.R, color1.G, color1.B); singleArray1[num3] = single6; } float[] singleArray2 = (float[])singleArray1.Clone(); Color[] colorArray2 = (Color[])colorArray1.Clone(); Array.Sort(singleArray2, colorArray2); Color color2 = colorArray2[0]; Color color3 = colorArray2[colorArray2.Length - 1]; if (singleArray2[0] != 0f) { float[] singleArray3 = (float[])singleArray2.Clone(); Color[] colorArray3 = (Color[])colorArray2.Clone(); singleArray2 = new float[singleArray2.Length + 1]; colorArray2 = new Color[colorArray2.Length + 1]; colorArray3.CopyTo(colorArray2, 1); singleArray3.CopyTo(singleArray2, 1); singleArray2[0] = 0f; colorArray2[0] = color2; } if (singleArray2[singleArray2.Length - 1] != 1f) { float[] singleArray4 = (float[])singleArray2.Clone(); Color[] colorArray4 = (Color[])colorArray2.Clone(); singleArray2 = new float[singleArray2.Length + 1]; singleArray4.CopyTo(singleArray2, 0); singleArray2[singleArray2.Length - 1] = 1f; colorArray2 = new Color[colorArray2.Length + 1]; colorArray4.CopyTo(colorArray2, 0); colorArray2[colorArray2.Length - 1] = color3; } if (methods1 == SpreadMethods.Pad) { float single7 = Math.Min((float)(single1 - single3), ef2.X); float single8 = Math.Min((float)(single2 - single3), ef2.Y); float single9 = Math.Max(single3, (float)(ef2.Width / 2f)); float single10 = this.cx - single3; float single11 = this.r; for (int num5 = 0; num5 < singleArray2.Length; num5++) { singleArray2[num5] = ((single10 + (single11 * singleArray2[num5])) - single7) / single9; } if (singleArray2[0] != 0f) { float[] singleArray5 = (float[])singleArray2.Clone(); Color[] colorArray5 = (Color[])colorArray2.Clone(); singleArray2 = new float[singleArray2.Length + 1]; colorArray2 = new Color[colorArray2.Length + 1]; colorArray5.CopyTo(colorArray2, 1); singleArray5.CopyTo(singleArray2, 1); singleArray2[0] = 0f; colorArray2[0] = color2; } if (singleArray2[singleArray2.Length - 1] != 1f) { float[] singleArray6 = (float[])singleArray2.Clone(); Color[] colorArray6 = (Color[])colorArray2.Clone(); singleArray2 = new float[singleArray2.Length + 1]; singleArray6.CopyTo(singleArray2, 0); singleArray2[singleArray2.Length - 1] = 1f; colorArray2 = new Color[colorArray2.Length + 1]; colorArray6.CopyTo(colorArray2, 0); colorArray2[colorArray2.Length - 1] = color3; } } Array.Reverse(colorArray2); Array.Reverse(singleArray2); for (int num6 = 0; num6 < singleArray2.Length; num6++) { singleArray2[num6] = 1f - singleArray2[num6]; } Matrix matrix1 = this.Transform.Matrix.Clone(); path1 = (GraphicsPath)this.gradientpath.Clone(); path1.Transform(matrix1); this.brush = new PathGradientBrush(path1); blend1.Colors = colorArray2; blend1.Positions = singleArray2; this.brush.InterpolationColors = blend1; if (methods1 == SpreadMethods.Reflect) { this.brush.WrapMode = WrapMode.Tile; } else if (methods1 == SpreadMethods.Repeat) { this.brush.WrapMode = WrapMode.TileFlipXY; } else { this.brush.WrapMode = WrapMode.Clamp; } if (AttributeFunc.FindAttribute("fx", this).ToString() == string.Empty) { single4 = this.CX; } if (AttributeFunc.FindAttribute("fy", this).ToString() == string.Empty) { single5 = this.CY; } PointF[] tfArray3 = new PointF[1] { new PointF(single4, single5) }; PointF[] tfArray1 = tfArray3; matrix1.TransformPoints(tfArray1); this.brush.CenterPoint = tfArray1[0]; g.FillPath(new SolidBrush(colorArray2[0]), path); GraphicsContainer container1 = g.BeginContainer(); g.Transform = this.coord; Matrix matrix2 = this.coord.Clone(); matrix2.Invert(); GraphicsPath path2 = (GraphicsPath)path.Clone(); path2.Transform(matrix2); g.FillPath(this.brush, path2); g.EndContainer(container1); this.pretime = -1; }
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); }
public override object FT(float time, DomType domtype) { string text2; string text1 = string.Empty; Matrix matrix1 = new Matrix(); float single1 = 0f; float single2 = 0f; float single3 = 0f; GraphicsPath path1 = this.GPath; bool flag1 = true; if (path1 == null) { flag1 = false; } else if (path1.PointCount <= 0) { flag1 = false; } if (flag1) { PointF[] tfArray1; GraphicsPath path2 = (GraphicsPath)this.motionPath.Clone(); path2.Flatten(new Matrix(), 0.01f); if (path2.PathTypes[path2.PathTypes.Length - 1] >= 0x80) { tfArray1 = new PointF[path2.PathPoints.Length + 1]; path2.PathPoints.CopyTo(tfArray1, 0); tfArray1[tfArray1.Length - 1] = path2.PathPoints[0]; } else { tfArray1 = path2.PathPoints; } int num1 = tfArray1.Length; int num2 = base.Begin; float single4 = base.Duration; float single5 = single4 / ((float)(num1 - 1)); int num3 = (int)((time - num2) / single5); if ((num3 + 1) >= num1) { single1 = tfArray1[num3].X; single2 = tfArray1[num3].Y; if ((num3 - 1) >= 0) { PointF tf1 = tfArray1[num3 - 1]; if (tf1.X == single1) { single3 = 0f; } else { single3 = (float)((Math.Atan((double)((tf1.Y - single2) / (tf1.X - single1))) / 3.1415926535897931) * 180); } } goto Label_02C5; } PointF tf2 = tfArray1[num3]; PointF tf3 = tfArray1[num3 + 1]; float single6 = base.Begin + (num3 * single5); float single7 = base.Begin + ((num3 + 1) * single5); if (tf3.X == tf2.X) { single3 = 0f; } else { single3 = (float)((Math.Atan((double)((tf3.Y - tf2.Y) / (tf3.X - tf2.X))) / 3.1415926535897931) * 180); } switch (this.CalcMode) { case CalcMode.linear: { single1 = AnimFunc.Linear(tf2.X, single6, tf3.X, single7, time); single2 = AnimFunc.Linear(tf2.Y, single6, tf3.Y, single7, time); goto Label_02C5; } case CalcMode.paced: { goto Label_02C5; } case CalcMode.spline: { goto Label_02C5; } case CalcMode.discrete: { text1 = tfArray1[num3].X.ToString() + " " + tfArray1[num3].Y.ToString(); goto Label_02C5; } } goto Label_02C5; } matrix1 = (Matrix)base.FT(time, DomType.SvgMatrix); Label_02C5: text2 = this.GetAttribute("rotate").Trim(); if ((text2 == null) || (text2 == string.Empty)) { text2 = "0"; } if (text2 == "auto") { matrix1.Rotate(single3, MatrixOrder.Append); matrix1.Translate(single1, single2, MatrixOrder.Append); return(matrix1); } if (text2 == "auto-reverse") { single3 -= 180f; matrix1.Rotate(single3, MatrixOrder.Append); matrix1.Translate(single1, single2, MatrixOrder.Append); return(matrix1); } try { single3 = float.Parse(text2); matrix1.Rotate(single3); } catch (Exception) { } matrix1.Translate(single1, single2, MatrixOrder.Append); return(matrix1); }
public virtual object FT(float time, DomType domtype) { if ((time < this.Begin) || (time > (this.Begin + this.Duration))) { return(null); } ArrayList list1 = (ArrayList)this.Values.Clone(); ArrayList list2 = (ArrayList)this.KeyTimes.Clone(); float single1 = 0f; float single2 = 1f; float single3 = this.Begin; float single4 = this.Duration; if (single4 == 0f) { single4 = 0.1f; } if (list1.Count == 0) { list1.Add(this.FromWhat); list2.Add(single3.ToString()); list1.Add(this.ToWhat); float single7 = single3 + single4; list2.Add(single7.ToString()); } int num1 = -1; float single5 = 0f; float single6 = 0f; for (int num2 = 1; num2 < list2.Count; num2++) { single5 = float.Parse(((string)list2[num2 - 1]).Trim()); single6 = float.Parse(((string)list2[num2]).Trim()); if ((time >= single5) && (time <= single6)) { num1 = num2 - 1; break; } } string text1 = (string)list1[num1]; string text2 = (string)list1[num1 + 1]; if (list2[num1] != null) { single1 = float.Parse((string)list2[num1]); } if (list2[num1 + 1] != null) { single2 = float.Parse((string)list2[num1 + 1]); } string text3 = string.Empty; string[] textArray1 = AnimFunc.Linear(text1.Trim(), single1, text2.Trim(), single2, domtype, (int)time); string[] textArray2 = textArray1; for (int num3 = 0; num3 < textArray2.Length; num3++) { string text4 = textArray2[num3]; text3 = text3 + text4 + " "; } switch (domtype) { case DomType.SvgMatrix: { return(new Transf(this.Type + "(" + text3.Trim() + ")").Matrix); } case DomType.SvgNumber: { return(ItopVector.Core.Func.Number.parseToFloat(text3.Trim(), (SvgElement)this.ParentNode, ItopVector.Core.Func.SvgLengthDirection.Horizontal)); } case DomType.SvgColor: { return(text3.Trim()); } case DomType.SvgPath: { SvgElement element1 = this.RefElement; if (element1 is IPath) { return(PathFunc.PathDataParse(text3, ((IPath)element1).PointsInfo)); } return(PathFunc.PathDataParse(text3)); } case DomType.SvgPoints: { return(PointsFunc.PointsParse(text3)); } } return(text3.Trim()); }
public void Paint(GraphicsPath path, Graphics g, int time, float opacity) { int num1 = 0; int num2 = 0; GraphicsContainer container1 = g.BeginContainer(); AnimFunc.CreateAnimateValues(this, time, out num1, out num2); g.SmoothingMode = base.OwnerDocument.SmoothingMode; SpreadMethods methods1 = this.SpreadMethod; bool flag1 = this.Units == Units.UserSpaceOnUse; float single1 = this.X1; float single2 = this.Y1; float single3 = this.X2; float single4 = this.Y2; if ((single1 == single3) && (single2 == single4)) { single1 -= 1E-05f; single3 += 1E-05f; } float single5 = single1; float single6 = single2; float single7 = single3; float single8 = single4; RectangleF ef1 = RectangleF.Empty; RectangleF ef2 = RectangleF.Empty; Matrix matrix1 = this.Transform.Matrix.Clone(); PointF[] tfArray4 = new PointF[2] { new PointF(single1, single2), new PointF(single3, single4) }; PointF[] tfArray1 = tfArray4; matrix1.TransformPoints(tfArray1); single1 = tfArray1[0].X; single3 = tfArray1[1].X; single2 = tfArray1[0].Y; single4 = tfArray1[1].Y; bool flag2 = single2 == single4; bool flag3 = single1 == single3; float single9 = 1f; this.coord = new Matrix(); this.ratiomatrix = new Matrix(); RectangleF ef3 = PathFunc.GetBounds(path); if (flag1) { ef1 = ((SVG)base.OwnerDocument.DocumentElement).ViewPort; } else { ef3 = new RectangleF(0f, 0f, 1f, 1f); ef1 = ef3; ef2 = PathFunc.GetBounds(path); this.coord.Translate(ef2.X, ef2.Y); this.coord.Scale(ef2.Width, ef2.Width); this.ratiomatrix.Scale(1f, ef2.Height / ef2.Width); } PointF tf1 = new PointF(single1, single2); PointF tf2 = new PointF(single3, single4); PointF tf3 = tf1; PointF tf4 = tf2; ColorBlend blend1 = new ColorBlend(this.Stops.Count); Color[] colorArray1 = new Color[this.Stops.Count]; float[] singleArray1 = new float[this.Stops.Count]; SvgElementCollection collection1 = this.Stops; for (int num3 = 0; num3 < collection1.Count; num3++) { GradientStop stop1 = (GradientStop)collection1[num3]; AnimFunc.CreateAnimateValues(stop1, time, out num1, out num2); int num4 = 0xff; if ((stop1.Opacity >= 0f) && (stop1.Opacity <= 255f)) { if (stop1.Opacity <= 1f) { num4 = (int)(stop1.Opacity * 255f); } else { num4 = (int)stop1.Opacity; } } num4 = (int)Math.Min((float)(opacity * 255f), (float)num4); Color color1 = stop1.Color; float single10 = Math.Min((float)1f, Math.Max((float)0f, stop1.ColorOffset)); colorArray1[num3] = Color.FromArgb(num4, color1.R, color1.G, color1.B); singleArray1[num3] = single10; } float[] singleArray2 = (float[])singleArray1.Clone(); Color[] colorArray2 = (Color[])colorArray1.Clone(); Array.Sort(singleArray2, colorArray2); Color color2 = colorArray2[0]; Color color3 = colorArray2[colorArray2.Length - 1]; float single11 = singleArray2[0]; float single12 = singleArray2[singleArray2.Length - 1]; if (singleArray2[0] != 0f) { float[] singleArray3 = (float[])singleArray2.Clone(); Color[] colorArray3 = (Color[])colorArray2.Clone(); singleArray2 = new float[singleArray2.Length + 1]; colorArray2 = new Color[colorArray2.Length + 1]; colorArray3.CopyTo(colorArray2, 1); singleArray3.CopyTo(singleArray2, 1); singleArray2[0] = 0f; colorArray2[0] = color2; } if (singleArray2[singleArray2.Length - 1] != 1f) { float[] singleArray4 = (float[])singleArray2.Clone(); Color[] colorArray4 = (Color[])colorArray2.Clone(); singleArray2 = new float[singleArray2.Length + 1]; singleArray4.CopyTo(singleArray2, 0); singleArray2[singleArray2.Length - 1] = 1f; colorArray2 = new Color[colorArray2.Length + 1]; colorArray4.CopyTo(colorArray2, 0); colorArray2[colorArray2.Length - 1] = color3; } PointF[] tfArray2 = new PointF[1]; PointF[] tfArray3 = new PointF[4]; if (methods1 == SpreadMethods.Pad) { if (flag2) { tf1 = new PointF(Math.Min(single1, ef3.X), tf1.Y); tf2 = new PointF(Math.Max(single3, ef3.Right), tf2.Y); float single13 = single1; float single14 = single3 - single1; for (int num5 = 0; num5 < singleArray2.Length; num5++) { singleArray2[num5] = ((single13 + (single14 * singleArray2[num5])) - tf1.X) / (tf2.X - tf1.X); } } else if (flag3) { tf1 = new PointF(tf1.X, Math.Min(single2, ef3.Y)); tf2 = new PointF(tf2.X, Math.Max(single4, ef3.Bottom)); float single15 = single2; float single16 = single4 - single2; for (int num6 = 0; num6 < singleArray2.Length; num6++) { singleArray2[num6] = ((single15 + (single16 * singleArray2[num6])) - tf1.Y) / (tf2.Y - tf1.Y); } } else { single9 = (single4 - single2) / (single3 - single1); float single17 = (single2 - (single9 * single1)) / (1f + (single9 * single9)); PointF tf5 = ef3.Location; PointF tf6 = new PointF(ef3.Right, ef3.Y); PointF tf7 = new PointF(ef3.Right, ef3.Bottom); PointF tf8 = new PointF(ef3.X, ef3.Bottom); PointF[] tfArray5 = new PointF[4] { tf5, tf6, tf7, tf8 }; tfArray2 = tfArray5; for (int num7 = 0; num7 < tfArray2.Length; num7++) { PointF tf9 = tfArray2[num7]; float single18 = ((((single9 * single9) * tf9.Y) + (single9 * tf9.X)) / (1f + (single9 * single9))) + single17; float single19 = (single9 * (tf9.Y - single18)) + tf9.X; tfArray3[num7] = new PointF(single19, single18); if (single1 < single3) { if (single19 < tf1.X) { tf1 = new PointF(single19, single18); } else if (single19 > tf2.X) { tf2 = new PointF(single19, single18); } } else if (single19 < tf2.X) { tf2 = new PointF(single19, single18); } else if (single19 > tf1.X) { tf1 = new PointF(single19, single18); } } float single20 = single1; float single21 = single3 - single1; for (int num8 = 0; num8 < singleArray2.Length; num8++) { singleArray2[num8] = ((single20 + (single21 * singleArray2[num8])) - tf1.X) / (tf2.X - tf1.X); } } if (singleArray2[0] != 0f) { float[] singleArray5 = (float[])singleArray2.Clone(); Color[] colorArray5 = (Color[])colorArray2.Clone(); singleArray2 = new float[singleArray2.Length + 1]; colorArray2 = new Color[colorArray2.Length + 1]; colorArray5.CopyTo(colorArray2, 1); singleArray5.CopyTo(singleArray2, 1); singleArray2[0] = 0f; colorArray2[0] = color2; } if (singleArray2[singleArray2.Length - 1] != 1f) { float[] singleArray6 = (float[])singleArray2.Clone(); Color[] colorArray6 = (Color[])colorArray2.Clone(); singleArray2 = new float[singleArray2.Length + 1]; singleArray6.CopyTo(singleArray2, 0); singleArray2[singleArray2.Length - 1] = 1f; colorArray2 = new Color[colorArray2.Length + 1]; colorArray6.CopyTo(colorArray2, 0); colorArray2[colorArray2.Length - 1] = color3; } } this.brush = new LinearGradientBrush(tf1, tf2, color2, color3); if (methods1 == SpreadMethods.Reflect) { this.brush.WrapMode = WrapMode.TileFlipXY; } else { this.brush.WrapMode = WrapMode.Tile; } blend1.Colors = colorArray2; blend1.Positions = singleArray2; this.brush.InterpolationColors = blend1; this.coord.Multiply(this.ratiomatrix); GraphicsContainer container2 = g.BeginContainer(); g.Transform = this.coord; Matrix matrix2 = this.coord.Clone(); matrix2.Invert(); GraphicsPath path1 = (GraphicsPath)path.Clone(); path1.Transform(matrix2); g.FillPath(this.brush, path1); g.EndContainer(container2); if (!base.OwnerDocument.PlayAnim) { this.gradientpath = new GraphicsPath(); PointF[] tfArray6 = new PointF[8] { new PointF((single5 + single7) / 2f, ((single6 + single8) / 2f) + 0.5f), new PointF(single7, single8 + 0.5f), new PointF(single7, single8), PointF.Empty, new PointF(single7, ((single6 + single8) / 2f) + 1f), PointF.Empty, PointF.Empty, PointF.Empty }; this.boundsPoints = tfArray6; this.gradientpath.AddLine(new PointF(single5, single6), new PointF(single5, single6 + 1f)); this.gradientpath.StartFigure(); this.gradientpath.AddLine(new PointF(single7, single8), new PointF(single7, single8 + 1f)); } this.pretime = time; g.EndContainer(container1); }