drawLine method

void drawLine(
  1. double x1,
  2. double y1,
  3. double x2,
  4. double y2, {
  5. ColorList? colors,
})

Draws a line segment between (x1, y1) and (x2, y2).

  • x1: The x-coordinate of the starting point.
  • y1: The y-coordinate of the starting point.
  • x2: The x-coordinate of the ending point.
  • y2: The y-coordinate of the ending point.
  • colors: An optional list of Color objects for per-vertex coloring.

Implementation

void drawLine(double x1, double y1, double x2, double y2, {ColorList? colors}) {
  _prepareRenderState(_PrimitiveType.lines, texture: Texture.white);

  _transfromAndAddVertices(x1, y1, 0.0, 0.0, getColorFromList(colors, 0, _encodedColor));
  _transfromAndAddVertices(x2, y2, 0.0, 0.0, getColorFromList(colors, 1, _encodedColor));
}