#include "vogle.h"

/*
 * rect
 *
 * draw a rectangle given two opposite corners
 *
 */
void  rect(float x1, float y1, float x2, float y2)
{
  int	flag = 0;
  
  if (!vdevice.initialised)
    verror("rect: vogle not initialised");
  
  if ((vdevice.attr->a.fill || vdevice.attr->a.hatch) && !vdevice.inpolygon) {
    flag = 1;
    makepoly();		/* want it filled */
  }
  
  move2(x1, y1);
  draw2(x2, y1);
  draw2(x2, y2);
  draw2(x1, y2);
  
  if (flag)
    closepoly();
  else
    draw2(x1, y1);
}

