Exemple #1
0
int main(int argc,char *argv[]) {

  struct PostScript *ps=NULL;
  struct PostScriptDash *dash=NULL;

  float p[3]={5,2,3};


  float wdt=400,hgt=400;
  float xoff=50,yoff=50;

  unsigned int fgcol=0xff000000;

  ps=PostScriptMake();
  PostScriptSetText(ps,stream,stdout);   
  PostScriptMakePlot(ps,xoff,yoff,wdt,hgt,0);

  dash=PostScriptMakeDash(p,0,3);

  
  PostScriptRectangle(ps,NULL,10,10,wdt-20,hgt-20,
                      0,fgcol,0,dash,NULL);

  PostScriptFreeDash(dash);

  

  PostScriptEndPlot(ps);
  return 0;
}
Exemple #2
0
int SplotPostScriptDash(struct Splot *ptr,struct PlotDash *dash) {

  if (ptr==NULL) return -1;
  if (dash==NULL) {
    if (ptr->ps.dash !=NULL) PostScriptFreeDash(ptr->ps.dash);
    ptr->ps.dash=NULL;
    return 0;
  }

  if ((ptr->ps.dash !=NULL) && 
      ((ptr->ps.dash)->sze==dash->sze) && 
      ((ptr->ps.dash)->phase==dash->phase) && 
      (memcmp((ptr->ps.dash)->p,dash->p,dash->sze)==0)) return 0;

  if (ptr->ps.dash !=NULL) PostScriptFreeDash(ptr->ps.dash);
  ptr->ps.dash=PostScriptMakeDash(dash->p,dash->phase,dash->sze);
  if (ptr->ps.dash !=NULL) return 0;
  return -1;  
}