
/* Yasu Extender. 2004.9 */

/* draw filled circle */
int GWscircle(float X1, float Y1, float X2, float Y2, int K)
{
  int rc=1;
  int ipc, ips, ipw, mx;
  int ibc, ibs, ibh;

  if((rc=GWgetpen(&ipc, &ips, &ipw, &mx)) == 0 ) return rc;
  if((rc=GWgetbrs(&ibc, &ibs, &ibh)) == 0 ) return rc;

  GWsetpen(K,-1,-1,4);
  GWsetbrs(K,1,-1);
  GWellipse(X1, Y1, X2, Y2);

  if((rc=GWsetpen(ipc, ips, ipw, mx)) == 0 ) return rc;
  if((rc=GWsetbrs(ibc, ibs, ibh)) == 0 ) return rc;

  return rc;
}

/* draw empty circle */
int GWcircle(float X1, float Y1, float X2, float Y2, int K)
{
  int rc=1;
  int ipc, ips, ipw, mx;
  int ibc, ibs, ibh;

  if((rc=GWgetpen(&ipc, &ips, &ipw, &mx)) == 0 ) return rc;
  if((rc=GWgetbrs(&ibc, &ibs, &ibh)) == 0 ) return rc;

  GWsetpen(K,-1,-1,4);
  GWsetbrs(K,0,-1);
  GWarc(X1, Y1, X2, Y2, 0.0, 1.0);

  if((rc=GWsetpen(ipc, ips, ipw, mx)) == 0 ) return rc;
  if((rc=GWsetbrs(ibc, ibs, ibh)) == 0 ) return rc;

  return rc;
}

/* draw arc */
int GWxarc(float X1, float Y1, float X2, float Y2, float A, float AW, int K)
{
  int rc=1;
  int ipc, ips, ipw, mx;
  int ibc, ibs, ibh;

  if((rc=GWgetpen(&ipc, &ips, &ipw, &mx)) == 0 ) return rc;
  if((rc=GWgetbrs(&ibc, &ibs, &ibh)) == 0 ) return rc;

  GWsetpen(K,-1,-1,4);
  GWsetbrs(K,1,-1);
  GWarc(X1, Y1, X2, Y2, A, AW);

  if((rc=GWsetpen(ipc, ips, ipw, mx)) == 0 ) return rc;
  if((rc=GWsetbrs(ibc, ibs, ibh)) == 0 ) return rc;

  return rc;
}

/* draw filled pie */
int GWxpie(float X1, float Y1, float X2, float Y2, float A, float AW, int K)
{
  int rc=1;
  int ipc, ips, ipw, mx;
  int ibc, ibs, ibh;

  if((rc=GWgetpen(&ipc, &ips, &ipw, &mx)) == 0 ) return rc;
  if((rc=GWgetbrs(&ibc, &ibs, &ibh)) == 0 ) return rc;

  GWsetpen(K,-1,-1,4);
  GWsetbrs(K,1,-1);
  GWpie(X1, Y1, X2, Y2, A, AW);

  if((rc=GWsetpen(ipc, ips, ipw, mx)) == 0 ) return rc;
  if((rc=GWsetbrs(ibc, ibs, ibh)) == 0 ) return rc;

  return rc;
}


/* draw empty rectangle */
int GWxrect(float X1, float Y1, float X2, float Y2, int K)
{
  int rc=1;
  int ipc, ips, ipw, mx;
  int ibc, ibs, ibh;

  if((rc=GWgetpen(&ipc, &ips, &ipw, &mx)) == 0 ) return rc;
  if((rc=GWgetbrs(&ibc, &ibs, &ibh)) == 0 ) return rc;

  GWsetpen(K,-1,-1,4);
  GWsetbrs(K,0,-1);
  GWrect(X1, Y1, X2, Y2);

  if((rc=GWsetpen(ipc, ips, ipw, mx)) == 0 ) return rc;
  if((rc=GWsetbrs(ibc, ibs, ibh)) == 0 ) return rc;

  return rc;
}
