polygonRgba function

int polygonRgba(
  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,
)

Implementation

int polygonRgba(Pointer<SdlRenderer> renderer, Pointer<Int16> vx,
    Pointer<Int16> vy, int n, int r, int g, int b, int a) {
  /*
	* Draw
	*/
  int result;

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

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

  /*
	* Pointer setup
	*/

  /*
	* Set color
	*/
  result = 0;
  result |= sdlSetRenderDrawBlendMode(
      renderer, (a == 255) ? SDL_BLENDMODE_NONE : SDL_BLENDMODE_BLEND);
  result |= sdlSetRenderDrawColor(renderer, r, g, b, a);

  /*
	* Draw
	*/
  result |= polygon(renderer, vx, vy, n);

  return (result);
}