Content


NTL
Core
DrawBezierCurve

DrawBezierCurve


Draw cubic bezier spline between specified points using specified control points. You may also be interested in BezierSubdivide() helper function to calculate control points.

When drawing bezier curves with width greater then one pixel and using color with transparency you may observe some artifacts due to overlapping parts. You can easy remove such a behaviour simply drawing a curve into temporal texture, called mask, using completely black color { 0, 0, 0, 255 }(or CColors::Black if you like to use this helper class) and then just draw rectangle with color your bezier line should have and applying drawn mask as active mask to IRenderer's before drawing rectangle.

bool DrawBezierCurve( // Draw cubic bezier curve of specified width 
    IRenderer *renderer, // Renderer 
    const PointF &p1, // First point 
    const PointF &p2, // Second point 
    const PointF &cp1, // First control point 
    const PointF &cp2, // Second control point 
    const Color &color, // Curve color 
    const float width, // Curve width 
    const float dT = -1); // Custom step value. Set negative to use calculated optimal one
Namespace: nitisa
Include: Nitisa/Render/Utils.h