예제 #1
0
파일: gist.c 프로젝트: MattWherry/yorick
static int SmoothLines(long n, const GpReal *px, const GpReal *py,
                       int closed, int smooth, int clip)
{
  int value= 0;
  Engine *engine;
  GpReal scalx, offx, scaly, offy;

  if (clip && !gpClipInit) InitializeClip();
  else gpClipInit= 0;

  /* Now that clip has been set up, can change coordiante transform--
     output from DoSmoothing is in normalized coordinates, while input
     is in world coordinates...  */
  SwapNormMap(&scalx, &offx, &scaly, &offy);

  if (!clip || ClipBegin(px, py, n, closed)) {
    DoSmoothing(&n, &px, &py, closed, smooth, scalx, offx, scaly, offy);
    /* Note: if closed, n= 3*n+1, last point same as first */
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      if (!engine->inhibit)
        value|= engine->DrawLines(engine, n, px, py, 0, smooth);
  } else while ((n=ClipMore())) {
    px= xClip;
    py= yClip;
    DoSmoothing(&n, &px, &py, 0, smooth, scalx, offx, scaly, offy);
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      if (!engine->inhibit)
        value|= engine->DrawLines(engine, n, px, py, 0, smooth);
  }

  SwapMapNorm();

  return value;
}
예제 #2
0
파일: gist.c 프로젝트: MattWherry/yorick
int GpLines(long n, const GpReal *px, const GpReal *py)
{
  int value= 0;
  Engine *engine;
  int closed= gpCloseNext;
  int smooth= gpSmoothNext;
  int clip= gistClip && !gpClipDone;
  gpCloseNext= gpSmoothNext=  gpClipDone= 0;

  if (smooth) return SmoothLines(n, px, py, closed, smooth, clip);

  if (clip) InitializeClip();
  else gpClipInit= 0;

  if (!clip || ClipBegin(px, py, n, closed)) {
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      if (!engine->inhibit)
        value|= engine->DrawLines(engine, n, px, py, closed, smooth);
  } else while ((n=ClipMore())) {
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      if (!engine->inhibit)
        value|= engine->DrawLines(engine, n, xClip, yClip, 0, smooth);
  }

  return value;
}
예제 #3
0
파일: engine.c 프로젝트: MattWherry/yorick
void GdEndDr(void)
{
  Engine *eng;
  /* Done with this drawing- reset inhibit, damaged, and lastDrawn flags */
  for (eng=GpNextActive(0) ; eng ; eng=GpNextActive(eng)) {
    if (eng->lastDrawn<gdMaxRendered) eng->lastDrawn= gdMaxRendered;
    eng->inhibit= eng->damaged= 0;
  }
}
예제 #4
0
파일: engine.c 프로젝트: MattWherry/yorick
int GpDumpColors(Engine *engine, int colorMode)
{
  if (!engine) {
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      { engine->colorMode= colorMode;   engine->colorChange= 1; }
  } else {
    engine->colorMode= colorMode;   engine->colorChange= 1;
  }
  return 0;
}
예제 #5
0
파일: engine.c 프로젝트: MattWherry/yorick
int GpLandscape(Engine *engine, int landscape)
{
  if (!engine) {
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      engine->landscape= landscape;
  } else {
    engine->landscape= landscape;
  }
  return 0;
}
예제 #6
0
파일: engine.c 프로젝트: MattWherry/yorick
int GpFlush(Engine *engine)
{
  if (!engine) {
    int value= 0;
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      value|= engine->Flush(engine);
    return value;
  }
  return engine->Flush(engine);
}
예제 #7
0
파일: gist.c 프로젝트: MattWherry/yorick
int GpText(GpReal x0, GpReal y0, const char *text)
{
  int value= 0;
  Engine *engine;

  for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
    if (!engine->inhibit)
      value|= engine->DrwText(engine, x0, y0, text);

  return value;
}
예제 #8
0
파일: engine.c 프로젝트: MattWherry/yorick
int GpSetTrans(const GpTransform *trans)
{
  Engine *engine;

  if (trans!=&gistT) gistT= *trans;

  for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
    engine->ChangeMap(engine);

  return 0;
}
예제 #9
0
파일: engine.c 프로젝트: MattWherry/yorick
int GdBeginDr(Drauing *drawing, GpBox *damage, int landscape)
{
  int needToRedraw= 0;
  Engine *eng;

  if (damage) {
    /* If drawing has incurred damage, report damage to ALL engines
       interested in the drawing (not just active engines).  */
    for (eng=GpNextEngine(0) ; eng ; eng=GpNextEngine(eng))
      if (eng->drawing==drawing) GpDamage(eng, drawing, damage);
  }

  /* Loop on active engines to alert them that drawing is coming.  */
  for (eng=GpNextActive(0) ; eng ; eng=GpNextActive(eng)) {
    if (eng->drawing!=drawing) {
      /* This engine is not marked as interested in this drawing.
         Mark it, and reset damaged and lastDrawn flags so that no
         elements will be inhibited.  */
      eng->drawing= drawing;
      eng->lastDrawn= -1;
      eng->damaged= 0;
      if (landscape != eng->landscape) {
        eng->landscape= landscape;
        /* This change will be detected and acted upon by the first call
           to the ChangeMap method (GpSetTrans).  */
      }
      /* The semantics here are subtle --
         After a ClearDrawing, GdDetach zeroes eng->drawing in order to
         communicate that the drawing has been cleared.  Thus, the code
         gets here on a GdDraw after the drawing has been cleared, so
         the time has come to carry out the deferred clearing of this
         engine's plotting surface.  */
      GpClear(eng, CONDITIONALLY);
      needToRedraw= 1;

    } else if (eng->damaged) {
      /* This engine was interested in the drawing, which has been
         damaged.  Clear damaged area in preparation for repair work.
         (This is redundant if the damage was due to an X windows
          expose event, but the resulting inefficiency is very small.)  */
      eng->ClearArea(eng, &eng->damage);
      needToRedraw= 1;

    } else if (eng->lastDrawn<drawing->nElements-1) {
      needToRedraw= 1;
    }
  }

  gdNowRendering= gdMaxRendered= -1;
  return needToRedraw;
}
예제 #10
0
파일: gist.c 프로젝트: MattWherry/yorick
int GpCells(GpReal px, GpReal py, GpReal qx, GpReal qy,
            long width, long height, long nColumns,
            const GpColor *colors)
{
  int value= 0;
  Engine *engine;

  for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
    if (!engine->inhibit)
      value|= engine->DrawCells(engine, px, py, qx, qy,
                                width, height, nColumns, colors);

  return value;
}
예제 #11
0
파일: engine.c 프로젝트: MattWherry/yorick
int GdBeginSy(GpBox *tickOut, GpBox *tickIn, GpBox *viewport,
              int number, int sysIndex)
{
  Engine *eng;
  int value= 0;
  long sysMask;

  /* Note that this is harmless if sysIndex>2*sizeof(long)--
     just slightly inefficient in that ticks and elements will ALWAYS
     be drawn...  This shouldn't be a practical problem.  */
  if (sysIndex>sizeof(long)) {
    sysMask= 1 << (sysIndex-sizeof(long));
    sysIndex= 1;
  } else {
    sysMask= 1 << sysIndex;
    sysIndex= 0;
  }

  /* Loop on active engines to determine whether any require ticks or
     elements to be drawn.  Set inhibit switches for ticks.  */
  for (eng=GpNextActive(0) ; eng ; eng=GpNextActive(eng)) {
    if ( ! (eng->systemsSeen[sysIndex] & sysMask) ) {
      /* this engine has never seen this system */
      value|= 3;
      eng->inhibit= 0;
      eng->systemsSeen[sysIndex]|= sysMask;

    } else if (eng->damaged && GpIntersect(tickOut, &eng->damage)) {
      /* engine damage touches this coordinate system--
         redraw ticks if region between tickIn and tickOut damaged,
         redraw elements if viewport damaged */
      if (!tickIn || !GpContains(tickIn, &eng->damage)) {
        value|= 2;
        eng->inhibit= 0;
      } else eng->inhibit= 1;
      if (number>eng->lastDrawn || GpIntersect(viewport, &eng->damage))
        value|= 1;

    } else {
      /* engine undamaged or damage doesn't touch this system--
         redraw elements if any new ones, don't redraw ticks */
      eng->inhibit= 1;
      if (number>eng->lastDrawn) value|= 1;
    }
  }

  return value;
}
예제 #12
0
파일: engine.c 프로젝트: MattWherry/yorick
int GpClear(Engine *engine, int flag)
{
  int value= 0;
  if (!engine) {
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine)) {
      engine->damaged= engine->inhibit= 0;
      engine->lastDrawn= -1;
      engine->systemsSeen[0]= engine->systemsSeen[1]= 0;
      value|= engine->Clear(engine, flag);
    }
  } else {
    engine->damaged= engine->inhibit= 0;
    engine->lastDrawn= -1;
    engine->systemsSeen[0]= engine->systemsSeen[1]= 0;
    value= engine->Clear(engine, flag);
  }
  return value;
}
예제 #13
0
파일: gist.c 프로젝트: MattWherry/yorick
int GaFillMarker(long n, const GpReal *px, const GpReal *py,
                 GpReal x0, GpReal y0)
{
  int value= 0;
  Engine *engine;
  long i;

  /* Save transform map, set up for transform here */
  GpReal scalx, offx, scaly, offy;
  SwapNormMap(&scalx, &offx, &scaly, &offy);
  x0= x0*scalx + offx;
  y0= y0*scaly + offy;

  /* get scratch space, copy points to scratch, adding specified offsets */
  GaGetScratchP(n);
  for (i=0 ; i<n ; i++) {
    gaxScratch[i]= px[i] + x0;
    gayScratch[i]= py[i] + y0;
  }
  px= gaxScratch;
  py= gayScratch;

  if (gistClip) {
    GpReal xmin= gistT.viewport.xmin;
    GpReal xmax= gistT.viewport.xmax;
    GpReal ymin= gistT.viewport.ymin;
    GpReal ymax= gistT.viewport.ymax;
    if (xmin > xmax) { GpReal tmp= xmin; xmin= xmax; xmax= tmp; }
    if (ymin > ymax) { GpReal tmp= ymin; ymin= ymax; ymax= tmp; }
    ClipSetup(xmin, xmax, ymin, ymax);
    n= ClipFilled(px, py, n);
    px= xClip;
    py= yClip;
  }

  if (n>=2) {
    for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
      if (!engine->inhibit)
        value|= engine->DrawFill(engine, n, px, py);
  }

  SwapMapNorm();
  return value;
}
예제 #14
0
파일: gist.c 프로젝트: MattWherry/yorick
int GpFill(long n, const GpReal *px, const GpReal *py)
{
  int value= 0;
  Engine *engine;

  if (gistClip) {
    InitializeClip();
    n= ClipFilled(px, py, n);
    px= xClip;
    py= yClip;
  }
  gpClipInit= 0;
  if (n<2) return 0;

  for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
    if (!engine->inhibit)
      value|= engine->DrawFill(engine, n, px, py);

  return value;
}
예제 #15
0
파일: gist.c 프로젝트: MattWherry/yorick
int GpDisjoint(long n, const GpReal *px, const GpReal *py,
               const GpReal *qx, const GpReal *qy)
{
  int value= 0;
  Engine *engine;

  if (gistClip) {
    InitializeClip();
    n= ClipDisjoint(px, py, qx, qy, n);
    px= xClip;
    py= yClip;
    qx= xClip1;
    qy= yClip1;
  }
  gpClipInit= 0;

  for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine))
    if (!engine->inhibit)
      value|= engine->DrawDisjoint(engine, n, px, py, qx, qy);

  return value;
}
예제 #16
0
파일: gist.c 프로젝트: mbentz80/jzigbeercp
int GpMarkers(long n, const GpReal *px, const GpReal *py)
{
  int value= 0;
  Engine *engine;

  if (gistClip) {
    InitializeClip();
    n= ClipPoints(px, py, n);
    px= xClip;
    py= yClip;
  }
  gpClipInit= 0;

  for (engine=GpNextActive(0) ; engine ; engine=GpNextActive(engine)) {
    if (!engine->inhibit) {
      if (gistA.m.type<=32) value|= engine->DrawMarkers(engine, n, px, py);
      else value|= GpPseudoMark(engine, n, px, py);
    }
  }

  return value;
}
예제 #17
0
파일: engine.c 프로젝트: MattWherry/yorick
int GdBeginEl(GpBox *box, int number)
{
  Engine *eng;
  int value= 0;

  /* Loop on active engines to determine whether any require this
     element to be drawn, and to set inhibit switches so that some
     may draw it and others not.  */
  for (eng=GpNextActive(0) ; eng ; eng=GpNextActive(eng)) {
    if (number>eng->lastDrawn) {
      /* this engine hasn't seen this element before */
      eng->inhibit= 0;
      value= 1;
      if (eng->damaged && gdMaxRendered<=eng->lastDrawn) {
        /* If this is the first new element, the damage flag
           must be reset, and ChangeMap must be called to set the
           clip rectangle back to its undamaged boundary.  */
        eng->damaged= 0;
        eng->ChangeMap(eng);
      }

    } else if (box && eng->damaged && GpIntersect(box, &eng->damage)) {
      /* engine damage touches this element */
      eng->inhibit= 0;
      value= 1;

    } else {
      /* this element has been seen before and hasn't been damaged */
      eng->inhibit= 1;
    }

    /* set number of element currently being drawn for GdEndDr */
    gdNowRendering= number;
    if (gdMaxRendered<gdNowRendering) gdMaxRendered= gdNowRendering;
  }

  return value;
}