#include "gd.h"

/* This is a quickie test program to show a bug in gd.
 * There is a red line that is drawn across the bottom of
 * the image that shouldn't be there.
 *
 */

int main(int argc, char *argv[]) 
{

  int white = gdTrueColorAlpha(255, 255, 255, 10);
  int red = gdTrueColorAlpha(255, 0, 0, 10);

  gdImagePtr im = gdImageCreateTrueColor(256, 256);
  gdImageFilledRectangle(im, 0, 0, 256, 256, white);

  gdPoint points[4]; 
  points[3].x = 200;
  points[3].y = 247;

  points[2].x = 248;
  points[2].y = 248;

  points[1].x = 250;
  points[1].y = 255;  /* if this is 254, it works */

  points[0].x = 256;
  points[0].y = 280;  /* broken for all y>255? */

  // miny = 130
  // maxy = 255 or 256 

  gdImageFilledPolygon(im, points, 4, red);

  FILE * pngout = fopen("/tmp/tmp.png", "wb");	
  gdImagePng(im, pngout);
  fclose(pngout);
}
