aapolygonRgba function

bool aapolygonRgba(
  1. Pointer<SdlRenderer> renderer,
  2. Pointer<Int16> vx,
  3. Pointer<Int16> vy,
  4. int n,
  5. int r,
  6. int g,
  7. int b,
  8. int a, {
  9. int blendMode = SDL_BLENDMODE_BLEND,
})

Implementation

bool aapolygonRgba(
  Pointer<SdlRenderer> renderer,
  Pointer<Int16> vx,
  Pointer<Int16> vy,
  int n,
  int r,
  int g,
  int b,
  int a, {
  int blendMode = SDL_BLENDMODE_BLEND,
}) {
  var result = true;
  int i;

  /*
	* Vertex array NULL check
	*/
  if (vx == nullptr) {
    return false;
  }
  if (vy == nullptr) {
    return false;
  }

  /*
	* Sanity check
	*/
  if (n < 3) {
    return false;
  }

  /*
	* Pointer setup
	*/

  /*
	* Draw
	*/
  result = true;
  for (i = 1; i < n; i++) {
    if (result) {
      result = _aalineRgba(
        renderer,
        vx[i - 1].toDouble(),
        vy[i - 1].toDouble(),
        vx[i].toDouble(),
        vy[i].toDouble(),
        r,
        g,
        b,
        a,
        0,
        blendMode: blendMode,
      );
    }
  }
  if (result) {
    result = _aalineRgba(
      renderer,
      vx[n - 1].toDouble(),
      vy[n - 1].toDouble(),
      vx[0].toDouble(),
      vy[0].toDouble(),
      r,
      g,
      b,
      a,
      0,
      blendMode: blendMode,
    );
  }

  return result;
}