/// <summary> /// Draws a colored line by connecting two points using the Bresenham algorithm. /// </summary> /// <param name="bmp">The WriteableBitmap.</param> /// <param name="x1">The x-coordinate of the start point.</param> /// <param name="y1">The y-coordinate of the start point.</param> /// <param name="x2">The x-coordinate of the end point.</param> /// <param name="y2">The y-coordinate of the end point.</param> /// <param name="color">The color for the line.</param> /// <param name="clipRect">The region in the image to restrict drawing to.</param> public static void DrawLineBresenham(this BitmapBuffer bmp, int x1, int y1, int x2, int y2, ColorInt color, RectD?clipRect = null) { bmp.DrawLineBresenham(x1, y1, x2, y2, color.ToPreMultAlphaColor(), clipRect); }