static void AddRect(GeometrySink pSink, RawRectangleF rect, float r) { ArcSegment arcSeg = new ArcSegment(); arcSeg.ArcSize = ArcSize.Small; arcSeg.Point = new RawVector2(rect.Left + r, rect.Top); arcSeg.RotationAngle = 90; arcSeg.Size = new Size2F(r, r); arcSeg.SweepDirection = SweepDirection.Clockwise; pSink.AddArc(arcSeg); pSink.AddLine(new RawVector2(rect.Right - r, rect.Top)); // arcSeg.Point = new RawVector2(rect.Right, rect.Top + r); pSink.AddArc(arcSeg); pSink.AddLine(new RawVector2(rect.Right, rect.Bottom - r)); // arcSeg.Point = new RawVector2(rect.Right - r, rect.Bottom); pSink.AddArc(arcSeg); pSink.AddLine(new RawVector2(rect.Left + r, rect.Bottom)); arcSeg.Point = new RawVector2(rect.Left, rect.Bottom - r); pSink.AddArc(arcSeg); pSink.AddLine(new RawVector2(rect.Left, rect.Top + r)); }
public void AddCurve(Point point, float radius) { _sink.AddArc(new ArcSegment { Point = point, Size = new Size2F(radius, radius) }); }
public void AddCurve(Primitives.Point point, float radius) { _sink.AddArc(new ArcSegment() { Point = point, Size = new SharpDX.Size2F(radius, radius) }); }
public static void addCounterClockwise(RectangleF r, double start, double stop, GeometrySink sink) { var rx = r.Width / 2; var ry = r.Height / 2; var angle = start; // the quality of Direct2D arcs are lousy, so we render them in 16 segments per circle const int MaxSegments = 16; const double SegmentAngle = Math.PI * 2 / MaxSegments; for (var segment = 0; angle > stop && segment != MaxSegments; ++segment) { var angleLeft = angle - stop; var angleNow = Math.Min(SegmentAngle, angleLeft); var nextAngle = angle - angleNow; var nextPoint = pointOn(r, nextAngle); sink.AddArc(new ArcSegment { ArcSize = ArcSize.Small, Size = new DrawingSizeF(rx, ry), Point = nextPoint, RotationAngle = angleNow.import(), SweepDirection = SweepDirection.CounterClockwise }); angle = nextAngle; } }
protected GeometrySink CreateSectionSweepGeometry() { //扇形的X轴Y轴半径是矩形框width的一半 SizeF size = new SizeF(displayer.coordinateSystem.CoordinateArea.Width / 2, height: displayer.coordinateSystem.CoordinateArea.Height / 2); _pie = displayer.Factory.CreatePathGeometry(); //扇形区域 //开始合成扇形 GeometrySink gs = _pie.Open(); gs.BeginFigure(displayer.coordinateSystem.OriginalPoint, FigureBegin.Filled); //添加第一条线 gs.AddLine(BeginLinePoint); //原始代码 //添加弧线 ArcSegment arc = new ArcSegment(EndLinePoint, size, 0, SweepDirection.Clockwise, ArcSize.Small); gs.AddArc(arc); //添加第二条线 gs.AddLine(displayer.coordinateSystem.OriginalPoint); gs.EndFigure(FigureEnd.Closed); gs.Close(); return(gs); }
protected override PathGeometry GetPathGeometry(SweepSection s, RenderTarget t) { var pbegin = CalIntersectionPoint(s.Begin + RotateAngle); var pend = CalIntersectionPoint(s.End + RotateAngle); PathGeometry sweepSectionGraphic = t.Factory.CreatePathGeometry(); GeometrySink gs = sweepSectionGraphic.Open(); Point2F oPoint = ReferenceSystem.ScreenOriginalPoint.ToPoint2F(); gs.BeginFigure(oPoint, FigureBegin.Filled); gs.AddLine(pbegin.ToPoint2F()); //扇形的X轴Y轴半径是矩形框width的一半 SizeF size = new SizeF((float)ReferenceSystem.ScreenWidth / 2, (float)ReferenceSystem.ScreenWidth / 2); //添加弧线 ArcSegment arc = new ArcSegment(pend.ToPoint2F(), size, 0, SweepDirection.Clockwise, ArcSize.Small); gs.AddArc(arc); //添加第二条线 gs.AddLine(oPoint); gs.EndFigure(FigureEnd.Closed); gs.Close(); gs.Dispose(); return(sweepSectionGraphic); }
private void Arc(VectorCommand instruction, bool isRelative) { for (int i = 0; i < instruction.Arguments.Length; i = i + 6) { float w = instruction.Arguments[0]; float h = instruction.Arguments[1]; float a = instruction.Arguments[2]; bool isLargeArc = (int)instruction.Arguments[3] == 1; bool sweepDirection = (int)instruction.Arguments[4] == 1; var p = new Vector2(instruction.Arguments[5], instruction.Arguments[6]); if (isRelative) { p += _previousPoint; } var arcSegment = new ArcSegment { ArcSize = isLargeArc ? ArcSize.Large : ArcSize.Small, RotationAngle = a, SweepDirection = sweepDirection ? SweepDirection.Clockwise : SweepDirection.CounterClockwise, Point = p, Size = new Size2F(w, h) }; _sink.AddArc(arcSegment); } }
/// <summary> /// Adds a curved line to the currently open figure. /// </summary> /// <param name="point">The end point of the curved line.</param> /// <param name="radius">The radius of the resulting arc in degrees.</param> /// <param name="rotationAngle">A value determining the rotation angle this curve.</param> public void AddCurve(Point point, float radius, float rotationAngle = 0.0f) { bool minus = radius < 0.0f; if (minus) { radius *= -1.0f; } var arc = new ArcSegment() { ArcSize = radius > 179.0f ? ArcSize.Large : ArcSize.Small, Point = point, RotationAngle = rotationAngle, Size = new Size2F(radius, radius), SweepDirection = minus ? SweepDirection.Clockwise : SweepDirection.CounterClockwise }; _sink.AddArc(arc); }
/// <summary> /// 使用当前的路径填充指定的路径几何。 /// </summary> /// <param name="sink">要填充的路径几何。</param> public override void FillGeometry(GeometrySink sink) { D2D1.ArcSegment arc = new D2D1.ArcSegment() { Point = EndPoint, Size = Size, RotationAngle = RotationAngle, SweepDirection = SweepDirection, ArcSize = ArcSize }; sink.AddArc(arc); }
// Methods public TArc(Factory _factory) { FigureType = "Arc"; GeometrySink sink = orginGeomtery.Open(); sink.BeginFigure(_mpoint[0], FigureBegin.Filled); for (int i = 1; i < _mpoint.Count - 1; i++) { sink.AddArc(new ArcSegment())(_mpoint[i]); } sink.EndFigure(FigureEnd.Open); sink.Close(); }
/// <summary> /// Adds an arc of an elipse to the end of the path. /// </summary> /// <param name="to">The end point of the arc.</param> /// <param name="radius">The radius of the arc.</param> /// <param name="angle">The angle of the arc, in radians.</param> /// <param name="clockwise">If set to <see langword="true" /> the arc will be drawn clockwise.</param> /// <param name="isLarge">Specifies whether the given arc is larger than 180 degrees</param> /// <returns> /// This <see cref="IGraphicsPath" />. /// </returns> public IGraphicsPath AddArc(Vector2 to, Vector2 radius, float angle, bool clockwise, bool isLarge) { _sink?.AddArc( new ArcSegment { Point = to.ToRawVector2(), RotationAngle = (float)(angle * 180 / Math.PI), Size = radius.ToSize2F(), SweepDirection = clockwise ? SweepDirection.Clockwise : SweepDirection.CounterClockwise, ArcSize = isLarge ? ArcSize.Large : ArcSize.Small }); return(this); }
public void AddPathSegment(GeometrySink canvasPathBuilder, ref bool closed) { canvasPathBuilder.AddArc(new ArcSegment { Point = _endPoint.ToRaw(), RotationAngle = (float)MathExt.ToRadians(_sweepAngle), SweepDirection = SweepDirection.Clockwise, ArcSize = ArcSize.Small, Size = new Size2F(_a, _b) }); closed = false; }
public override void Draw() { if (isMouseDown && Math.Abs(beginAngle - dragAngle) > sweepAngleMinimum) { Pie = displayer.Factory.CreatePathGeometry(); //扇形区域 //开始合成扇形 GeometrySink gs = Pie.Open(); gs.BeginFigure(displayer.coordinateSystem.OriginalPoint, FigureBegin.Filled); //添加第一条线 //float angle1 = CoordinateSystem.AngleToNorth(displayer.coordinateSystem.OriginalPoint, beginLinePoint); //angle1 -= 30; //if (angle1 < 0) // angle1 += 360; //Point2F p = displayer.coordinateSystem.CalIntersectionPoint(angle1); //gs.AddLine(p); gs.AddLine(beginLinePoint); //原始代码 //判断起始角度和结束角度 float begin = Tools.FindSmallArcBeginAngle(beginAngle, dragAngle); float end = Tools.FindSmallArcEndAngle(beginAngle, dragAngle); //判断上行扫过的方向,如果起始角度是鼠标点击的位置则扇形是顺时针扫过 //如果起始角度是鼠标拖动位置,则扇形是逆时针扫过 SweepDirection sd; sd = Tools.FloatEquals(begin, beginAngle) ? SweepDirection.Clockwise : SweepDirection.Counterclockwise; //扇形的X轴Y轴半径是矩形框width的一半 SizeF size = new SizeF(displayer.coordinateSystem.CoordinateArea.Width / 2, displayer.coordinateSystem.CoordinateArea.Height / 2); //添加弧线 ArcSegment arc = new ArcSegment(dragLinePoint, size, 0, sd, ArcSize.Small); gs.AddArc(arc); //添加第二条线 gs.AddLine(displayer.coordinateSystem.OriginalPoint); gs.EndFigure(FigureEnd.Closed); gs.Close(); //绘制区域 displayer.Canvas.FillGeometry(Pie, antennaRangeAreaBrush); displayer.Canvas.DrawGeometry(Pie, antennaRangeAreaBrush, 3); //释放资源 gs.Dispose(); Pie.Dispose(); } }
public void ArcTo( Point point, Size size, double rotationAngle, bool isLargeArc, Perspex.Media.SweepDirection sweepDirection) { _sink.AddArc(new ArcSegment { Point = point.ToSharpDX(), Size = size.ToSharpDX(), RotationAngle = (float)rotationAngle, ArcSize = isLargeArc ? ArcSize.Large : ArcSize.Small, SweepDirection = (SweepDirection)sweepDirection, }); }
/// <summary> /// Draws an arc with the passed parameters /// Take care with the usage, because arcs are costly to draw /// </summary> /// <param name="renderTarget"></param> /// <param name="brush"></param> /// <param name="center"></param> /// <param name="radius"></param> /// <param name="startAngle"></param> /// <param name="sweepAngle"></param> /// <param name="strokeWidth"></param> public static void Draw(RenderTarget renderTarget, Brush brush, Vector2 center, float radius, float startAngle, float sweepAngle, float strokeWidth = 1f) { if (sweepAngle <= 0f) { throw new ArgumentException("Sweep angle is 0 or below"); } if (renderTarget.IsDisposed) { throw new ObjectDisposedException(nameof(renderTarget)); } radius = Math.Max(radius, 1f); ArcSegment arcSegment = new ArcSegment(); arcSegment.ArcSize = sweepAngle > 180f ? ArcSize.Large : ArcSize.Small; arcSegment.Point = PointOnCircle(center, radius, startAngle - (sweepAngle >= 360f ? 359.9f : sweepAngle)); arcSegment.RotationAngle = 0f; arcSegment.Size = new Size2F(radius, radius); arcSegment.SweepDirection = SweepDirection.CounterClockwise; using (PathGeometry path = new PathGeometry(Factory)) using (GeometrySink sink = path.Open()) { sink.BeginFigure(PointOnCircle(center, radius, startAngle), FigureBegin.Filled); sink.AddArc(arcSegment); sink.EndFigure(FigureEnd.Open); sink.Close(); renderTarget.DrawGeometry(path, brush, strokeWidth); } renderTarget.AntialiasMode = AntialiasMode.PerPrimitive; }
public OverSweepSectionView(AngleArea sweepSection, GraphicTrackDisplayer displayer) : base(sweepSection, displayer) { _sweepSectionGraphic = displayer.Factory.CreatePathGeometry(); GeometrySink gs = _sweepSectionGraphic.Open(); gs.BeginFigure(displayer.coordinateSystem.OriginalPoint, FigureBegin.Filled); gs.AddLine(_beginLinePoint); //扇形的X轴Y轴半径是矩形框width的一半 SizeF size = new SizeF((float)displayer.coordinateSystem.CoordinateArea.Width / 2, (float)displayer.coordinateSystem.CoordinateArea.Height / 2); //添加弧线 ArcSegment arc = new ArcSegment(_endLinePoint, size, 0, SweepDirection.Clockwise, ArcSize.Small); gs.AddArc(arc); //添加第二条线 gs.AddLine(displayer.coordinateSystem.OriginalPoint); gs.EndFigure(FigureEnd.Closed); gs.Close(); _centerSectorBorder = displayer.Canvas.CreateSolidColorBrush(new ColorF(1, 1, 0)); }
// FIXME another example of type switching. Cant put d2d code on other side of bridge in eg UGeometryBase abstraction // and also, using a factory to create the UGeometryBase will make d2d specific versions. // IDEA This is possible: Use factory (DI?) and check the Uxxx instances when passed to this type of class, and recreate // a portion of the Uxxx if it doesnt match D2D? Factory could be configured for d2d/ogl etc. This links in with cacheing // code too? Not sure if this will static compile :/ thats kinda the point... we'd need the Uxxx.ICreateStuff to be a specific // D2D interface...could subclass... would check if(ICreateStuff is D2DCreator) as d2dcreator else Icreatestuff=new d2dcreator... void AppendGeometry(GeometrySink sink, UGeometryBase geo) { if (geo is UArc) { UArc arc = geo as UArc; sink.AddArc(new ArcSegment() { SweepDirection = arc.sweepClockwise ? SweepDirection.Clockwise : SweepDirection.CounterClockwise, RotationAngle = -arc.rotation, ArcSize = arc.reflex ? ArcSize.Large : ArcSize.Small, Point = D2DTr.tr(arc.endPoint), Size = D2DTr.tr(arc.arcSize) }); } //else if (geo is UEasyArc) //{ // UEasyArc arc = geo as UEasyArc; // var eco = geo.Retreive<D2DDraw>(() => // { // var cp = gcpt(); // return EllipseLib.EasyEllipse.ConvertEndPoint(new EllipseLib.EasyEllipse.EasyEllipseInput() // { // resolution = arc.resolution, // t1 = arc.startAngle, // t2 = arc.endAngle, // rx = arc.arcSize.width, // ry = arc.arcSize.height, // rotation = arc.rotation, // start_x = cp.X, // start_y = cp.Y // }); // }) as EllipseLib.EasyEllipse.EECOut; // sink.AddArc(new ArcSegment() // { // SweepDirection = eco.clockwise ? SweepDirection.Clockwise : SweepDirection.CounterClockwise, // RotationAngle = -arc.rotation, // ArcSize = eco.reflex ? ArcSize.Large : ArcSize.Small, // Point = new SharpDXLib.DrawingPointF(eco.x, eco.y), // Size = D2DTr.tr(arc.arcSize) // }); //} else if (geo is ULine) { ULine line = geo as ULine; sink.AddLine(D2DTr.tr(line.endPoint)); } else if (geo is UBeizer) { UBeizer beizer = geo as UBeizer; sink.AddBezier(new BezierSegment() { Point1 = D2DTr.tr(beizer.controlPoint1), Point2 = D2DTr.tr(beizer.controlPoint2), Point3 = D2DTr.tr(beizer.endPoint) }); } else { throw new NotImplementedException(); } }
protected override void OnCreateDeviceIndependentResources(Direct2DFactory factory) { base.OnCreateDeviceIndependentResources(factory); this._leftMountainGeometry = factory.CreatePathGeometry(); using (GeometrySink sink = this._leftMountainGeometry.Open()) { sink.SetFillMode(FillMode.Winding); sink.BeginFigure(new PointF(346, 255), FigureBegin.Filled); sink.AddLines( new PointF[] { new PointF(267, 177), new PointF(236, 192), new PointF(212, 160), new PointF(156, 255), new PointF(346, 255) }); sink.EndFigure(FigureEnd.Closed); sink.Close(); } this._rightMountainGeometry = factory.CreatePathGeometry(); using (GeometrySink sink = this._rightMountainGeometry.Open()) { sink.SetFillMode(FillMode.Winding); sink.BeginFigure(new PointF(575, 263), FigureBegin.Filled); sink.AddLines( new PointF[] { new PointF(481, 146), new PointF(449, 181), new PointF(433, 159), new PointF(401, 214), new PointF(381, 199), new PointF(323, 263), new PointF(575, 263) }); sink.EndFigure(FigureEnd.Closed); sink.Close(); } this._sunGeometry = factory.CreatePathGeometry(); using (GeometrySink sink = this._sunGeometry.Open()) { sink.SetFillMode(FillMode.Winding); sink.BeginFigure(new PointF(270, 255), FigureBegin.Filled); sink.AddArc( new ArcSegment( new PointF(440, 255), // end point new SizeF(85, 85), 0.0f, // rotation angle SweepDirection.Clockwise, ArcSize.Small)); sink.EndFigure(FigureEnd.Closed); sink.BeginFigure(new PointF(299, 182), FigureBegin.Hollow); sink.AddBezier( new BezierSegment( new PointF(299, 182), new PointF(294, 176), new PointF(285, 178) )); sink.AddBezier( new BezierSegment( new PointF(276, 179), new PointF(272, 173), new PointF(272, 173) )); sink.EndFigure(FigureEnd.Open); sink.BeginFigure( new PointF(354, 156), FigureBegin.Hollow ); sink.AddBezier( new BezierSegment( new PointF(354, 156), new PointF(358, 149), new PointF(354, 142) )); sink.AddBezier( new BezierSegment( new PointF(349, 134), new PointF(354, 127), new PointF(354, 127) )); sink.EndFigure(FigureEnd.Open); sink.BeginFigure( new PointF(322, 164), FigureBegin.Hollow ); sink.AddBezier( new BezierSegment( new PointF(322, 164), new PointF(322, 156), new PointF(314, 152) )); sink.AddBezier( new BezierSegment( new PointF(306, 149), new PointF(305, 141), new PointF(305, 141) )); sink.EndFigure(FigureEnd.Open); sink.BeginFigure( new PointF(385, 164), FigureBegin.Hollow ); sink.AddBezier( new BezierSegment( new PointF(385, 164), new PointF(392, 161), new PointF(394, 152) )); sink.AddBezier( new BezierSegment( new PointF(395, 144), new PointF(402, 141), new PointF(402, 142) )); sink.EndFigure(FigureEnd.Open); sink.BeginFigure( new PointF(408, 182), FigureBegin.Hollow ); sink.AddBezier( new BezierSegment( new PointF(408, 182), new PointF(416, 184), new PointF(422, 178) )); sink.AddBezier( new BezierSegment( new PointF(428, 171), new PointF(435, 173), new PointF(435, 173) )); sink.EndFigure(FigureEnd.Open); sink.Close(); } this._riverGeometry = factory.CreatePathGeometry(); using (GeometrySink sink = this._riverGeometry.Open()) { sink.SetFillMode(FillMode.Winding); sink.BeginFigure( new PointF(183, 392), FigureBegin.Filled ); sink.AddBezier( new BezierSegment( new PointF(238, 284), new PointF(472, 345), new PointF(356, 303) )); sink.AddBezier( new BezierSegment( new PointF(237, 261), new PointF(333, 256), new PointF(333, 256) )); sink.AddBezier( new BezierSegment( new PointF(335, 257), new PointF(241, 261), new PointF(411, 306) )); sink.AddBezier( new BezierSegment( new PointF(574, 350), new PointF(288, 324), new PointF(296, 392) )); sink.EndFigure(FigureEnd.Open); sink.Close(); } }
char _token; // Non whitespace character returned by ReadToken public PathGeometry parse(string path, Factory1 d2dfactory) { _factory = d2dfactory; _pathGeometry = new PathGeometry(d2dfactory); _figure = _pathGeometry.Open(); //GeometrySink _sink = _pathGeometry.Open(); _formatProvider = CultureInfo.InvariantCulture; _pathString = path; _pathLength = path.Length; _curIndex = 0; _secondLastPoint = new Point(0, 0); _lastPoint = new Point(0, 0); _lastStart = new Point(0, 0); _figureStarted = false; bool first = true; char last_cmd = ' '; while (ReadToken()) // Empty path is allowed in XAML { char cmd = _token; if (first) { if ((cmd != 'M') && (cmd != 'm')) // Path starts with M|m { ThrowBadToken(); } first = false; } switch (cmd) { case 'm': case 'M': // XAML allows multiple points after M/m _lastPoint = ReadPoint(cmd, !AllowComma); _figure.BeginFigure(new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y), IsFilled ? FigureBegin.Filled : FigureBegin.Hollow); //_figure.StartPoint = _lastPoint; //_figure.IsFilled = IsFilled; //if (!IsClosed) _figure.Close(); //_figure.IsClosed = !IsClosed; //context.BeginFigure(_lastPoint, IsFilled, !IsClosed); _figureStarted = true; _lastStart = _lastPoint; last_cmd = 'M'; while (IsNumber(AllowComma)) { _lastPoint = ReadPoint(cmd, !AllowComma); //LineSegment _lineSegment = new LineSegment(); //_lineSegment.Point = _lastPoint; _figure.AddLine(new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y)); //_figure.Segments.Add(_lineSegment); //context.LineTo(_lastPoint, IsStroked, !IsSmoothJoin); last_cmd = 'L'; } break; case 'l': case 'L': case 'h': case 'H': case 'v': case 'V': EnsureFigure(); do { switch (cmd) { case 'l': _lastPoint = ReadPoint(cmd, !AllowComma); break; case 'L': _lastPoint = ReadPoint(cmd, !AllowComma); break; case 'h': _lastPoint.X += ReadNumber(!AllowComma); break; case 'H': _lastPoint.X = ReadNumber(!AllowComma); break; case 'v': _lastPoint.Y += ReadNumber(!AllowComma); break; case 'V': _lastPoint.Y = ReadNumber(!AllowComma); break; } //LineSegment _lineSegment = new LineSegment(); //_lineSegment.Point = _lastPoint; //_figure.Segments.Add(_lineSegment); _figure.AddLine(new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y)); //context.LineTo(_lastPoint, IsStroked, !IsSmoothJoin); }while (IsNumber(AllowComma)); last_cmd = 'L'; break; case 'c': case 'C': // cubic Bezier case 's': case 'S': // smooth cublic Bezier EnsureFigure(); do { Point p; if ((cmd == 's') || (cmd == 'S')) { if (last_cmd == 'C') { p = Reflect(); } else { p = _lastPoint; } _secondLastPoint = ReadPoint(cmd, !AllowComma); } else { p = ReadPoint(cmd, !AllowComma); _secondLastPoint = ReadPoint(cmd, AllowComma); } _lastPoint = ReadPoint(cmd, AllowComma); //BezierSegment _bizierSegment = new BezierSegment(); //_bizierSegment.Point1 = p; //_bizierSegment.Point2 = _secondLastPoint; //_bizierSegment.Point3 = _lastPoint; //_figure.Segments.Add(_bizierSegment); _figure.AddBezier(new BezierSegment() { Point1 = new SharpDX.Vector2((float)p.X, (float)p.Y), Point2 = new SharpDX.Vector2((float)_secondLastPoint.X, (float)_secondLastPoint.Y), Point3 = new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y) }); //context.BezierTo(p, _secondLastPoint, _lastPoint, IsStroked, !IsSmoothJoin); last_cmd = 'C'; }while (IsNumber(AllowComma)); break; case 'q': case 'Q': // quadratic Bezier case 't': case 'T': // smooth quadratic Bezier EnsureFigure(); do { if ((cmd == 't') || (cmd == 'T')) { if (last_cmd == 'Q') { _secondLastPoint = Reflect(); } else { _secondLastPoint = _lastPoint; } _lastPoint = ReadPoint(cmd, !AllowComma); } else { _secondLastPoint = ReadPoint(cmd, !AllowComma); _lastPoint = ReadPoint(cmd, AllowComma); } //QuadraticBezierSegment _quadraticBezierSegment = new QuadraticBezierSegment(); //_quadraticBezierSegment.Point1 = _secondLastPoint; //_quadraticBezierSegment.Point2 = _lastPoint; //_figure.Segments.Add(_quadraticBezierSegment); _figure.AddQuadraticBezier(new QuadraticBezierSegment() { Point1 = new SharpDX.Vector2((float)_secondLastPoint.X, (float)_secondLastPoint.Y), Point2 = new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y) }); //context.QuadraticBezierTo(_secondLastPoint, _lastPoint, IsStroked, !IsSmoothJoin); last_cmd = 'Q'; }while (IsNumber(AllowComma)); break; case 'a': case 'A': EnsureFigure(); do { // A 3,4 5, 0, 0, 6,7 double w = ReadNumber(!AllowComma); double h = ReadNumber(AllowComma); double rotation = ReadNumber(AllowComma); bool large = ReadBool(); bool sweep = ReadBool(); _lastPoint = ReadPoint(cmd, AllowComma); //ArcSegment _arcSegment = new ArcSegment(); //_arcSegment.Point = _lastPoint; //_arcSegment.Size = new Size(w, h); //_arcSegment.RotationAngle = rotation; //_arcSegment.IsLargeArc = large; //_arcSegment.SweepDirection = sweep ? SweepDirection.Clockwise : SweepDirection.Counterclockwise; //_figure.Segments.Add(_arcSegment); _figure.AddArc(new ArcSegment() { Point = new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y), Size = new SharpDX.Size2F((float)w, (float)h), RotationAngle = (float)rotation, ArcSize = large ? ArcSize.Large : ArcSize.Small, SweepDirection = sweep ? SweepDirection.Clockwise : SweepDirection.CounterClockwise }); //context.ArcTo( // _lastPoint, // new Size(w, h), // rotation, // large, // sweep ? SweepDirection.Clockwise : SweepDirection.Counterclockwise, // IsStroked, // !IsSmoothJoin // ); }while (IsNumber(AllowComma)); last_cmd = 'A'; break; case 'z': case 'Z': EnsureFigure(); //_figure.IsClosed = IsClosed; //context.SetClosedState(IsClosed); _figure.EndFigure(IsClosed ? FigureEnd.Closed : FigureEnd.Open); _figureStarted = false; last_cmd = 'Z'; _lastPoint = _lastStart; // Set reference point to be first point of current figure break; default: ThrowBadToken(); break; } } //if (null != _figure) //{ // _pathGeometry = new PathGeometry(d2dfactory); // _pathGeometry.Figures.Add(_figure); //} _figure.Close(); //_sink.Close(); return(_pathGeometry); }
protected override void SetSink(GeometrySink sink) { sink.SetFillMode(FillMode.Alternate); sink.BeginFigure(new RawVector2(0, 100), FigureBegin.Filled); sink.AddArc(new ArcSegment { Point = new RawVector2(0, -100), Size = new Size2F(100, 100), RotationAngle = 0, SweepDirection = SweepDirection.Clockwise, ArcSize = ArcSize.Large }); sink.AddArc(new ArcSegment { Point = new RawVector2(0, 100), Size = new Size2F(100, 100), RotationAngle = 0, SweepDirection = SweepDirection.Clockwise, ArcSize = ArcSize.Large }); sink.EndFigure(FigureEnd.Closed); sink.BeginFigure(new RawVector2(42, 0), FigureBegin.Filled); sink.AddArc(new ArcSegment { Point = new RawVector2(42, -30), Size = new Size2F(15, 15), RotationAngle = 0, SweepDirection = SweepDirection.Clockwise, ArcSize = ArcSize.Large }); sink.AddArc(new ArcSegment { Point = new RawVector2(42, 0), Size = new Size2F(15, 15), RotationAngle = 0, SweepDirection = SweepDirection.Clockwise, ArcSize = ArcSize.Large }); sink.EndFigure(FigureEnd.Closed); sink.BeginFigure(new RawVector2(-42, 0), FigureBegin.Filled); sink.AddArc(new ArcSegment { Point = new RawVector2(-42, -30), Size = new Size2F(15, 15), RotationAngle = 0, SweepDirection = SweepDirection.Clockwise, ArcSize = ArcSize.Large }); sink.AddArc(new ArcSegment { Point = new RawVector2(-42, 0), Size = new Size2F(15, 15), RotationAngle = 0, SweepDirection = SweepDirection.Clockwise, ArcSize = ArcSize.Large }); sink.EndFigure(FigureEnd.Closed); sink.BeginFigure(new RawVector2(-60, 35), FigureBegin.Filled); sink.AddArc(new ArcSegment { Point = new RawVector2(60, 35), Size = new Size2F(60, 40), RotationAngle = 0, SweepDirection = SweepDirection.CounterClockwise, ArcSize = ArcSize.Small }); sink.EndFigure(FigureEnd.Closed); }
char _token; // Non whitespace character returned by ReadToken public PathGeometry parse(string path, Factory1 d2dfactory) { _factory = d2dfactory; _pathGeometry = new PathGeometry(d2dfactory); _figure = _pathGeometry.Open(); //GeometrySink _sink = _pathGeometry.Open(); _formatProvider = CultureInfo.InvariantCulture; _pathString = path; _pathLength = path.Length; _curIndex = 0; _secondLastPoint = new Point(0, 0); _lastPoint = new Point(0, 0); _lastStart = new Point(0, 0); _figureStarted = false; bool first = true; char last_cmd = ' '; while (ReadToken()) // Empty path is allowed in XAML { char cmd = _token; if (first) { if ((cmd != 'M') && (cmd != 'm')) // Path starts with M|m { ThrowBadToken(); } first = false; } switch (cmd) { case 'm': case 'M': // XAML allows multiple points after M/m _lastPoint = ReadPoint(cmd, !AllowComma); _figure.BeginFigure(new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y), IsFilled ? FigureBegin.Filled : FigureBegin.Hollow); //_figure.StartPoint = _lastPoint; //_figure.IsFilled = IsFilled; //if (!IsClosed) _figure.Close(); //_figure.IsClosed = !IsClosed; //context.BeginFigure(_lastPoint, IsFilled, !IsClosed); _figureStarted = true; _lastStart = _lastPoint; last_cmd = 'M'; while (IsNumber(AllowComma)) { _lastPoint = ReadPoint(cmd, !AllowComma); //LineSegment _lineSegment = new LineSegment(); //_lineSegment.Point = _lastPoint; _figure.AddLine(new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y)); //_figure.Segments.Add(_lineSegment); //context.LineTo(_lastPoint, IsStroked, !IsSmoothJoin); last_cmd = 'L'; } break; case 'l': case 'L': case 'h': case 'H': case 'v': case 'V': EnsureFigure(); do { switch (cmd) { case 'l': _lastPoint = ReadPoint(cmd, !AllowComma); break; case 'L': _lastPoint = ReadPoint(cmd, !AllowComma); break; case 'h': _lastPoint.X += ReadNumber(!AllowComma); break; case 'H': _lastPoint.X = ReadNumber(!AllowComma); break; case 'v': _lastPoint.Y += ReadNumber(!AllowComma); break; case 'V': _lastPoint.Y = ReadNumber(!AllowComma); break; } //LineSegment _lineSegment = new LineSegment(); //_lineSegment.Point = _lastPoint; //_figure.Segments.Add(_lineSegment); _figure.AddLine(new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y)); //context.LineTo(_lastPoint, IsStroked, !IsSmoothJoin); } while (IsNumber(AllowComma)); last_cmd = 'L'; break; case 'c': case 'C': // cubic Bezier case 's': case 'S': // smooth cublic Bezier EnsureFigure(); do { Point p; if ((cmd == 's') || (cmd == 'S')) { if (last_cmd == 'C') { p = Reflect(); } else { p = _lastPoint; } _secondLastPoint = ReadPoint(cmd, !AllowComma); } else { p = ReadPoint(cmd, !AllowComma); _secondLastPoint = ReadPoint(cmd, AllowComma); } _lastPoint = ReadPoint(cmd, AllowComma); //BezierSegment _bizierSegment = new BezierSegment(); //_bizierSegment.Point1 = p; //_bizierSegment.Point2 = _secondLastPoint; //_bizierSegment.Point3 = _lastPoint; //_figure.Segments.Add(_bizierSegment); _figure.AddBezier(new BezierSegment() { Point1 = new SharpDX.Vector2((float)p.X, (float)p.Y), Point2 = new SharpDX.Vector2((float)_secondLastPoint.X, (float)_secondLastPoint.Y), Point3 = new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y) }); //context.BezierTo(p, _secondLastPoint, _lastPoint, IsStroked, !IsSmoothJoin); last_cmd = 'C'; } while (IsNumber(AllowComma)); break; case 'q': case 'Q': // quadratic Bezier case 't': case 'T': // smooth quadratic Bezier EnsureFigure(); do { if ((cmd == 't') || (cmd == 'T')) { if (last_cmd == 'Q') { _secondLastPoint = Reflect(); } else { _secondLastPoint = _lastPoint; } _lastPoint = ReadPoint(cmd, !AllowComma); } else { _secondLastPoint = ReadPoint(cmd, !AllowComma); _lastPoint = ReadPoint(cmd, AllowComma); } //QuadraticBezierSegment _quadraticBezierSegment = new QuadraticBezierSegment(); //_quadraticBezierSegment.Point1 = _secondLastPoint; //_quadraticBezierSegment.Point2 = _lastPoint; //_figure.Segments.Add(_quadraticBezierSegment); _figure.AddQuadraticBezier(new QuadraticBezierSegment() { Point1 = new SharpDX.Vector2((float)_secondLastPoint.X, (float)_secondLastPoint.Y), Point2 = new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y) }); //context.QuadraticBezierTo(_secondLastPoint, _lastPoint, IsStroked, !IsSmoothJoin); last_cmd = 'Q'; } while (IsNumber(AllowComma)); break; case 'a': case 'A': EnsureFigure(); do { // A 3,4 5, 0, 0, 6,7 double w = ReadNumber(!AllowComma); double h = ReadNumber(AllowComma); double rotation = ReadNumber(AllowComma); bool large = ReadBool(); bool sweep = ReadBool(); _lastPoint = ReadPoint(cmd, AllowComma); //ArcSegment _arcSegment = new ArcSegment(); //_arcSegment.Point = _lastPoint; //_arcSegment.Size = new Size(w, h); //_arcSegment.RotationAngle = rotation; //_arcSegment.IsLargeArc = large; //_arcSegment.SweepDirection = sweep ? SweepDirection.Clockwise : SweepDirection.Counterclockwise; //_figure.Segments.Add(_arcSegment); _figure.AddArc(new ArcSegment() { Point = new SharpDX.Vector2((float)_lastPoint.X, (float)_lastPoint.Y), Size = new SharpDX.Size2F((float)w, (float)h), RotationAngle = (float)rotation, ArcSize = large ? ArcSize.Large : ArcSize.Small, SweepDirection = sweep ? SweepDirection.Clockwise : SweepDirection.CounterClockwise }); //context.ArcTo( // _lastPoint, // new Size(w, h), // rotation, // large, // sweep ? SweepDirection.Clockwise : SweepDirection.Counterclockwise, // IsStroked, // !IsSmoothJoin // ); } while (IsNumber(AllowComma)); last_cmd = 'A'; break; case 'z': case 'Z': EnsureFigure(); //_figure.IsClosed = IsClosed; //context.SetClosedState(IsClosed); _figure.EndFigure(IsClosed ? FigureEnd.Closed : FigureEnd.Open); _figureStarted = false; last_cmd = 'Z'; _lastPoint = _lastStart; // Set reference point to be first point of current figure break; default: ThrowBadToken(); break; } } //if (null != _figure) //{ // _pathGeometry = new PathGeometry(d2dfactory); // _pathGeometry.Figures.Add(_figure); //} _figure.Close(); //_sink.Close(); return _pathGeometry; }
/// <summary> /// Adds arc to the current path</summary> /// <param name="arc">Arc to add</param> public void AddArc(D2dArcSegment arc) { m_sink.AddArc(arc.ToSharpDX()); }
public static PathGeometry GetPathGeometry(RenderTarget t, PointF OriginalPoint, PointF p1, PointF p2) { Point2F innerLeft, outterLeft, outterRight, innerRight; PathGeometry waveGate = t.Factory.CreatePathGeometry(); double mouseBeginAngle = Functions.AngleToNorth(OriginalPoint, p1); double mouseEndAngle = Functions.AngleToNorth(OriginalPoint, p2); double begin = Functions.FindSmallArcBeginAngle(mouseBeginAngle, mouseEndAngle); double end = Functions.FindSmallArcEndAngle(mouseBeginAngle, mouseEndAngle); double mouseBeginDis = (float)Functions.DistanceBetween(OriginalPoint.ToPoint2F(), p1.ToPoint2F()); double mouseEndDis = (float)Functions.DistanceBetween(OriginalPoint.ToPoint2F(), p2.ToPoint2F()); Point2F mouseBeginZoomed = RadiusWiseZoomPosition(p1, mouseEndDis, OriginalPoint); Point2F mouseDragZoomed = RadiusWiseZoomPosition(p2, mouseBeginDis, OriginalPoint); if (begin == mouseBeginAngle) //扇形在鼠标点击一侧开始顺时针扫过 { if (mouseBeginDis < mouseEndDis) //鼠标向外拖 { innerLeft = p1.ToPoint2F(); outterLeft = mouseBeginZoomed; outterRight = p2.ToPoint2F(); innerRight = mouseDragZoomed; } else //鼠标向内拖 { innerLeft = mouseBeginZoomed; outterLeft = p1.ToPoint2F(); outterRight = mouseDragZoomed; innerRight = p2.ToPoint2F(); } } else //扇形在鼠标拖动一侧开始顺时针扫过 { if (mouseBeginDis < mouseEndDis) //鼠标向外拖 { innerLeft = mouseDragZoomed; outterLeft = p2.ToPoint2F(); outterRight = mouseBeginZoomed; innerRight = p1.ToPoint2F(); } else //鼠标向内拖 { innerLeft = p2.ToPoint2F(); outterLeft = mouseDragZoomed; outterRight = p1.ToPoint2F(); innerRight = mouseBeginZoomed; } } GeometrySink gs = waveGate.Open(); gs.BeginFigure(innerLeft, FigureBegin.Filled); gs.AddLine(outterLeft); double disMax = Math.Max(mouseBeginDis, mouseEndDis); double disMin = Math.Min(mouseBeginDis, mouseEndDis); Microsoft.WindowsAPICodePack.DirectX.Direct2D1.SizeF size = new Microsoft.WindowsAPICodePack.DirectX.Direct2D1.SizeF((float)disMax, (float)disMax); ArcSegment arc = new ArcSegment(outterRight, size, 0, SweepDirection.Clockwise, ArcSize.Small); gs.AddArc(arc); gs.AddLine(innerRight); size = new Microsoft.WindowsAPICodePack.DirectX.Direct2D1.SizeF((float)disMin, (float)disMin); arc = new ArcSegment(innerLeft, size, 0, SweepDirection.Counterclockwise, ArcSize.Small); gs.AddArc(arc); gs.EndFigure(FigureEnd.Closed); gs.Close(); gs.Dispose(); return(waveGate); }
public override PathGeometry BuildWaveGateGeometry(Point2F position1, Point2F position2) { Point2F innerLeft, outterLeft, outterRight, innerRight; PathGeometry waveGate = Factory.CreatePathGeometry(); float mouseBeginAngle = Tools.AngleToNorth(OriginalPoint, position1); float mouseEndAngle = Tools.AngleToNorth(OriginalPoint, position2); float begin = Tools.FindSmallArcBeginAngle(mouseBeginAngle, mouseEndAngle); float end = Tools.FindSmallArcEndAngle(mouseBeginAngle, mouseEndAngle); float mouseBeginDis = (float)Tools.DistanceBetween(OriginalPoint, position1); float mouseEndDis = (float)Tools.DistanceBetween(OriginalPoint, position2); Point2F mouseBeginZoomed = RadiusWiseZoomPosition(position1, mouseEndDis); Point2F mouseDragZoomed = RadiusWiseZoomPosition(position2, mouseBeginDis); if (begin == mouseBeginAngle) //扇形在鼠标点击一侧开始顺时针扫过 { if (mouseBeginDis < mouseEndDis) //鼠标向外拖 { innerLeft = position1; outterLeft = mouseBeginZoomed; outterRight = position2; innerRight = mouseDragZoomed; } else //鼠标向内拖 { innerLeft = mouseBeginZoomed; outterLeft = position1; outterRight = mouseDragZoomed; innerRight = position2; } } else //扇形在鼠标拖动一侧开始顺时针扫过 { if (mouseBeginDis < mouseEndDis) //鼠标向外拖 { innerLeft = mouseDragZoomed; outterLeft = position2; outterRight = mouseBeginZoomed; innerRight = position1; } else //鼠标向内拖 { innerLeft = position2; outterLeft = mouseDragZoomed; outterRight = position1; innerRight = mouseBeginZoomed; } } GeometrySink gs = waveGate.Open(); gs.BeginFigure(innerLeft, FigureBegin.Filled); gs.AddLine(outterLeft); float disMax = Math.Max(mouseBeginDis, mouseEndDis); float disMin = Math.Min(mouseBeginDis, mouseEndDis); Microsoft.WindowsAPICodePack.DirectX.Direct2D1.SizeF size = new Microsoft.WindowsAPICodePack.DirectX.Direct2D1.SizeF(disMax, disMax); ArcSegment arc = new ArcSegment(outterRight, size, 0, SweepDirection.Clockwise, ArcSize.Small); gs.AddArc(arc); gs.AddLine(innerRight); size = new Microsoft.WindowsAPICodePack.DirectX.Direct2D1.SizeF(disMin, disMin); arc = new ArcSegment(innerLeft, size, 0, SweepDirection.Counterclockwise, ArcSize.Small); gs.AddArc(arc); gs.EndFigure(FigureEnd.Closed); gs.Close(); return(waveGate); }
private void DrawCircle(decimal currentValue, decimal maxValue, int thisIndex, int selectedIndex) { int partyIndex = (Party.PartySize - 4) * -1; PointF location = new PointF(Config.CooldownBarLocation.X + (Config.CooldownBarXOffset * thisIndex), Config.CooldownBarLocation.Y + (Config.CooldownBarXOffset != 0 ? 0 : ((Config.CooldownBarYOffsets[partyIndex] * thisIndex) + Config.PartyNumBarOffsets[partyIndex]))); if (thisIndex == selectedIndex) { if (Config.CooldownBarYOffsets[partyIndex] > 0) { location.X += Config.CooldownBarSelOffset; } else { location.Y += Config.CooldownBarSelOffset; } } int scale = Config.CooldownBarSize.Height; int lineWidth = Config.CooldownBarSize.Width; bool drawPie = Config.CooldownBarSize.Width > Config.CooldownBarSize.Height * 2; int val = (int)(360 - (360 * (currentValue / (maxValue + 0.01M)))); Vector2 circleCenter = new Vector2(location.X, location.Y); Vector2 circleStart = new Vector2(circleCenter.X, circleCenter.Y - scale); Vector2 circleStartBG = new Vector2(circleCenter.X, circleCenter.Y + scale); float thetaDegrees = (float)(val * 0.0174533); float thetaDegreesBG = (float)((360 - (180 - val)) * 0.0174533); Vector2 circleEnd = Matrix3x2.TransformPoint(Matrix3x2.Rotation(thetaDegrees, circleCenter), circleStart); Vector2 circleEndBG = Matrix3x2.TransformPoint(Matrix3x2.Rotation(thetaDegreesBG, circleCenter), circleStartBG); float dx = circleStart.X - circleCenter.X; float dy = circleStart.Y - circleCenter.Y; float radius = (float)Math.Sqrt(dx * dx + dy * dy); if (val < 360 && BGColorBrush.Color.A > 0 && ((thisIndex != selectedIndex && FG1ColorBrush.Color.A > 0) || (thisIndex == selectedIndex && SELColorBrush.Color.A > 0))) { using (PathGeometry pathGeometry = new PathGeometry(Factory)) { using (GeometrySink geometrySink = pathGeometry.Open()) { if (val <= 180) { geometrySink.BeginFigure(drawPie ? circleCenter : circleStartBG, FigureBegin.Filled); if (drawPie) { geometrySink.AddLine(circleStartBG); } geometrySink.AddArc(new ArcSegment() { Point = (val == 0) ? circleStart : circleEndBG, Size = new Size2F(radius, radius), RotationAngle = 0.0f, SweepDirection = SweepDirection.CounterClockwise, ArcSize = ArcSize.Small }); geometrySink.EndFigure(drawPie ? FigureEnd.Closed : FigureEnd.Open); } geometrySink.BeginFigure(drawPie ? circleCenter : circleStart, FigureBegin.Filled); if (drawPie) { geometrySink.AddLine(circleStart); } geometrySink.AddArc(new ArcSegment() { Point = (val <= 180) ? circleStartBG : circleEndBG, Size = new Size2F(radius, radius), RotationAngle = 0.0f, SweepDirection = SweepDirection.CounterClockwise, ArcSize = ArcSize.Small }); geometrySink.EndFigure(drawPie ? FigureEnd.Closed : FigureEnd.Open); geometrySink.Close(); if (drawPie) { Render.FillGeometry(pathGeometry, BGColorBrush); } else { //using(StrokeStyle strokeStyle = new StrokeStyle(Factory, // new StrokeStyleProperties() { DashCap = CapStyle.Flat, DashStyle = DashStyle.Solid, LineJoin = LineJoin.Miter, StartCap = CapStyle.Flat, EndCap = CapStyle.Flat, MiterLimit = 0, DashOffset = 0 })) { //} Render.DrawGeometry(pathGeometry, BGColorBrush, lineWidth); //, strokeStyle); } } } } if ((thisIndex != selectedIndex && FG1ColorBrush.Color.A > 0) || (thisIndex == selectedIndex && SELColorBrush.Color.A > 0) || (FG2ColorBrush.Color.A > 0 && val == 360)) { using (PathGeometry pathGeometry = new PathGeometry(Factory)) { using (GeometrySink geometrySink = pathGeometry.Open()) { geometrySink.BeginFigure(drawPie ? circleCenter : circleStart, FigureBegin.Filled); if (drawPie) { geometrySink.AddLine(circleStart); } geometrySink.AddArc(new ArcSegment() { Point = (val > 180) ? new Vector2(circleStart.X, circleStart.Y + (radius * 2)) : circleEnd, Size = new Size2F(radius, radius), RotationAngle = 0.0f, SweepDirection = SweepDirection.Clockwise, ArcSize = ArcSize.Small }); geometrySink.EndFigure(drawPie ? FigureEnd.Closed : FigureEnd.Open); if (val > 180) { geometrySink.BeginFigure(drawPie ? circleCenter : new Vector2(circleStart.X, circleStart.Y + (radius * 2)), FigureBegin.Filled); if (drawPie) { geometrySink.AddLine(new Vector2(circleStart.X, circleStart.Y + (radius * 2))); } geometrySink.AddArc(new ArcSegment() { Point = circleEnd, Size = new Size2F(radius, radius), RotationAngle = 0.0f, SweepDirection = SweepDirection.Clockwise, ArcSize = ArcSize.Small }); geometrySink.EndFigure(drawPie ? FigureEnd.Closed : FigureEnd.Open); } geometrySink.Close(); if (drawPie) { Render.FillGeometry(pathGeometry, val == 360 ? FG2ColorBrush : thisIndex != selectedIndex ? FG1ColorBrush : SELColorBrush); } else { //using(StrokeStyle strokeStyle = new StrokeStyle(Factory, // new StrokeStyleProperties() { DashCap = CapStyle.Flat, DashStyle = DashStyle.Solid, LineJoin = LineJoin.Miter, StartCap = CapStyle.Flat, EndCap = CapStyle.Flat, MiterLimit = 0, DashOffset = 0 })) { //} Render.DrawGeometry(pathGeometry, val == 360 ? FG2ColorBrush : thisIndex != selectedIndex ? FG1ColorBrush : SELColorBrush, lineWidth); //, strokeStyle); } } } } if (Config.CooldownBarTextFontSize > 0 && Config.CooldownBarTextFontSize > 0 && val == 360 && FG2TColorBrush.Color.A > 0) { DrawText(Config.CooldownBarTextReady != "" ? Config.CooldownBarTextReady : FormatDecimalToString(currentValue, Config.CooldownBarTextDecimal), circleCenter.X + Config.CooldownBarTextOffset.X, circleCenter.Y + Config.CooldownBarTextOffset.Y, FG2TColorBrush, BGTColorBrush); } else if (Config.CooldownBarTextFontSize > 0 && Config.CooldownBarTextFontSize > 0 && val < 360 && thisIndex != selectedIndex && FG1TColorBrush.Color.A > 0) { DrawText(FormatDecimalToString(currentValue, Config.CooldownBarTextDecimal), circleCenter.X + Config.CooldownBarTextOffset.X, circleCenter.Y + Config.CooldownBarTextOffset.Y, FG1TColorBrush, BGTColorBrush); } else if (Config.CooldownBarTextFontSize > 0 && Config.CooldownBarTextFontSize > 0 && val < 360 && thisIndex == selectedIndex && SELTColorBrush.Color.A > 0) { DrawText(FormatDecimalToString(currentValue, Config.CooldownBarTextDecimal), circleCenter.X + Config.CooldownBarTextOffset.X, circleCenter.Y + Config.CooldownBarTextOffset.Y, SELTColorBrush, BGTColorBrush); } }