int gs_reversepath(gs_state * pgs) { gx_path *ppath = pgs->path; gx_path rpath; int code; gx_path_init_local(&rpath, ppath->memory); code = gx_path_copy_reversed(ppath, &rpath); if (code < 0) { gx_path_free(&rpath, "gs_reversepath"); return code; } if (pgs->current_point_valid) { /* Not empty. */ gx_setcurrentpoint(pgs, fixed2float(rpath.position.x), fixed2float(rpath.position.y)); if (rpath.first_subpath != 0) { pgs->subpath_start.x = fixed2float(rpath.segments->contents.subpath_current->pt.x); pgs->subpath_start.y = fixed2float(rpath.segments->contents.subpath_current->pt.y); } } gx_path_assign_free(ppath, &rpath); return 0; }
int gx_setcurrentpoint_from_path(gs_imager_state *pis, gx_path *path) { gs_point pt; pt.x = fixed2float(path->position.x); pt.y = fixed2float(path->position.y); gx_setcurrentpoint(pis, pt.x, pt.y); pis->current_point_valid = true; return 0; }
static inline int gs_lineto_aux(gs_state * pgs, floatp x, floatp y) { gx_path *ppath = pgs->path; gs_fixed_point pt; int code; code = clamp_point_aux(pgs->clamp_coordinates, &pt, x, y); if (code < 0) return code; code = gx_path_add_line(ppath, pt.x, pt.y); if (code < 0) return code; gx_setcurrentpoint(pgs, x, y); return 0; }
/* Used by gschar.c to prepare for a BuildChar or BuildGlyph procedure. */ int gx_translate_to_fixed(register gs_state * pgs, fixed px, fixed py) { double fpx = fixed2float(px); double fdx = fpx - pgs->ctm.tx; double fpy = fixed2float(py); double fdy = fpy - pgs->ctm.ty; fixed dx, dy; int code; if (pgs->ctm.txy_fixed_valid) { dx = float2fixed(fdx); dy = float2fixed(fdy); code = gx_path_translate(pgs->path, dx, dy); if (code < 0) return code; if (pgs->char_tm_valid && pgs->char_tm.txy_fixed_valid) pgs->char_tm.tx_fixed += dx, pgs->char_tm.ty_fixed += dy; } else { if (!gx_path_is_null(pgs->path)) return_error(gs_error_limitcheck); } pgs->ctm.tx = fpx; pgs->ctm.tx_fixed = px; pgs->ctm.ty = fpy; pgs->ctm.ty_fixed = py; pgs->ctm.txy_fixed_valid = true; pgs->ctm_inverse_valid = false; if (pgs->char_tm_valid) { /* Update char_tm now, leaving it valid. */ pgs->char_tm.tx += fdx; pgs->char_tm.ty += fdy; } #ifdef DEBUG if (gs_debug_c('x')) { dlprintf2("[x]translate_to_fixed %g, %g:\n", fixed2float(px), fixed2float(py)); trace_ctm(pgs); dlprintf("[x] char_tm:\n"); trace_matrix_fixed(&pgs->char_tm); } #endif gx_setcurrentpoint(pgs, fixed2float(pgs->ctm.tx_fixed), fixed2float(pgs->ctm.ty_fixed)); pgs->current_point_valid = true; return 0; }
int gs_moveto_aux(gs_imager_state *pis, gx_path *ppath, floatp x, floatp y) { gs_fixed_point pt; int code; code = clamp_point_aux(pis->clamp_coordinates, &pt, x, y); if (code < 0) return code; code = gx_path_add_point(ppath, pt.x, pt.y); if (code < 0) return code; ppath->start_flags = ppath->state_flags; gx_setcurrentpoint(pis, x, y); pis->subpath_start = pis->current_point; pis->current_point_valid = true; return 0; }
static inline int gs_curveto_aux(gs_state * pgs, floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3) { gs_fixed_point p1, p2, p3; int code; gx_path *ppath = pgs->path; code = clamp_point_aux(pgs->clamp_coordinates, &p1, x1, y1); if (code < 0) return code; code = clamp_point_aux(pgs->clamp_coordinates, &p2, x2, y2); if (code < 0) return code; code = clamp_point_aux(pgs->clamp_coordinates, &p3, x3, y3); if (code < 0) return code; code = gx_path_add_curve(ppath, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y); if (code < 0) return code; gx_setcurrentpoint(pgs, x3, y3); return 0; }
/* Compute the stroked outline of the current path */ int gs_strokepath(gs_state * pgs) { gx_path spath; int code; gx_path_init_local(&spath, pgs->path->memory); code = gx_stroke_add(pgs->path, &spath, pgs); if (code < 0) { gx_path_free(&spath, "gs_strokepath"); return code; } pgs->device->sgr.stroke_stored = false; code = gx_path_assign_free(pgs->path, &spath); if (code < 0) return code; /* NB: needs testing with PCL */ if (CPSI_mode && gx_path_is_void(pgs->path)) pgs->current_point_valid = false; else gx_setcurrentpoint(pgs, fixed2float(spath.position.x), fixed2float(spath.position.y)); return 0; }