public void Dispose_Clone () { TextureBrush t = new TextureBrush (image); t.Dispose (); t.Clone (); }
/// <summary> /// ��· /// </summary> /// <param name="g"></param> /// <param name="time"></param> private void Draw2(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.StrokeOpacity; if (this.svgAnimAttributes.ContainsKey("fill-opacity")) { single1 = Math.Min(single1, (float)this.svgAnimAttributes["fill-opacity"]); } ISvgBrush brush1 = this.GraphBrush; using (GraphicsPath path1 = (GraphicsPath)this.GPath.Clone()) { path1.Transform(base.GraphTransform.Matrix); if (!base.ShowBound) { float width1 = Width * GraphTransform.Matrix.Elements[0]; Stroke stroke = Stroke.GetStroke(this); Color color1 = Color.FromArgb(75, 75, 75); if (stroke.StrokeColor.ToArgb()!=Color.Black.ToArgb()) color1 = stroke.StrokeColor; using (Pen p = new Pen(Color.FromArgb((int)(single1 * 255), color1))) { p.Width = width1; g.DrawPath(p, path1); } if (LineType == "3") { using (Pen p = new Pen(Color.Yellow)) { if (width1 > 30) p.Width = 2; else p.Width = 1; //p.DashPattern = new float[] { 10, 10 }; g.DrawPath(p, path1); } } else { //using (Pen p = new Pen(Color.Yellow)) { // if (width1 > 30) // p.Width = 2; // else // p.Width = 1; // g.DrawPath(p, path1); //} } if (LineType == "4") { using (Pen p = new Pen(Color.FromArgb((int)(single1*255),color1))) { p.Width = width1; float f22 = width1 / 4f; ImageAttributes imageAttributes = new ImageAttributes(); ColorMatrix cmatrix1 = new ColorMatrix(); cmatrix1.Matrix00 = 1f; cmatrix1.Matrix11 = 1f; cmatrix1.Matrix22 = 1f; cmatrix1.Matrix33 = single1;//���� cmatrix1.Matrix44 = 1f; //�������� imageAttributes.SetColorMatrix(cmatrix1, ColorMatrixFlag.Default, ColorAdjustType.Default); if (BackgroundImage == null) BackgroundImageFile = "road.png"; TextureBrush tbush = new TextureBrush(BackgroundImage,new Rectangle(0,0,BackgroundImage.Width,BackgroundImage.Height),imageAttributes); tbush.WrapMode = WrapMode.Tile; for (int i = 0; i < path1.PointCount - 1;i++ ) { float k = (path1.PathPoints[i+1].Y - path1.PathPoints[i].Y) / (path1.PathPoints[i+1].X - path1.PathPoints[i].X); float y1 = path1.PathPoints[i].Y - path1.PathPoints[i+1].Y; float y2 = path1.PathPoints[i].X - path1.PathPoints[i+1].X; float k2 = (float)Math.Abs(k); float angle = (float)Math.Atan(k2) * 180 / (float)Math.PI; if (k < 0) { angle = 360-angle; } PointF[] pts = new PointF[] { new PointF(path1.PathPoints[i].X, path1.PathPoints[i].Y - 26) }; Matrix matrix11 = new Matrix(); matrix11.RotateAt(angle, path1.PathPoints[i]); matrix11.Translate(path1.PathPoints[i].X, path1.PathPoints[i].Y); matrix11.Scale(width1 / 50, width1 / 50); //tbush.ScaleTransform(width1 / 50, width1 / 50, MatrixOrder.Append); //tbush.RotateTransform(angle, MatrixOrder.Append); //tbush.TranslateTransform(path1.PathPoints[i].X, path1.PathPoints[i].Y , MatrixOrder.Append); tbush.Transform = matrix11; p.Brush = tbush.Clone() as TextureBrush; p.Alignment = PenAlignment.Center; g.DrawLine(p, path1.PathPoints[i], path1.PathPoints[i + 1]); tbush.ResetTransform(); } } if (BackgroundImageFile == "road.png") { using (Pen p = new Pen(Color.Yellow)) { if (width1 > 30) p.Width = 2; else p.Width = 1; 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; } }
public void Clone () { TextureBrush t = new TextureBrush (image); TextureBrush clone = (TextureBrush) t.Clone (); Common (clone, t.WrapMode); }