public override void Draw(VertexStoreSnap snap) { _canvas.DrawGfxPath( this._strokeColor, InternalGraphicsPath.CreateGraphicsPath(snap) ); }
public override void Fill(VertexStore vxs) { _canvas.FillGfxPath( _fillColor, InternalGraphicsPath.CreateGraphicsPath(new VertexStoreSnap(vxs)) ); }
public override void PaintSeries(VertexStore vxs, Color[] colors, int[] pathIndexs, int numPath) { //TODO: review here. // for (int i = 0; i < numPath; ++i) { _canvas.FillGfxPath(colors[i], InternalGraphicsPath.CreateGraphicsPath(new VertexStoreSnap(vxs, pathIndexs[i]))); } }
public void FillRoundRect(Color color, float x, float y, float w, float h, float rx, float ry) { roundRect.SetRect(x, y, x + w, y + h); roundRect.SetRadius(rx, ry); //create round rect vxs var vxs = roundRect.MakeVxs(GetFreeVxs()); _canvas.FillGfxPath(_fillColor, InternalGraphicsPath.CreateGraphicsPath(new VertexStoreSnap(vxs))); ReleaseVxs(ref vxs); }
public override void DrawEllipse(double left, double bottom, double right, double top) { double x = (left + right) / 2; double y = (bottom + top) / 2; double rx = Math.Abs(right - x); double ry = Math.Abs(top - y); ellipse.Reset(x, y, rx, ry); VertexStore vxs = ellipse.MakeVxs(GetFreeVxs()); _canvas.DrawGfxPath(_strokeColor, InternalGraphicsPath.CreateGraphicsPath(new VertexStoreSnap(vxs))); ReleaseVxs(ref vxs); }
public void DrawRoundRect(float x, float y, float w, float h, float rx, float ry) { roundRect.SetRect(x, y, x + w, y + h); roundRect.SetRadius(rx, ry); _aggStroke.Width = this.StrokeWidth; var v1 = GetFreeVxs(); var v2 = GetFreeVxs(); _aggStroke.MakeVxs(roundRect.MakeVxs(v1), v2); _canvas.DrawGfxPath(_strokeColor, InternalGraphicsPath.CreateGraphicsPath(new VertexStoreSnap(v2))); ReleaseVxs(ref v2); ReleaseVxs(ref v1); }
public override void DrawBezierCurve(float startX, float startY, float endX, float endY, float controlX1, float controlY1, float controlX2, float controlY2) { var v1 = GetFreeVxs(); BezierCurve.CreateBezierVxs4(v1, new PixelFarm.VectorMath.Vector2(startX, startY), new PixelFarm.VectorMath.Vector2(endX, endY), new PixelFarm.VectorMath.Vector2(controlX1, controlY1), new PixelFarm.VectorMath.Vector2(controlY2, controlY2)); _aggStroke.Width = this.StrokeWidth; var v2 = GetFreeVxs(); _canvas.DrawGfxPath(_canvas.StrokeColor, InternalGraphicsPath.CreateGraphicsPath(new VertexStoreSnap(_aggStroke.MakeVxs(v1, v2)))); ReleaseVxs(ref v2); ReleaseVxs(ref v1); }
//--------------------------------------------------------------------- public void DrawArc(float fromX, float fromY, float endX, float endY, float xaxisRotationAngleDec, float rx, float ry, SvgArcSize arcSize, SvgArcSweep arcSweep) { //------------------ //SVG Elliptical arc ... //from Apache Batik //----------------- CenterFormArc centerFormArc = new CenterFormArc(); ComputeArc2(fromX, fromY, rx, ry, DegToRad(xaxisRotationAngleDec), arcSize == SvgArcSize.Large, arcSweep == SvgArcSweep.Negative, endX, endY, ref centerFormArc); arcTool.Init(centerFormArc.cx, centerFormArc.cy, rx, ry, centerFormArc.radStartAngle, (centerFormArc.radStartAngle + centerFormArc.radSweepDiff)); VertexStore v1 = GetFreeVxs(); bool stopLoop = false; foreach (VertexData vertexData in arcTool.GetVertexIter()) { switch (vertexData.command) { case VertexCmd.NoMore: stopLoop = true; break; default: v1.AddVertex(vertexData.x, vertexData.y, vertexData.command); //yield return vertexData; break; } //------------------------------ if (stopLoop) { break; } } double scaleRatio = 1; if (centerFormArc.scaleUp) { int vxs_count = v1.Count; double px0, py0, px_last, py_last; v1.GetVertex(0, out px0, out py0); v1.GetVertex(vxs_count - 1, out px_last, out py_last); double distance1 = Math.Sqrt((px_last - px0) * (px_last - px0) + (py_last - py0) * (py_last - py0)); double distance2 = Math.Sqrt((endX - fromX) * (endX - fromX) + (endY - fromY) * (endY - fromY)); if (distance1 < distance2) { scaleRatio = distance2 / distance1; } else { } } if (xaxisRotationAngleDec != 0) { //also rotate if (centerFormArc.scaleUp) { var mat = PixelFarm.Agg.Transform.Affine.NewMatix( new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Translate, -centerFormArc.cx, -centerFormArc.cy), new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Scale, scaleRatio, scaleRatio), new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Rotate, DegToRad(xaxisRotationAngleDec)), new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Translate, centerFormArc.cx, centerFormArc.cy)); var v2 = GetFreeVxs(); mat.TransformToVxs(v1, v2); ReleaseVxs(ref v1); v1 = v2; } else { //not scalue var mat = PixelFarm.Agg.Transform.Affine.NewMatix( new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Translate, -centerFormArc.cx, -centerFormArc.cy), new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Rotate, DegToRad(xaxisRotationAngleDec)), new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Translate, centerFormArc.cx, centerFormArc.cy)); var v2 = GetFreeVxs(); mat.TransformToVxs(v1, v2); ReleaseVxs(ref v1); v1 = v2; } } else { //no rotate if (centerFormArc.scaleUp) { var mat = PixelFarm.Agg.Transform.Affine.NewMatix( new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Translate, -centerFormArc.cx, -centerFormArc.cy), new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Scale, scaleRatio, scaleRatio), new PixelFarm.Agg.Transform.AffinePlan(PixelFarm.Agg.Transform.AffineMatrixCommand.Translate, centerFormArc.cx, centerFormArc.cy)); var v2 = GetFreeVxs(); mat.TransformToVxs(v1, v2); ReleaseVxs(ref v1); v1 = v2; } } _aggStroke.Width = this.StrokeWidth; var v3 = _aggStroke.MakeVxs(v1, GetFreeVxs()); _canvas.DrawGfxPath(_canvas.StrokeColor, InternalGraphicsPath.CreateGraphicsPath(new VertexStoreSnap(v3))); ReleaseVxs(ref v3); ReleaseVxs(ref v1); }
//----------------------------------------------------------------------------------------------------------------- public override RenderVx CreateRenderVx(VertexStoreSnap snap) { //store internal gfx path inside render vx return(new GLRenderVx(InternalGraphicsPath.CreateGraphicsPath(snap))); }