Requires: Direct2D.lg32
Draws a Bezier curve in the current render target.
D2Curve x0,y0,x1,y1,x2,y2,x3,y3 [,D2Brush]
x0,y0,x1,y1,x2,y2,x3,y3 | : Single exp |
D2Brush | : Object |
D2Curve x0,y0,x1,y1,x2,y2,x3,y3 draws a Bezier curve. The Bezier curve starts at x0,y0 and ends at x3,y3. At x0,y0 the curve is a tangent to the line from x0,y0 to x1,y1 and at x3,y3 a tangent to the line from x3,x3 to x2,y2.
If points x0,y0,...,x3,y3 are viewed as corners of a rectangle, the curve lies fully within this rectangle. (The curve can also be seen as a line between x0,y0 and x3,y3 which is pushed away from the points x1,y1 and x2,y2).
The line is drawn using a solid color brush based on the foreground color or the colorbrush specified with the optional D2Brush.
The drawing position is relative to the current transform setting.
'
' D2Curve sample (dpi-unaware)
'
$Library "direct2d"
Global Object Win1RT
OpenW 1, 0, 0, 320, 260, ~15
Set Win1RT = D2GetRT() ' DC render target
Do
Sleep
Until Me Is Nothing
Sub Win_1_Paint
D2BeginDraw Win1RT, D2C_Wheat
D2Color D2C_DarkBlue ' color of the line
D2Curve 10, 10, 10, 100, 100, 10, 100, 100
D2EndDraw
EndSub
Sub Win_1_ReSize
D2ResizeRT Win1RT, _X, _Y
EndSub
The D2Curve command is implemented by creating a path-geometry on the fly and by drawing the bezier curve in the geometry using D2Sink_AddBezier. After creating the temporary geometry it is drawn using the D2DrawGeometry command, then the geometry (and the sink) is released.
D2Transform, D2TransformAdd, D2PathGeometry, D2GeometrySink, D2Sink_AddBezier.
{Created by Sjouke Hamstra; Last updated: 07/03/2021 by James Gaite}