public D2DSize MeasureText(string text, string fontName, float fontSize, D2DSize placeSize) { D2DSize outputSize = placeSize; D2D.MeasureText(this.Handle, text, fontName, fontSize, ref outputSize); return(outputSize); }
public D2DBitmapGraphics CreateBitmapGraphics(D2DSize size) { HANDLE bitmapRenderTargetHandle = D2D.CreateBitmapRenderTarget(this.Handle, size); return(bitmapRenderTargetHandle == HANDLE.Zero ? null : new D2DBitmapGraphics(bitmapRenderTargetHandle)); }
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, D2DSize radial, D2DColor color, FLOAT weight = 1, D2DDashStyle dashStyle = D2DDashStyle.Solid) { var ellipse = new D2DEllipse(origin, radial); this.DrawEllipse(ellipse, color, weight, dashStyle); }
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 FillRectangle(D2DPoint origin, D2DSize size, D2DColor color) { this.FillRectangle(new D2DRect(origin, size), color); }
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 static extern void AddPathArc(HANDLE ctx, D2DPoint endPoint, D2DSize size, FLOAT sweepAngle, D2DArcSize arcSize = D2DArcSize.Small, D2DSweepDirection sweepDirection = D2DSweepDirection.Clockwise);
public static extern void MeasureText([In] HANDLE ctx, [In] string text, [In] string fontName, [In] FLOAT fontSize, ref D2DSize size);
public D2DEllipse(D2DPoint center, D2DSize radius) : this(center, radius.width, radius.height) { }
public D2DRect(D2DPoint origin, D2DSize size) : this(origin.x - size.width * 0.5f, origin.y - size.height * 0.5f, size.width, size.height) { }
public void AddArc(D2DPoint endPoint, D2DSize size, FLOAT sweepAngle, D2D1_ARC_SIZE arcSize = D2D1_ARC_SIZE.D2D1_ARC_SIZE_SMALL, D2D1_SWEEP_DIRECTION sweepDirection = D2D1_SWEEP_DIRECTION.D2D1_SWEEP_DIRECTION_CLOCKWISE) { D2D.AddPathArc(this.Handle, endPoint, size, sweepAngle, arcSize, sweepDirection); }
public D2DGeometry CreateEllipseGeometry(D2DPoint origin, D2DSize size) { var ellipse = new D2DEllipse(origin, size); return(new D2DGeometry(this.Handle, D2D.CreateEllipseGeometry(this.Handle, ref ellipse))); }
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 HANDLE CreateBitmapRenderTarget([In] HANDLE context, D2DSize size);
// TODO: unnecessary API and it doesn't work very well, consider to remove //public void AddEllipse(D2DEllipse ellipse) //{ // D2D.AddPathEllipse(this.Handle, ref ellipse); //} public void AddArc(D2DPoint endPoint, D2DSize size, FLOAT sweepAngle, D2DArcSize arcSize = D2DArcSize.Small, D2DSweepDirection sweepDirection = D2DSweepDirection.Clockwise) { D2D.AddPathArc(this.Handle, endPoint, size, sweepAngle, arcSize, sweepDirection); }