/* relatives. */ int gx_path_add_char_path(gx_path * to_path, gx_path * from_path, gs_char_path_mode mode) { int code; gs_fixed_rect bbox; switch (mode) { default: /* shouldn't happen! */ gx_path_new(from_path); return 0; case cpm_charwidth: { gs_fixed_point cpt; code = gx_path_current_point(from_path, &cpt); if (code < 0) break; return gx_path_add_point(to_path, cpt.x, cpt.y); } case cpm_true_charpath: case cpm_false_charpath: return gx_path_add_path(to_path, from_path); case cpm_true_charboxpath: gx_path_bbox(from_path, &bbox); code = gx_path_add_rectangle(to_path, bbox.p.x, bbox.p.y, bbox.q.x, bbox.q.y); break; case cpm_false_charboxpath: gx_path_bbox(from_path, &bbox); code = gx_path_add_point(to_path, bbox.p.x, bbox.p.y); if (code >= 0) code = gx_path_add_line(to_path, bbox.q.x, bbox.q.y); break; } if (code < 0) return code; gx_path_new(from_path); return 0; }
int gs_newpath(gs_state * pgs) { pgs->current_point_valid = false; return gx_path_new(pgs->path); }
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; }