public D2D_RECT_F(D2D_POINT_2F location, D2D_SIZE_F size) { left = location.x; top = location.y; right = left + size.width; bottom = top + size.height; }
public static void AddLine(this ID2D1SimplifiedGeometrySink sink, D2D_POINT_2F point) { if (sink == null) { throw new ArgumentNullException(nameof(sink)); } sink.AddLines(new[] { point }, 1); }
public static void DrawLine(this ID2D1RenderTarget context, D2D_POINT_2F point0, D2D_POINT_2F point1, ID2D1Brush brush, float strokeWidth, ID2D1StrokeStyle strokeStyle = null) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (brush == null) { throw new ArgumentNullException(nameof(brush)); } context.DrawLine(point0, point1, brush, strokeWidth, strokeStyle); }
public D2D_VECTOR_2F(D2D_POINT_2F point0, D2D_POINT_2F point1, bool normalize = false) { x = point1.x - point0.x; y = point1.y - point0.y; if (normalize) { var len = Length; if (len > 0) { x /= len; y /= len; } } }
public static void DrawTextLayout(this ID2D1RenderTarget context, D2D_POINT_2F origin, IDWriteTextLayout layout, ID2D1Brush defaultFillBrush = null, D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (layout == null) { throw new ArgumentNullException(nameof(layout)); } context.DrawTextLayout(origin, layout, defaultFillBrush, options); }
public D2D_POINT_2F TranslatePoint(D2D_POINT_2F point, float length = 1) => new D2D_POINT_2F(point.x + x * length, point.y + y * length);
public D2D_RECT_F(D2D_POINT_2F leftTop, D2D_POINT_2F rightBottom) : this(leftTop.x, leftTop.y, rightBottom.x, rightBottom.y) { }
public D2D_RECT_F(D2D_POINT_2F location, float width, float height) : this(location, new D2D_SIZE_F(width, height)) { }
public static void DrawLine(this IComObject <ID2D1RenderTarget> context, D2D_POINT_2F point0, D2D_POINT_2F point1, IComObject <ID2D1Brush> brush, float strokeWidth, IComObject <ID2D1StrokeStyle> strokeStyle = null) => DrawLine(context?.Object, point0, point1, brush?.Object, strokeWidth, strokeStyle?.Object);
public static void DrawTextLayout(this IComObject <ID2D1RenderTarget> context, D2D_POINT_2F origin, IDWriteTextLayout layout, ID2D1Brush defaultFillBrush = null, D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS.D2D1_DRAW_TEXT_OPTIONS_NONE) => DrawTextLayout(context?.Object, origin, layout, defaultFillBrush, options);
public static void AddLine(this IComObject <ID2D1SimplifiedGeometrySink> sink, D2D_POINT_2F point) => AddLine(sink?.Object, point);
public D2D_POINT_2F Multiply(D2D_POINT_2F point) => new D2D_POINT_2F(point.x * _11 + point.y * _21 + _31, point.x * _12 + point.y * _22 + _32);