Esempio n. 1
0
/* Note that nulldevice clears the current pagedevice. */
static int
znulldevice(i_ctx_t *i_ctx_p)
{
    gs_nulldevice(igs);
    clear_pagedevice(istate);
    return 0;
}
Esempio n. 2
0
/* Note that nulldevice clears the current pagedevice. */
static int
znulldevice(i_ctx_t *i_ctx_p)
{
    gs_nulldevice(igs);
    invalidate_stack_devices(i_ctx_p);
    clear_pagedevice(istate);
    return 0;
}
Esempio n. 3
0
/* Remove a device from an interperter instance */
static int   /* ret 0 ok, else -ve error code */
pxl_impl_remove_device(
  pl_interp_instance_t   *instance     /* interp instance to use */
)
{
	int code = 0;	/* first error status encountered */
	int error;
	pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
	/* return to original gstate  */
	gs_grestore_only(pxli->pgs);	/* destroys gs_save stack */
	/* Deselect device */
	/* NB */
	error = gs_nulldevice(pxli->pgs);
	if (code >= 0)
	  code = error;

	return code;
}
Esempio n. 4
0
void
pxpcl_release(void)
{
    if (global_pcs) {
        if (gs_debug_c('i'))
            dmprintf(global_pcs->memory,
                     "passthrough: releasing global pcl state\n");
        pcl_grestore(global_pcs);
        gs_grestore_only(global_pcs->pgs);
        gs_nulldevice(global_pcs->pgs);
        pcl_do_resets(global_pcs, pcl_reset_permanent);
        global_pcs->end_page = pcl_end_page_top;        /* pcl_end_page handling */
        pxpcl_pagestatereset();
        global_pcs = NULL;
        global_this_pass_contiguous = false;
        global_pass_first = true;
        global_char_angle = 0;
        global_char_shear.x = 0;
        global_char_shear.y = 0;
        global_char_scale.x = 1.0;
        global_char_scale.y = 1.0;
        global_char_bold_value = 0.0;
    }
}
Esempio n. 5
0
/* Set a device into an interperter instance */
static int   /* ret 0 ok, else -ve error code */
pxl_impl_set_device(
  pl_interp_instance_t   *instance,     /* interp instance to use */
  gx_device              *device        /* device to set (open or closed) */
)
{
	int code;
	pxl_interp_instance_t *pxli = (pxl_interp_instance_t *)instance;
	px_state_t *pxs = pxli->pxs;

	enum {Sbegin, Ssetdevice, Sinitg, Sgsave, Serase, Sdone} stage;
	stage = Sbegin;
	gs_opendevice(device);

        pxs->interpolate = pxl_get_interpolation(instance);
	/* Set the device into the gstate */
	stage = Ssetdevice;
	if ((code = gs_setdevice_no_erase(pxli->pgs, device)) < 0)	/* can't erase yet */
	  goto pisdEnd;
        /* Initialize device ICC profile  */
        code = gsicc_init_device_profile(pxli->pgs, device);
        if (code < 0)
            return code;
	/* Init XL graphics */
	stage = Sinitg;
	if ((code = px_initgraphics(pxli->pxs)) < 0)
	  goto pisdEnd;

	/* Do inits of gstate that may be reset by setdevice */
	gs_setaccuratecurves(pxli->pgs, true);	/* All H-P languages want accurate curves. */
        /* disable hinting at high res */
        if (gs_currentdevice(pxli->pgs)->HWResolution[0] >= 300)
            gs_setgridfittt(pxs->font_dir, 0);


	/* gsave and grestore (among other places) assume that */
	/* there are at least 2 gstates on the graphics stack. */
	/* Ensure that now. */
	stage = Sgsave;
	if ( (code = gs_gsave(pxli->pgs)) < 0)
	  goto pisdEnd;

	stage = Serase;
	if ( (code = gs_erasepage(pxli->pgs)) < 0 )
		goto pisdEnd;

	stage = Sdone;	/* success */
	/* Unwind any errors */
pisdEnd:
	switch (stage) {
	case Sdone:	/* don't undo success */
	  break;

	case Serase:	/* gs_erasepage failed */
	  /* undo  gsave */
	  gs_grestore_only(pxli->pgs);	 /* destroys gs_save stack */
	  /* fall thru to next */
	case Sgsave:	/* gsave failed */
	case Sinitg:
	  /* undo setdevice */
	  gs_nulldevice(pxli->pgs);
	  /* fall thru to next */

	case Ssetdevice:	/* gs_setdevice failed */
	case Sbegin:	/* nothing left to undo */
	  break;
	}
	return code;
}