Esempio n. 1
0
void
plD_bop_plm(PLStream *pls)
{
    PLmDev *dev = (PLmDev *) pls->dev;
    int isfile = (pls->output_type == 0);
    FPOS_T pp_offset = dev->lp_offset;;

    dbug_enter("plD_bop_plm");

    dev->xold = PL_UNDEFINED;
    dev->yold = PL_UNDEFINED;

/* Update previous page header */

    if (isfile)
	UpdatePrevPagehdr(pls);

/* Start next family file if necessary. */

    pls->bytecnt = pls->pdfs->bp;
    plGetFam(pls);

/* Update page counter */

    pls->page++;

/* Update table of contents info & write new page header. */

    WritePageInfo(pls, pp_offset);
}
Esempio n. 2
0
void
plD_bop_xfig(PLStream *pls)
{
    PLDev *dev = (PLDev *) pls->dev;

    dev->xold = PL_UNDEFINED;
    dev->yold = PL_UNDEFINED;
    firstline = 1;

    if (!pls->termin)
      plGetFam(pls);

    pls->famadv = 1;
    pls->page++;

    offset += offset_inc;
    flushbuffer(pls);
    
    /* create background FIXME -- sync with orientation in header and pls->diorot */
    curcol = XFIG_COLBASE; /* colormap entry 0, background */
    fprintf(pls->OutFile, "2 1 0 1 %d %d 50 0 20 0.0 0 0 -1 0 0 5\n", curcol, curcol );
    fprintf(pls->OutFile, "%d %d %d %d %d %d %d %d %d %d\n",
	    0, offset,
	    0, (int) (FIGY * dev->yscale_dev) + offset,
	    (int) (FIGX * dev->xscale_dev), (int) (FIGY * dev->yscale_dev) + offset,
	    (int) (FIGX * dev->xscale_dev), offset,
	    0, offset);
    
}
Esempio n. 3
0
void
plD_bop_ljii(PLStream *pls)
{
    if (!pls->termin)
	plGetFam(pls);

    pls->page++;
}
Esempio n. 4
0
void
plD_bop_imp(PLStream *pls)
{
    PLDev *dev = (PLDev *) pls->dev;

    FirstLine = 1;
    dev->xold = PL_UNDEFINED;
    dev->yold = PL_UNDEFINED;

    if (!pls->termin)
	plGetFam(pls);

    pls->page++;
}
Esempio n. 5
0
void
plD_bop_ps(PLStream *pls)
{
    PSDev *dev = (PSDev *) pls->dev;

    dev->xold = PL_UNDEFINED;
    dev->yold = PL_UNDEFINED;

    if (!pls->termin)
	plGetFam(pls);

    pls->page++;

    if (pls->family)
        fprintf(OF, "%%%%Page: %d %d\n", (int) pls->page, 1);
    else
        fprintf(OF, "%%%%Page: %d %d\n", (int) pls->page, (int) pls->page);

    fprintf(OF, "bop\n");
    if (pls->color) {
	PLFLT r, g, b;
	if (pls->cmap0[0].r != 0xFF ||
	    pls->cmap0[0].g != 0xFF ||
	    pls->cmap0[0].b != 0xFF ) {

	    r = ((PLFLT) pls->cmap0[0].r) / 255.;
	    g = ((PLFLT) pls->cmap0[0].g) / 255.;
	    b = ((PLFLT) pls->cmap0[0].b) / 255.;

	    fprintf(OF, "B %.4f %.4f %.4f C F\n", r, g, b);
	}
    }
    pls->linepos = 0;

/* This ensures the color and line width are set correctly at the beginning of
   each page */

    plD_state_ps(pls, PLSTATE_COLOR0);
    plD_state_ps(pls, PLSTATE_WIDTH);
}
Esempio n. 6
0
void
plD_bop_tek(PLStream *pls)
{
   TekDev *dev = (TekDev *) pls->dev;

   dev->xold = PL_UNDEFINED;
   dev->yold = PL_UNDEFINED;

   if (pls->termin) {
       switch (pls->dev_minor) {
       case mskermit:
	   fprintf(pls->OutFile, CLEAR_VIEW);	/* erase and home */
	   break;
       }
   } else {
       plGetFam(pls);
   }
   pls->page++;

/* Initialize palette */

   if ( pls->color & 0x01 )
       setcmap(pls);
}
Esempio n. 7
0
void plD_bop_png(PLStream *pls)
{
    png_Dev *dev;

    plGetFam(pls);
/* force new file if pls->family set for all subsequent calls to plGetFam
 * n.b. putting this after plGetFam call is important since plinit calls
 * bop, and you don't want the familying sequence started until after
 * that first call to bop.*/

/* n.b. pls->dev can change because of an indirect call to plD_init_png
 * from plGetFam if familying is enabled.  Thus, wait to define dev until
 * now. */

    dev = (png_Dev *) pls->dev;

    pls->famadv = 1;

    pls->page++;

if (dev->black15) plD_black15_gd(pls);
if (dev->red15) plD_red15_gd(pls);

#if GD2_VERS >= 2
  if ( ( (((dev->truecolour>0) && (dev->palette>0)) ||     /* In an EXTREMELY convaluted */
         ((dev->truecolour==0) && (dev->palette==0))) &&   /* manner, all this is just   */
          ((pls->ncol1+pls->ncol0) <= 256) ) ||             /* asking the question, do we */
       (((dev->palette>0) && (dev->truecolour==0)))  )   /* want truecolour or not ?   */
        {
#endif

           dev->im_out = gdImageCreate(pls->xlength, pls->ylength);

           setcmap(pls);

#if GD2_VERS >= 2
         }
       else
         {
         dev->im_out = gdImageCreateTrueColor(pls->xlength, pls->ylength);

/*
 * In truecolour mode, the background colour GD makes is ALWAYS black, so to
 * "simulate" (stimulate?) a background colour other than black, we will just
 * draw a dirty big rectange covering the whole image and colour it in
 * whatever colour cmap0[0] happens to be.
 *
 * Question to C gurus: while it is slightly illogical and ugly, would:
 *   if ((pls->cmap0[0].r+pls->cmap0[0].g+pls->cmap0[0].b)!=0)
 * be more computationally efficient than:
 *   if ((pls->cmap0[0].r!=0)||(pls->cmap0[0].g!=0)||(pls->cmap0[0].b!=0))
 *  ???
 */

         if ( (pls->cmap0[0].r!=0)||(pls->cmap0[0].g!=0)||
              (pls->cmap0[0].b!=0) )
            {
             gdImageFilledRectangle(dev->im_out,0,0, pls->xlength-1, pls->ylength-1,
                                    gdTrueColor(pls->cmap0[0].r,pls->cmap0[0].g,
                                                pls->cmap0[0].b));
            }

         }


/* This ensures the line width is set correctly at the beginning of
 *    each page */

   plD_state_png(pls, PLSTATE_WIDTH);

#endif


}