Ejemplo n.º 1
0
/* DF; sets programmable features except P1 and P2 */
int
hpgl_DF(hpgl_args_t *pargs, hpgl_state_t *pgls)
{	
    hpgl_args_t args;
    hpgl_call(hpgl_reset_overlay(pgls));

    hpgl_args_setup(&args);
    hpgl_FT(&args, pgls);
    hpgl_args_setup(&args);
    hpgl_IW(&args, pgls);
    hpgl_set_line_attribute_defaults(pgls);
    hpgl_args_setup(&args);
    hpgl_LA(&args, pgls);
    hpgl_set_line_pattern_defaults(pgls);
    hpgl_args_setup(&args);
    hpgl_RF(&args, pgls);
    hpgl_args_set_int(&args, 0);
    hpgl_SV(&args, pgls);
    hpgl_args_setup(&args);
    hpgl_UL(&args, pgls);
    hpgl_args_setup(&args);
    hpgl_SB(&args, pgls);
    return 0;
}
Ejemplo n.º 2
0
void
hpgl_do_reset(pcl_state_t * pcs, pcl_reset_type_t type)
{
    /* pgframe.c (Chapter 18) */
    hpgl_args_t hpgl_args;

    if ((type & (pcl_reset_initial | pcl_reset_printer | pcl_reset_cold)) !=
        0) {
        if ((type & (pcl_reset_initial | pcl_reset_cold)) != 0) {
            gx_path_alloc_contained(&pcs->g.polygon.buffer.path,
                                    pcs->memory,
                                    "hpgl_do_reset polygon buffer");
            gs_setlimitclamp(pcs->pgs, true);
        } else
            gx_path_new(&pcs->g.polygon.buffer.path);

        /* provide default anchor point, plot size and picture frame size */
        hpgl_default_coordinate_system(pcs);

        /* we should not have a path at this point but we make sure */
        hpgl_clear_current_path(pcs);

        /* Initialize stick/arc font instances */
        hpgl_initialize_stick_fonts(pcs);

        /* intialize subpolygon started hack flag */
        pcs->g.subpolygon_started = false;

        /* indicates a line down operation has been done in polygon
           mode */
        pcs->g.have_drawn_in_path = false;
        /* execute only the implicit portion of IN */
        hpgl_IN_implicit(pcs);

        /* we select the default pen 1 here, oddly, IN does not select
           the default pen even though it sets pen widths and units of
           measure */
        pcs->g.pen.selected = 1;
    }
    /* NB check all of these */
    if ((type & pcl_reset_page_params) != 0) {
        /* provide default anchor point, plot size and picture frame
           size.  Oddly HP does not reset the scaling parameters
           when the page size is changed. */
        int scale_type = pcs->g.scaling_type;
        hpgl_scaling_params_t params = pcs->g.scaling_params;

        hpgl_default_coordinate_system(pcs);

        /* restore the scaling parameter. */
        pcs->g.scaling_type = scale_type;
        pcs->g.scaling_params = params;

        hpgl_args_setup(&hpgl_args);
        hpgl_IW(&hpgl_args, pcs);
        hpgl_args_set_int(&hpgl_args, 0);
        hpgl_PM(&hpgl_args, pcs);
        hpgl_args_set_int(&hpgl_args, 2);
        hpgl_PM(&hpgl_args, pcs);
        hpgl_args_setup(&hpgl_args);
        hpgl_IP(&hpgl_args, pcs);
    }

    if ((type & pcl_reset_picture_frame) != 0) {
        /* this shouldn't happen.  Picture frame side effects are
           handled directly by the command picture frame command. */
        dmprintf(pcs->memory, "PCL reset picture frame received\n");
    }

    if ((type & pcl_reset_overlay) != 0)
        /* ignore return */
        (void)hpgl_reset_overlay(pcs);

    if ((type & (pcl_reset_plot_size)) != 0) {
        /* this shouldn't happen.  Plot size side effects are handled
           directly by the command picture frame command. */
        dmprintf(pcs->memory, "PCL reset plot received\n");
    }

    if ((type & (pcl_reset_permanent)) != 0) {
        gx_path_free(&pcs->g.polygon.buffer.path,
                     "hpgl_do_reset polygon buffer");
        /* if we have allocated memory for a stick font free the memory */
        hpgl_free_stick_fonts(pcs);
    }
    return;
}
Ejemplo n.º 3
0
/* The part of the DF command applicable for overlay macros */
int
hpgl_reset_overlay(hpgl_state_t *pgls)
{	hpgl_args_t args;
	hpgl_args_setup(&args);
	hpgl_AC(&args, pgls);
	hpgl_args_setup(&args);
	pgls->g.font_selected = 0;
	hpgl_AD(&args, pgls);
	hpgl_args_setup(&args);
	hpgl_SD(&args, pgls);
	hpgl_args_setup(&args);
	hpgl_CF(&args, pgls);
	hpgl_args_setup(&args);
	hpgl_args_add_int(&args, 1);
	hpgl_args_add_int(&args, 0);
	hpgl_DI(&args, pgls);
	/* HAS -- Figure out some way to do this so that it is consistant */
	pgls->g.label.terminator = 3;
	pgls->g.label.print_terminator = false;
	hpgl_args_setup(&args);
	hpgl_DV(&args, pgls);
	hpgl_args_setup(&args);
	hpgl_ES(&args, pgls);
	pgls->g.label.write_vertical = false;
	pgls->g.label.double_byte = false;
	hpgl_args_setup(&args);
	hpgl_LM(&args, pgls);
	hpgl_args_set_int(&args, 1);
	hpgl_LO(&args, pgls);
	/* we do this instead of calling SC directly */
        if ( pgls->g.scaling_type != hpgl_scaling_none ) {
            gs_point dpt, pt; /* device point and user point */
            hpgl_call(hpgl_get_current_position(pgls, &pt));
            hpgl_call(gs_transform(pgls->pgs, pt.x, pt.y, &dpt));
            pgls->g.scaling_type = hpgl_scaling_none;
            hpgl_call(hpgl_set_ctm(pgls));
            hpgl_call(gs_itransform(pgls->pgs, dpt.x, dpt.y, &pt));
            hpgl_call(hpgl_set_current_position(pgls, &pt));
        }
	pgls->g.fill_type = hpgl_even_odd_rule;
	hpgl_args_set_int(&args,0);
	hpgl_PM(&args, pgls);
	hpgl_args_set_int(&args,2);
	hpgl_PM(&args, pgls);
	pgls->g.bitmap_fonts_allowed = 0;
	hpgl_args_setup(&args);
	hpgl_SI(&args, pgls);
	hpgl_args_setup(&args);
	hpgl_SL(&args, pgls);
	/* We initialize symbol mode directly because hpgl_SM parses
           its argument differently than most other commands */
	pgls->g.symbol_mode = 0;
	hpgl_args_setup(&args);
	hpgl_SS(&args, pgls);
	hpgl_args_set_int(&args,1);
	hpgl_TR(&args, pgls);
	hpgl_args_setup(&args);
	hpgl_TD(&args, pgls);
	hpgl_args_setup(&args);
	hpgl_MC(&args, pgls);
#ifdef LJ6_COMPAT
	/* LJ6 seems to reset PP with an IN command the Color Laserjet
           does not.  NB this needs to be handled with dynamic
           configuration */
	hpgl_args_setup(&args);
	hpgl_PP(&args, pgls);
#endif
        return 0;
}