예제 #1
0
파일: plot.c 프로젝트: rhdunn/sptk
static void circle(int x0, int y0, int r1, int r2, int arg1, int arg2)
{
   int x, y;
   unsigned int width, height;

   arg1 /= 10;
   arg2 /= 10;
   width = normx(abs(r1 * cos((double) arg1)));
   height = normx(abs(r2 * sin((double) arg2)));
   x = normx(x0) - width;
   y = normy(y0) - height;
   width *= 2;
   height *= 2;

   XDrawArc(display, main_window, gc, x, y,
            width, height, arg1 * 64, arg2 * 64);
}
예제 #2
0
파일: plot.c 프로젝트: rhdunn/sptk
static void _send(Cord * buf)
{
   if (sp == SIZE)
      _flush();

   points[sp].x = normx(buf->x);
   points[sp++].y = normy(buf->y);
}
예제 #3
0
static int polyg(int type)
{
   int x, y, w, h;

   scanf("%d %d %d %d", &x, &y, &w, &h);
   dplot(type, normx(x), normy(y + h), norm(w), norm(h));

   return (0);
}
예제 #4
0
파일: plot.c 프로젝트: rhdunn/sptk
static void hatching(int type)
{
   int n;
   int frame;
   int d, angle;

   scanf("%d %d", &d, &angle);

   for (n = 0; _getcord(&pb); n++) {
      points[n].x = normx(pb.x);
      points[n].y = normy(pb.y);
   }
   points[n].x = points[0].x;
   points[n].y = points[0].y;

   switch (type -= 20) {
   case 1:
      frame = 1;
      type = -1;
      break;
   case 2:
      frame = 0;
      type = -1;
      break;
   case 3:
      frame = 1;
      type = -1;
      break;
   default:
      if (type < 0) {
         frame = 0;
         type = -type;
      } else
         frame = 1;
      break;
   }
   polyline(points, frame, type, n);
}
예제 #5
0
파일: plot.c 프로젝트: rhdunn/sptk
void plot(void)
{
   int c;
   int w, n, xmin, ymin, xmax, ymax;
   int x0, y0, r1, r2, arg1, arg2;

   while ((c = getchar()) != EOF) {
      switch (c) {
      case 'M':
         scanf("%d %d", &pb.x, &pb.y);
         _move(pb.x, pb.y);
         break;
      case 'D':
         _line();
         break;
      case '%':
         scanf("%d", &n);
         hatching(n);
         break;
         /*    polyg(n);    break;
          */
      case 'P':
         get_str();
         break;
      case 'S':
         scanf("%d", &ch);
         break;
      case 'Q':
         scanf("%d", &cw);
         break;
      case 'R':
         scanf("%d", &th);
         th = (th == 0) ? 0 : 1;
         break;
      case 'L':
         scanf("%d", &w);
         line_type(w);
         break;
      case 'K':
         scanf("%d", &w);
         join_type(w);
         break;
      case 'W':
         scanf("%d %d %d %d %d %d", &x0, &y0, &r1, &r2, &arg1, &arg2);
         circle(x0, y0, r1, r2, arg1, arg2);
         break;
      case 'N':
         scanf("%d", &w);
         mark(w);
         break;
      case 'J':
         scanf("%d", &w);
         newpen(w);
         break;
      case '\\':
         scanf("%d %d", &xmin, &ymin);
         break;
      case 'Z':
         scanf("%d %d", &xmax, &ymax);
         if (!landscape) {
            if (xmax > XLENG)
               xmax = XLENG;
            if (ymax > YLENG)
               ymax = YLENG;
         } else {
            if (xmax > YLENG)
               xmax = YLENG;
            if (ymax > XLENG)
               ymax = XLENG;
         }
         clip(normx(xmin), normy(ymax), normx(xmax), normy(ymin));
         break;
      case ';':
      case ':':
         break;
      default:
         break;
      }
   }
}
예제 #6
0
파일: plot.c 프로젝트: rhdunn/sptk
static void _move(int x, int y)
{
   points[0].x = normx(x);
   points[0].y = normy(y);
}