private void DrawBeziers() { if (points.Count > 3) { writeableBmp.DrawBeziers(GetPointArray(), Colors.Yellow); } }
private void DrawBeziers(WriteableBitmap writeableBmp) { if (points.Count > 3) { writeableBmp.DrawBeziers(GetPointArray(), Colors.Red); } }
/// <summary> /// Draws a series of cubic Beziér splines each defined by start, end and two control points. /// The ending point of the previous curve is used as starting point for the next. /// Therfore the inital curve needs four points and the subsequent 3 (2 control and 1 end point). /// </summary> /// <param name="bmp">The WriteableBitmap.</param> /// <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, cx1, cy1, cx2, cy2, x2, y2, cx3, cx4 ..., xn, yn).</param> /// <param name="color">The color for the spline.</param> public static void DrawBeziers(this WriteableBitmap bmp, int[] points, Color color) { // Add one to use mul and cheap bit shift for multiplicaltion int a = color.A + 1; int col = (color.A << 24) | ((byte)((color.R * a) >> 8) << 16) | ((byte)((color.G * a) >> 8) << 8) | ((byte)((color.B * a) >> 8)); bmp.DrawBeziers(points, col); }
/// <summary> /// Draws a series of cubic Beziér splines each defined by start, end and two control points. /// The ending point of the previous curve is used as starting point for the next. /// Therefore the initial curve needs four points and the subsequent 3 (2 control and 1 end point). /// </summary> /// <param name="bmp">The WriteableBitmap.</param> /// <param name="points">The points for the curve in x and y pairs, therefore the array is interpreted as (x1, y1, cx1, cy1, cx2, cy2, x2, y2, cx3, cx4 ..., xn, yn).</param> /// <param name="color">The color for the spline.</param> public static void DrawBeziers(this WriteableBitmap bmp, int[] points, Color color) { var col = ConvertColor(color); bmp.DrawBeziers(points, col); }