The DrawLine
method is used to draw a straight line between two points on a bitmap. This method modifies the bitmap by rendering a line from the specified start point to the end point using the current pen settings.
The DrawLine
method is used to draw a straight line between two points on a bitmap. This method modifies the bitmap by rendering a line from the specified start point to the end point using the current pen settings.
To use the DrawLine
method, you need to have an instance of the Bitmap
class. Ensure that the pen settings (such as color and width) are configured before calling this method, as these settings will determine the appearance of the line.
Example usage:
Bitmap bitmap = new Bitmap();
bitmap.SetPen(Color.Red, 2.0f); // Set the pen color to red and width to 2
Vector2 start = new Vector2(10, 10);
Vector2 end = new Vector2(100, 100);
bitmap.DrawLine(start, end);
Bitmap bitmap = new Bitmap(); bitmap.SetPen(Color.Red, 2.0f); // Set the pen color to red and width to 2 Vector2 start = new Vector2(10, 10); Vector2 end = new Vector2(100, 100); bitmap.DrawLine(start, end);