public D2DGeometry CreatePieGeometry(D2DPoint origin, D2DSize size, float startAngle, float endAngle) { var path = this.CreatePathGeometry(); var halfSize = new D2DSize(size.width * 0.5f, size.height * 0.5f); var sangle = startAngle * Math.PI / 180f; var eangle = endAngle * Math.PI / 180f; var angleDiff = endAngle - startAngle; var startPoint = new D2DPoint((float)(origin.x + halfSize.width * Math.Cos(sangle)), (float)(origin.y + halfSize.height * Math.Sin(sangle))); var endPoint = new D2DPoint((float)(origin.x + halfSize.width * Math.Cos(eangle)), (float)(origin.y + halfSize.height * Math.Sin(eangle))); path.AddLines(new D2DPoint[] { origin, startPoint }); path.AddArc(endPoint, halfSize, angleDiff, angleDiff > 180 ? D2D1_ARC_SIZE.D2D1_ARC_SIZE_LARGE : D2D1_ARC_SIZE.D2D1_ARC_SIZE_SMALL, D2D1_SWEEP_DIRECTION.D2D1_SWEEP_DIRECTION_CLOCKWISE); path.ClosePath(); return(path); }
public D2DGeometry CreatePieGeometry(D2DPoint origin, D2DSize size, float startAngle, float endAngle) { var path = this.CreatePathGeometry(); var halfSize = new D2DSize(size.width * 0.5f, size.height * 0.5f); var sangle = startAngle * Math.PI / 180f; var eangle = endAngle * Math.PI / 180f; var angleDiff = endAngle - startAngle; var startPoint = new D2DPoint((float)(origin.x + halfSize.width * Math.Cos(sangle)), (float)(origin.y + halfSize.height * Math.Sin(sangle))); var endPoint = new D2DPoint((float)(origin.x + halfSize.width * Math.Cos(eangle)), (float)(origin.y + halfSize.height * Math.Sin(eangle))); path.AddLines(new D2DPoint[] { origin, startPoint }); path.AddArc(endPoint, halfSize, angleDiff, angleDiff > 180 ? D2DArcSize.Large : D2DArcSize.Small, D2DSweepDirection.Clockwise); path.ClosePath(); return(path); }
public void DrawEllipse(D2DPoint origin, FLOAT radialX, FLOAT radialY, D2DColor color, FLOAT weight = 1, D2DDashStyle dashStyle = D2DDashStyle.Solid) { var ellipse = new D2DEllipse(origin, radialX, radialY); this.DrawEllipse(ellipse, color, weight, dashStyle); }
public D2DLinearGradientBrush CreateLinearGradientBrush(D2DPoint startPoint, D2DPoint endPoint, D2DGradientStop[] gradientStops) { HANDLE handle = D2D.CreateLinearGradientBrush(this.Handle, startPoint, endPoint, gradientStops, (uint)gradientStops.Length); return(new D2DLinearGradientBrush(handle, gradientStops)); }
public D2DRadialGradientBrush CreateRadialGradientBrush(D2DPoint origin, D2DPoint offset, FLOAT radiusX, FLOAT radiusY, D2DGradientStop[] gradientStops) { HANDLE handle = D2D.CreateRadialGradientBrush(this.Handle, origin, offset, radiusX, radiusY, gradientStops, (uint)gradientStops.Length); return(new D2DRadialGradientBrush(handle, gradientStops)); }
public void FillEllipse(D2DPoint p, FLOAT w, FLOAT h, D2DColor color) { D2DEllipse ellipse = new D2DEllipse(p, w / 2, h / 2); ellipse.origin.x += ellipse.radiusX; ellipse.origin.y += ellipse.radiusY; this.FillEllipse(ellipse, color); }
public static extern void SkewTransform([In] HANDLE ctx, [In] FLOAT angleX, [In] FLOAT angleY, [Optional] D2DPoint center);
public D2DBezierSegment(FLOAT x1, FLOAT y1, FLOAT x2, FLOAT y2, FLOAT x3, FLOAT y3) { this.point1 = new D2DPoint(x1, y1); this.point2 = new D2DPoint(x2, y2); this.point3 = new D2DPoint(x3, y3); }
public bool FillContainsPoint(D2DPoint point) { return(D2D.PathFillContainsPoint(this.Handle, point)); }
public static extern HANDLE CreateRadialGradientBrush(HANDLE ctx, D2DPoint origin, D2DPoint offset, FLOAT radiusX, FLOAT radiusY, D2DGradientStop[] gradientStops, UINT gradientStopCount);
public static extern bool PathStrokeContainsPoint(HANDLE pathCtx, D2DPoint point, FLOAT strokeWidth = 1, D2DDashStyle dashStyle = D2DDashStyle.Solid);
public static extern void AddPathArc(HANDLE ctx, D2DSize size, D2DPoint endPoint, FLOAT sweepAngle, D2D1_SWEEP_DIRECTION sweepDirection = D2D1_SWEEP_DIRECTION.D2D1_SWEEP_DIRECTION_CLOCKWISE);
public void RotateTransform(FLOAT angle, D2DPoint center) { D2D.RotateTransform(this.Handle, angle, center); }
public void FillEllipse(D2DPoint p, FLOAT radial, D2DColor color) { this.FillEllipse(p, radial, radial, color); }
public void DrawLine(D2DPoint start, D2DPoint end, D2DColor color, FLOAT weight = 1, D2DDashStyle dashStyle = D2DDashStyle.Solid) { D2D.DrawLine(this.Handle, start, end, color, weight, dashStyle); }
public static extern void SetPathStartPoint(HANDLE ctx, D2DPoint startPoint);
public void DrawLine(D2DPoint start, D2DPoint end, D2DColor color, FLOAT weight = 1, D2DDashStyle dashStyle = D2DDashStyle.Solid, D2DCapStyle startCap = D2DCapStyle.Flat, D2DCapStyle endCap = D2DCapStyle.Flat) { D2D.DrawLine(this.Handle, start, end, color, weight, dashStyle, startCap, endCap); }
public static extern void SetTransform([In] HANDLE context, [In] FLOAT angle, [In] D2DPoint center);
public static extern void DrawLine(HANDLE context, D2DPoint start, D2DPoint end, D2DColor color, FLOAT weight = 1, D2DDashStyle dashStyle = D2DDashStyle.Solid);
public void ScaleTransform(FLOAT sx, FLOAT sy, [Optional] D2DPoint center) { D2D.ScaleTransform(this.Handle, sx, sy, center); }
public static extern bool PathFillContainsPoint(HANDLE pathCtx, D2DPoint point);
public void SkewTransform(FLOAT angleX, FLOAT angleY, [Optional] D2DPoint center) { D2D.SkewTransform(this.Handle, angleX, angleY, center); }
public static extern HANDLE CreateLinearGradientBrush(HANDLE ctx, D2DPoint startPoint, D2DPoint endPoint, D2DGradientStop[] gradientStops, UINT gradientStopCount);
public void DrawRectangle(D2DPoint origin, D2DSize size, D2DColor color, FLOAT strokeWidth = 1, D2DDashStyle dashStyle = D2DDashStyle.Solid) { this.DrawRectangle(new D2DRect(origin, size), color, strokeWidth, dashStyle); }
public void FillRectangle(D2DPoint origin, D2DSize size, D2DColor color) { this.FillRectangle(new D2DRect(origin, size), color); }
public D2DEllipse(D2DPoint center, D2DSize radius) : this(center, radius.width, radius.height) { }
public void AddArc(D2DSize size, D2DPoint endPoint, FLOAT sweepAngle, D2D1_SWEEP_DIRECTION sweepDirection = D2D1_SWEEP_DIRECTION.D2D1_SWEEP_DIRECTION_CLOCKWISE) { D2D.AddPathArc(this.Handle, size, endPoint, sweepAngle); }
public static extern void ScaleTransform([In] HANDLE context, [In] FLOAT sx, [In] FLOAT sy, [Optional] D2DPoint center);
public bool StrokeContainsPoint(D2DPoint point, FLOAT width = 1, D2DDashStyle dashStyle = D2DDashStyle.Solid) { return(D2D.PathStrokeContainsPoint(this.Handle, point, width, dashStyle)); }
public D2DBezierSegment(D2DPoint point1, D2DPoint point2, D2DPoint point3) { this.point1 = point1; this.point2 = point2; this.point3 = point3; }