/// <summary> /// Recursively drawss all of the descentents within the container /// of this drawing element /// </summary> protected virtual void DrawChildren(SvgElementCollection container) { foreach (var child in Children) { container.Add(child.Draw()); } }
public void GoDown() { SvgElement element = this as SvgElement; if (element.ParentNode != null && !(element is SVG)) { SvgElement element1 = (SvgElement)element.ParentNode; XmlNode node1 = element.NextSibling; while (!(node1 is Layer) && (node1 != null)) { node1 = node1.NextSibling; } if (node1 != null) { bool flag1 = this.OwnerDocument.AcceptChanges; this.OwnerDocument.AcceptChanges = false; element1.RemoveChild(element); element.AllowRename = false; element1.InsertAfter(element, node1); element.AllowRename = true; this.OwnerDocument.AcceptChanges = flag1; SvgElementCollection layers = OwnerDocument.Layers; int index = layers.IndexOf(element); layers.Remove(element); layers.Insert(index + 1, element); AppliedVisibility(); } } }
private static SKPath?GetClipPath(SvgElementCollection svgElementCollection, SKRect skBounds, HashSet <Uri> uris, CompositeDisposable disposable) { var skPathClip = default(SKPath); foreach (var svgElement in svgElementCollection) { if (svgElement is SvgVisualElement visualChild) { if (!CanDraw(visualChild, Attributes.None)) { continue; } var skPath = GetClipPath(visualChild, skBounds, uris, disposable); if (skPath != null) { if (skPathClip == null) { skPathClip = skPath; } else { var result = skPathClip.Op(skPath, SKPathOp.Union); disposable.Add(result); skPathClip = result; } } } } return(skPathClip); }
internal Layer(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { canSelect=true; islock=false; graphList =new SvgElementCollection(); }
private void ChangeAlpha(SvgElementCollection elementList, int alpha) { if (elementList.Count > 0) { foreach (var element in elementList) { if (element.Fill != SvgPaintServer.None && element.Fill != null && element.Fill is SvgColourServer) { element.Fill = ChangeAlphaColor((element.Fill as SvgColourServer), alpha); } if (element.Color != SvgPaintServer.None && element.Color != null && element.Color is SvgColourServer) { element.Color = ChangeAlphaColor((element.Color as SvgColourServer), alpha); } if (element.Stroke != SvgPaintServer.None && element.Stroke != null && element.Stroke is SvgColourServer) { element.Stroke = ChangeAlphaColor((element.Stroke as SvgColourServer), alpha); } ChangeAlpha(element.Children, alpha); } } }
public void UpdateElementChilds(SvgElement element, bool oldexpand, SvgElementCollection list) { if (oldexpand) { SvgElementCollection.ISvgElementEnumerator enumerator1 = list.GetEnumerator(); while (enumerator1.MoveNext()) { SvgElement element1 = (SvgElement)enumerator1.Current; this.RemoveElement(element1); } } else { int num1 = this.flowChilds.IndexOf(element); if ((num1 + 1) < this.flowChilds.Count) { for (int num2 = list.Count - 1; num2 >= 0; num2--) { this.Insert(num1 + 1, (SvgElement)list[num2]); } } else { SvgElementCollection.ISvgElementEnumerator enumerator2 = list.GetEnumerator(); while (enumerator2.MoveNext()) { SvgElement element2 = (SvgElement)enumerator2.Current; this.AddElement(element2); } } } }
public SvgElementSelectedEventArgs(SvgElementCollection list) { if (list != null) { this.Elements = new ISvgElement[list.Count]; list.CopyTo(this.Elements, 0); } }
private void setTJshow() { SvgElementCollection sc = (tlVectorControl1.SVGDocument.RootElement as SVG).ChildList; foreach (SvgElement se in sc) { try { (se as IGraph).DrawVisible = true; } catch { } } }
private void setTJhide() { SvgElementCollection sc = (tlVectorControl1.SVGDocument.RootElement as SVG).ChildList; foreach (SvgElement se in sc) { try { (se as IGraph).DrawVisible = se.GetAttribute("print") != "no"; } catch { } } }
/// <summary> /// Recursively draws all of the descentents within the container /// of this drawing element /// </summary> protected virtual void DrawChildren(SvgElementCollection container) { foreach (var child in Children) { var childDrawing = child.Draw(); if (childDrawing != null) { container.Add(childDrawing); } } }
/// <summary> /// 把可见性应用到图层里的图元。 /// </summary> public void AppliedVisibility() { SvgElementCollection nodelist = this.graphList; //this.OwnerDocument.SelectNodes("//*[@layer='"+this.ID+"']"); bool flag1 = this.Visible; foreach (XmlNode node in nodelist) { IGraph element = node as IGraph; if (element != null) { element.DrawVisible = flag1; } } }
private static void ChangeBrush(SvgElementCollection collection) { foreach (var svgElement in collection) { if (svgElement.GetType().BaseType.BaseType == typeof(SvgElement)) { ((SvgElement)svgElement).Stroke = new SvgColourServer(System.Drawing.Color.White); } if (svgElement.Children.Count > 1) { ChangeBrush(svgElement.Children); } } }
private void ChangePathSize(SvgElementCollection elementList, float r) { if (elementList.Count > 0) { foreach (var element in elementList) { if (element is SvgPath) { if (element.Transforms == null) { element.Transforms = new Svg.Transforms.SvgTransformCollection(); } element.Transforms.Add(new Svg.Transforms.SvgScale(r)); } ChangePathSize(element.Children, r); } } }
// Methods internal Graph(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { // this.transform = new Transf(); this.visible = true; this.showBound = false; this.graphTransform = new Transf(); this.tempOpacity = 1f; this.tempFillOpacity = 1f; this.tempStrokeOpacity = 1f; this.boundColor = Color.Empty; this.isLock = false; this.drawVisible = true; this.pointsinfo = new PointInfoCollection(); this.pointsinfo.OwerGraph = this; this.IsClip = false; this.Changed = true; this.connectPoints = new PointF[0]; this.connectLines = new SvgElementCollection(); this.canSelect=true; this.limitSize =false; }
public Layer Copy() { Layer layer = CreateNew(this.Label + " 副本", this.OwnerDocument); int num = graphList.Count; if (num > 0) { OwnerDocument.NumberOfUndoOperations = (2 * graphList.Count) + 200; SvgElementCollection sc = graphList.Clone(); for (int i = num - 1; i >= 0; i--) { SvgElement element = sc[i] as SvgElement; IGraph graph = (IGraph)AddElement(element.Clone() as SvgElement); graph.Layer = layer; } this.OwnerDocument.NotifyUndo(); } return(layer); }
// Methods internal Group(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { this.graphList = new SvgElementCollection(); this.graphPath = new GraphicsPath(); this.graphTransform = new Transf(); this.graphBrush = new SolidColor(Color.Empty); this.graphStroke = new Stroke(); this.connectPoints = new PointF[0]; this.visible = true; this.showBound = false; this.tempOpacity = 1f; this.tempFillOpacity = 1f; this.tempStrokeOpacity = 1f; this.boundColor = Color.Empty; this.isLock = false; this.drawVisible = true; this.updateattribute = true; this.Changed = true; this.connectLines = new ItopVector.Core.SvgElementCollection(); this.graphStroke.OnStrokeBrushChanged += new EventHandler(this.ChangeStrokeBrush); canSelect=true; this.limitSize =false; }
protected IGraph FindGraphByPoint(PointF mousepoint, ref PointF connectpoint) { SvgElementCollection collection1 = this.mouseAreaControl.SVGDocument.CurrentLayer.GraphList; for (int num1 = collection1.Count - 1; num1 >= 0; num1--) { IGraph ab1 = collection1[num1] as IGraph; if (ab1 != null) { PointF[] tfArray1 = ab1.ConnectPoints; //连接点 if (tfArray1.Length > 0) { tfArray1 = tfArray1.Clone() as PointF[]; ab1.GraphTransform.Matrix.TransformPoints(tfArray1); for (int num2 = 0; num2 < tfArray1.Length; num2++) { if (this.InPoint(mousepoint, tfArray1[num2], 6f)) { connectpoint = tfArray1[num2]; return(ab1); } } // RectangleF ef1 = ab1.GPath.GetBounds(); // PointF[] tfArray2 = new PointF[] { new PointF(ef1.X + (ef1.Width / 2f), ef1.Y + (ef1.Height / 2f)) } ;//中心点 // tfArray1 = tfArray2; // ab1.GraphTransform.Matrix.TransformPoints(tfArray1); // if (this.InPoint(mousepoint, tfArray1[0], 10f)) // { // connectpoint = tfArray1[0]; // return ab1; // } } } } return(null); }
private void DeleteSmallerPath(SvgElementCollection elementList, double minDiag) { if (elementList.Count > 0) { var elementsToDelete = new List <SvgElement>(); foreach (var item in elementList) { if (item is SvgPath && CheckSize(item, minDiag)) { elementsToDelete.Add(item); } else { DeleteSmallerPath(item.Children, minDiag); } } foreach (var i in elementsToDelete) { elementList.Remove(i); } } }
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; }
private Layer CopyLayer(Layer layer) { Layer layer2 = Layer.CreateNew(layer.Label + " 副本", this.SymbolDoc); //foreach (SvgElement g in layer.GraphList) //{ // layer2.GraphList.Add(g); //} this.SymbolDoc.NumberOfUndoOperations = (2 * layer2.GraphList.Count) + 200; SvgElementCollection sc = layer.GraphList; for (int i = layer.GraphList.Count - 1; i >= 0; i--) { SvgElement element = sc[i] as SvgElement; SvgElement temp = element.Clone() as SvgElement; //if (temp.Name=="use"){ if (temp.GetAttribute("CopyOf") == "") { temp.SetAttribute("CopyOf", temp.ID); } IGraph graph = (IGraph)layer2.AddElement(temp); graph.Layer = layer2; LineInfo _line = new LineInfo(); _line.EleID = element.ID; _line.SvgUID = this.SymbolDoc.SvgdataUid; IList lineInfoList = Services.BaseService.GetList("SelectLineInfoByEleID", _line); foreach (LineInfo line in lineInfoList) { line.UID = Guid.NewGuid().ToString(); line.LayerID = layer2.ID; line.EleID = temp.ID; Services.BaseService.Create <LineInfo>(line); } glebeProperty gle = new glebeProperty(); gle.EleID = element.ID; gle.SvgUID = this.SymbolDoc.SvgdataUid; IList gleProList = Services.BaseService.GetList("SelectglebePropertyByEleID", gle); foreach (glebeProperty gleP in gleProList) { gleP.UID = Guid.NewGuid().ToString(); gleP.LayerID = layer2.ID; gleP.EleID = temp.ID; Services.BaseService.Create <glebeProperty>(gleP); } substation _sub = new substation(); _sub.EleID = element.ID; _sub.SvgUID = this.SymbolDoc.SvgdataUid; IList substationList = Services.BaseService.GetList("SelectsubstationByEleID", _sub); foreach (substation sub in substationList) { sub.UID = Guid.NewGuid().ToString(); sub.LayerID = layer2.ID; sub.EleID = temp.ID; Services.BaseService.Create <substation>(sub); } } this.SymbolDoc.NotifyUndo(); return(layer2); }
private Layer CopyLayer2(Layer layer, string textname) { string layerlabelf = layer.Label.Substring(4); string layer2name = textname + layerlabelf; int j = 0; for (int i = 0; i < checkedListBox1.Items.Count; i++) { if (checkedListBox1.Items[i].ToString() == layer2name) { j = 1; } //else // j = 0; } Layer layer2 = null; if (j == 0) { layer2 = Layer.CreateNew(textname + layerlabelf, this.SymbolDoc); this.SymbolDoc.NumberOfUndoOperations = (2 * layer2.GraphList.Count) + 200; SvgElementCollection sc = layer.GraphList; for (int i = layer.GraphList.Count - 1; i >= 0; i--) { SvgElement element = sc[i] as SvgElement; SvgElement temp = element.Clone() as SvgElement; if (temp.GetAttribute("CopyOf") == "") { temp.SetAttribute("CopyOf", temp.ID); } IGraph graph = (IGraph)layer2.AddElement(temp); graph.Layer = layer2; //LineInfo _line = new LineInfo(); //_line.EleID = element.ID; //_line.SvgUID = this.SymbolDoc.SvgdataUid; //IList lineInfoList = Services.BaseService.GetList("SelectLineInfoByEleID", _line); PSPDEV _line = new PSPDEV(); _line.EleID = element.ID; _line.SvgUID = this.SymbolDoc.SvgdataUid; IList lineInfoList = Services.BaseService.GetList("SelectPSPDEVBySvgUIDandEleID", _line); foreach (PSPDEV line in lineInfoList) { line.SUID = Guid.NewGuid().ToString(); line.LayerID = layer2.ID; line.EleID = temp.ID; Services.BaseService.Create <PSPDEV>(line); } glebeProperty gle = new glebeProperty(); gle.EleID = element.ID; gle.SvgUID = this.SymbolDoc.SvgdataUid; IList gleProList = Services.BaseService.GetList("SelectglebePropertyByEleID", gle); foreach (glebeProperty gleP in gleProList) { gleP.UID = Guid.NewGuid().ToString(); gleP.LayerID = layer2.ID; gleP.EleID = temp.ID; Services.BaseService.Create <glebeProperty>(gleP); } substation _sub = new substation(); _sub.EleID = element.ID; _sub.SvgUID = this.SymbolDoc.SvgdataUid; IList substationList = Services.BaseService.GetList("SelectsubstationByEleID", _sub); foreach (substation sub in substationList) { sub.UID = Guid.NewGuid().ToString(); sub.LayerID = layer2.ID; sub.EleID = temp.ID; Services.BaseService.Create <substation>(sub); } } } this.SymbolDoc.NotifyUndo(); return(layer2); }
public SvgElementCollection Break(Graphics g) { SvgElementCollection collection1 = new SvgElementCollection(); if (this == this.OwnerTextElement) { this.currentPostion = PointF.Empty; } SvgDocument document1 = base.OwnerDocument; float single1 = this.Size; StringFormat format1 = this.GetGDIStringFormat(); 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); } int num1 = this.GetGDIStyle(); bool flag1 = document1.AcceptChanges; document1.AcceptChanges = false; foreach (XmlNode node1 in this.ChildNodes) { // GraphicsPath path1 = new GraphicsPath(); if (node1 is Text) { ((Text)node1).currentPostion = this.currentPostion; collection1.AddRange(((Text)node1).Break(g)); this.currentPostion = ((Text)node1).currentPostion; continue; } if (node1.NodeType == XmlNodeType.Text) { string text1 = this.TrimText(node1.Value); Font font1 = new Font(family1.Name, single1, (FontStyle)num1); float single2 = (((float)family1.GetCellAscent(FontStyle.Regular)) / ((float)family1.GetEmHeight(FontStyle.Regular))) * single1; // ISvgBrush brush1 = base.GraphBrush.Clone(); // ISvgBrush brush2 = base.GraphStroke.Brush.Clone(); CharEnumerator enumerator2 = text1.GetEnumerator(); while (enumerator2.MoveNext()) { char ch1 = enumerator2.Current; Text text2 = (Text)document1.CreateElement(document1.Prefix, "text", document1.NamespaceURI); text2.AppendChild(document1.CreateTextNode(ch1.ToString())); foreach (XmlAttribute attribute1 in this.Attributes) { text2.SetAttributeNode((XmlAttribute)attribute1.Clone()); } string text3 = ch1.ToString(); SizeF ef1 = g.MeasureString(text3, font1, new PointF(this.currentPostion.X, this.currentPostion.Y - single2), format1); float single3 = ef1.Width; AttributeFunc.SetAttributeValue(text2, "x", this.currentPostion.X.ToString()); AttributeFunc.SetAttributeValue(text2, "y", this.currentPostion.Y.ToString()); this.currentPostion.X += ((single3 * 3f) / 4f); collection1.Add(text2); } } } document1.AcceptChanges = flag1; return(collection1); }
/// <summary> /// Initializes a new instance of the <see cref="SvgElement"/> class. /// </summary> internal SvgElement() { this._children = new SvgElementCollection(this); this._eventHandlers = new EventHandlerList(); this._elementName = string.Empty; }
private static IEnumerable <SvgElement> PrepareFlatElements(SvgElementCollection collection, string groupName = null) { // Prepare a collection of elements that about to be rendered. if (collection != null) { foreach (var toRender in collection) { // Dont prepare for a separate parsing def lists. if (toRender is SvgDefinitionList) { continue; } var visual = toRender as SvgVisualElement; if (visual != null) { // Fix problem that SVG visual element lib style "display:none" is not recognized as visible state. if (visual.Visible && (visual.Display == "none" || visual.Display == "hidden")) { visual.Visible = false; visual.Display = null; } // Store opacity toRender.CustomAttributes.Add(visibilityAttribute, visual.Visible.ToString()); // Save current group to indicate that elements inside a group. if (!string.IsNullOrEmpty(groupName) && !toRender.ContainsAttribute(groupAttribute)) { // Store group info toRender.CustomAttributes.Add(groupAttribute, groupName); } } var group = toRender as SvgGroup; if (group != null) { groupName = GetLayerTitle(group); // Return fake node to indicate group end. (order is reversed) yield return(new PaintGroupBoundaries() { RelatedGroup = group, ID = string.Format(LayerGroupEnd, groupName) }); } var returned = PrepareFlatElements(toRender.Children, groupName); if (returned != null) { foreach (var output in returned) { yield return(output); } } if (group != null) { // Return fake node to indicate group start. yield return(new PaintGroupBoundaries() { ID = string.Format(LayerGroupBegin, groupName), IsStart = true, RelatedGroup = group }); } // Skip text with empty content. But keep all children nodes. var textNode = toRender as SvgTextBase; if (textNode != null && string.IsNullOrEmpty(textNode.Text)) { continue; } yield return(toRender); } } }
private Layer CopyLayer(Layer layer) { Layer layer2 = Layer.CreateNew(layer.Label + " 副本", this.SymbolDoc); layer2.SetAttribute("ParentID", layer.GetAttribute("ParentID")); //foreach (SvgElement g in layer.GraphList) //{ // layer2.GraphList.Add(g); //} SVG_LAYER la = new SVG_LAYER(); la.SUID = layer.ID; la.svgID = symbolDoc.SvgdataUid; la = (SVG_LAYER)Services.BaseService.GetObject("SelectSVG_LAYERByKey", la); if (la != null) { la.SUID = layer2.ID; la.NAME = layer2.Label; Services.BaseService.Create <SVG_LAYER>(la); } this.SymbolDoc.NumberOfUndoOperations = (2 * layer2.GraphList.Count) + 200; SvgElementCollection sc = layer.GraphList; for (int i = layer.GraphList.Count - 1; i >= 0; i--) { SvgElement element = sc[i] as SvgElement; SvgElement temp = element.Clone() as SvgElement; //if (temp.Name=="use"){ if (temp.GetAttribute("CopyOf") == "") { temp.SetAttribute("CopyOf", temp.ID); } //else //{ // temp.SetAttribute("CopyOf", temp.ID); //} //} IGraph graph = (IGraph)layer2.AddElement(temp); graph.Layer = layer2; /* LineInfo _line = new LineInfo(); * _line.EleID = element.ID; * _line.SvgUID = this.SymbolDoc.SvgdataUid; * IList lineInfoList = Services.BaseService.GetList("SelectLineInfoByEleID", _line); * foreach (LineInfo line in lineInfoList) * { * line.UID = Guid.NewGuid().ToString(); * line.LayerID = layer2.ID; * line.EleID = temp.ID; * Services.BaseService.Create<LineInfo>(line); * } * glebeProperty gle = new glebeProperty(); * gle.EleID = element.ID; * gle.SvgUID = this.SymbolDoc.SvgdataUid; * IList gleProList = Services.BaseService.GetList("SelectglebePropertyByEleID", gle); * foreach (glebeProperty gleP in gleProList) * { * gleP.UID = Guid.NewGuid().ToString(); * gleP.LayerID = layer2.ID; * gleP.EleID = temp.ID; * Services.BaseService.Create<glebeProperty>(gleP); * } * substation _sub = new substation(); * _sub.EleID = element.ID; * _sub.SvgUID = this.SymbolDoc.SvgdataUid; * IList substationList = Services.BaseService.GetList("SelectsubstationByEleID", _sub); * foreach (substation sub in substationList) * { * sub.UID = Guid.NewGuid().ToString(); * sub.LayerID = layer2.ID; * sub.EleID = temp.ID; * Services.BaseService.Create<substation>(sub); * }*/ } this.SymbolDoc.NotifyUndo(); return(layer2); }
// Methods internal State(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { graphList = new SvgElementCollection(); }
/// <summary> /// Test all visualelements in a SvgElementCollection for collisions and return the result as a list of PolygonCollisionResult /// </summary> /// <param name="elCol"></param> /// <param name="colCheckType">Optional</param> /// <param name="minimumArea">Optional, should only be used if a majority of objects should be excluded from collision detection as it otherwise can cause a large performance penalty</param> /// <param name="velocity">Optional to simulate movement of all objects in certain direction. Result stored in PolygonCollisionResult.WillIntersect.</param> /// <returns></returns> public static List<PolygonCollisionResult> checkForCollision(SvgElementCollection elCol, collisionCheckType colCheckType = collisionCheckType.Mixed, float minimumArea = 0, Vector velocity = default(Vector)) { _collisionResultList = new List<PolygonCollisionResult>(); _elCol = elCol; _velocity = velocity; _colCheckType = colCheckType; _minimumArea = minimumArea; iterate(elCol, elCol); return _collisionResultList; }
public static Brush GetGDIBrushFromSvgBrush(ISvgBrush brush) { if (brush is SolidColor) { return(new SolidBrush(((SolidColor)brush).Color)); } SvgElementCollection collection1 = null; if (brush is LinearGradient) { collection1 = ((LinearGradient)brush).Stops; } else { collection1 = ((RadialGradients)brush).Stops; } ColorBlend blend1 = new ColorBlend(collection1.Count); Color[] colorArray1 = new Color[collection1.Count]; float[] singleArray1 = new float[collection1.Count]; SvgElementCollection collection2 = collection1; for (int num1 = 0; num1 < collection2.Count; num1++) { GradientStop stop1 = (GradientStop)collection2[num1]; int num2 = 0xff; if ((stop1.Opacity >= 0f) && (stop1.Opacity <= 255f)) { if (stop1.Opacity <= 1f) { num2 = (int)(stop1.Opacity * 255f); } else { num2 = (int)stop1.Opacity; } } Color color1 = stop1.Color; float single1 = Math.Min((float)1f, Math.Max((float)0f, stop1.ColorOffset)); colorArray1[num1] = color1; singleArray1[num1] = single1; } 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 (brush is RadialGradients) { Array.Reverse(colorArray2); } Brush brush1 = null; blend1.Colors = colorArray2; blend1.Positions = singleArray2; if (brush is LinearGradient) { brush1 = new LinearGradientBrush(new Point(0, 0), new Point(1, 0), color2, color3); ((LinearGradientBrush)brush1).WrapMode = WrapMode.Tile; ((LinearGradientBrush)brush1).InterpolationColors = blend1; } else { GraphicsPath path1 = new GraphicsPath(); path1.AddEllipse(0, 0, 1, 1); brush1 = new PathGradientBrush(path1); ((PathGradientBrush)brush1).WrapMode = WrapMode.Tile; ((PathGradientBrush)brush1).InterpolationColors = blend1; } return(brush1); }
internal Layer(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { canSelect = true; islock = false; graphList = new SvgElementCollection(); }
private static void iterate(SvgElementCollection elementCollection1, SvgElementCollection elementCollection2) { foreach (SvgElement outerElement in elementCollection1) { if (outerElement.Children.Count != 0) iterate(outerElement.Children, elementCollection2); foreach (SvgElement innerElement in elementCollection2) { if (innerElement.Children.Count != 0) iterate(outerElement.Children, innerElement.Children); { if (innerElement is SvgVisualElement && outerElement is SvgVisualElement && outerElement != innerElement && !isParent(innerElement, outerElement)) { PolygonCollisionResult r = new PolygonCollisionResult(); try { if (_minimumArea != 0) { if (((SvgVisualElement)outerElement).PathOuterArea.Value < _minimumArea) break; if (((SvgVisualElement)innerElement).PathOuterArea.Value < _minimumArea) break; } if (outerElement is SvgCircle) ((SvgCircle)outerElement).Path.Flatten(); if (outerElement is SvgEllipse) ((SvgEllipse)outerElement).Path.Flatten(); if (innerElement is SvgCircle) ((SvgCircle)innerElement).Path.Flatten(); if (innerElement is SvgEllipse) ((SvgEllipse)innerElement).Path.Flatten(); PointF[] ptsA = ((SvgVisualElement)outerElement).Path.PathPoints; PointF[] ptsB = ((SvgVisualElement)innerElement).Path.PathPoints; switch (_colCheckType) { case collisionCheckType.LineCollision: r = LineIntersection.PolygonCollision(ptsA, ptsB); break; case collisionCheckType.SeparatingAxisTheorem: r = SeparatingAxisTheorem.PolygonCollision(ptsA, ptsB, _velocity); break; case collisionCheckType.Mixed: r = SeparatingAxisTheorem.PolygonCollision(ptsA, ptsB, _velocity); if (r.IsIntersecting) { PolygonCollisionResult t = LineIntersection.PolygonCollision( ptsA, ptsB); r.rayCastingResult = LineIntersection.RayCasting(ptsA, ptsB); r.OnPath = t.OnPath; r.LineIntersectingPoints = t.LineIntersectingPoints; } break; } } catch { } if (r.IsIntersecting == true || r.WillIntersect == true) { r.collidor = outerElement.ID ?? "-"; r.collidee = innerElement.ID ?? "-"; _collisionResultList.Add(r); } } } } } }
public SvgElementCollection Break(Graphics g) { SvgElementCollection collection1 = new SvgElementCollection(); if (this == this.OwnerTextElement) { this.currentPostion = PointF.Empty; } SvgDocument document1 = base.OwnerDocument; float single1 = this.Size; StringFormat format1 = this.GetGDIStringFormat(); 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); } int num1 = this.GetGDIStyle(); bool flag1 = document1.AcceptChanges; document1.AcceptChanges = false; foreach (XmlNode node1 in this.ChildNodes) { // GraphicsPath path1 = new GraphicsPath(); if (node1 is Text) { ((Text) node1).currentPostion = this.currentPostion; collection1.AddRange(((Text) node1).Break(g)); this.currentPostion = ((Text) node1).currentPostion; continue; } if (node1.NodeType == XmlNodeType.Text) { string text1 = this.TrimText(node1.Value); Font font1 = new Font(family1.Name, single1, (FontStyle) num1); float single2 = (((float) family1.GetCellAscent(FontStyle.Regular))/((float) family1.GetEmHeight(FontStyle.Regular)))*single1; // ISvgBrush brush1 = base.GraphBrush.Clone(); // ISvgBrush brush2 = base.GraphStroke.Brush.Clone(); CharEnumerator enumerator2 = text1.GetEnumerator(); while (enumerator2.MoveNext()) { char ch1 = enumerator2.Current; Text text2 = (Text) document1.CreateElement(document1.Prefix, "text", document1.NamespaceURI); text2.AppendChild(document1.CreateTextNode(ch1.ToString())); foreach (XmlAttribute attribute1 in this.Attributes) { text2.SetAttributeNode((XmlAttribute) attribute1.Clone()); } string text3 = ch1.ToString(); SizeF ef1 = g.MeasureString(text3, font1, new PointF(this.currentPostion.X, this.currentPostion.Y - single2), format1); float single3 = ef1.Width; AttributeFunc.SetAttributeValue(text2, "x", this.currentPostion.X.ToString()); AttributeFunc.SetAttributeValue(text2, "y", this.currentPostion.Y.ToString()); this.currentPostion.X += ((single3*3f)/4f); collection1.Add(text2); } } } document1.AcceptChanges = flag1; return collection1; }
//List<SvgVisualElement> toAdd; //public void drawCirclePath(SvgElementCollection elcol) //{ // toAdd = new List<SvgVisualElement>(); // _drawCirclePath(elcol); // foreach (SvgVisualElement els in toAdd) // { // FSvgDoc.Children.Add(els); // } // pictureBox1.Image = FSvgDoc.Draw(); //} //private void _drawCirclePath(SvgElementCollection elcol) //{ // SvgPolygon lolo; // foreach (SvgElement el in elcol) // { // if (el.Children.Count != 0) _drawCirclePath(el.Children); // if (el is SvgCircle) // { // lolo = new SvgPolygon // { // Points = new SvgUnitCollection(), // Fill = SvgPaintServer.None, // Stroke = new SvgColourServer(Color.Black), // StrokeWidth = 2, // ID = ((SvgCircle)el).ID + "_convToPath" // }; // foreach (PointF pt in ((SvgCircle)el).Path.PathPoints) // { // lolo.Points.Add(pt.X); // lolo.Points.Add(pt.Y); // } // toAdd.Add((SvgVisualElement)lolo); // } // } //} private void IterateKids(SvgElementCollection elCol) { foreach (SvgElement el in elCol) { if (el is Svg.SvgGroup) { Svg.SvgGroup bla = (Svg.SvgGroup)el; } if (el.Children.Count == 0) { if (el.ID != null) { //Debug.WriteLine(el.ID.ToString()); } else { //Debug.WriteLine("No id"); } if (el is Svg.SvgCircle) { Svg.SvgCircle bla = (Svg.SvgCircle)el; } else if (el is Svg.SvgEllipse) { Svg.SvgEllipse bla = (Svg.SvgEllipse)el; } else if (el is Svg.SvgLine) { Svg.SvgLine bla = (Svg.SvgLine)el; } else if (el is Svg.SvgPath) { Svg.SvgPath bla = (Svg.SvgPath)el; } else if (el is Svg.SvgPolygon) { Svg.SvgPolygon bla = (Svg.SvgPolygon)el; } else if (el is Svg.SvgPolyline) { Svg.SvgPolyline bla = (Svg.SvgPolyline)el; } else if (el is Svg.SvgPath) { Svg.SvgPath bla = (Svg.SvgPath)el; } else if (el is Svg.SvgRectangle) { Svg.SvgRectangle bla = (Svg.SvgRectangle)el; } else if (el is Svg.SvgText) { Svg.SvgText bla = (Svg.SvgText)el; } } else { IterateKids(el.Children); } } }
// Methods internal State(string prefix, string localname, string ns, SvgDocument doc) : base(prefix, localname, ns, doc) { graphList =new SvgElementCollection(); }
public void OnMouseDown(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (this.mouseAreaControl.Cursor == this.mouseAreaControl.DefaultCursor) { PointF tf1 = new PointF((float)e.X, (float)e.Y); SvgElementCollection collection1 = this.mouseAreaControl.SVGDocument.SelectCollection; if (collection1 != null) { for (int num1 = collection1.Count - 1; num1 >= 0; num1--) { if (collection1[num1] is IGraphPath) { IGraph graph1 = (IGraphPath)collection1[num1]; GraphicsPath path1 = (GraphicsPath)graph1.GPath.Clone(); Matrix matrix1 = graph1.GraphTransform.Matrix.Clone(); path1.Transform(matrix1); Pen pen1 = new Pen(Color.Blue, 4f); pen1.Alignment = PenAlignment.Center; bool flag1 = false; flag1 = path1.IsVisible(tf1); if (path1.IsOutlineVisible(tf1, pen1)) { flag1 = true; } if (flag1) { this.ActiveGraph = (IGraphPath)graph1; return; } } } collection1 = this.mouseAreaControl.PicturePanel.ElementList; for (int num2 = collection1.Count - 1; num2 >= 0; num2--) { if (collection1[num2] is IGraphPath) { IGraph graph2 = (IGraphPath)collection1[num2]; GraphicsPath path2 = (GraphicsPath)graph2.GPath.Clone(); Matrix matrix2 = graph2.GraphTransform.Matrix.Clone(); path2.Transform(matrix2); Pen pen2 = new Pen(Color.Blue, 4f); pen2.Alignment = PenAlignment.Center; bool flag2 = false; flag2 = path2.IsVisible(tf1); if (path2.IsOutlineVisible(tf1, pen2)) { flag2 = true; } if (flag2) { this.ActiveGraph = (IGraphPath)graph2; return; } } } this.activeGraph = null; this.mouseAreaControl.Invalidate(); } } else { this.startPoint = new PointF((float)e.X, (float)e.Y); this.reversePath.Reset(); } } }
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); }