Exemplo n.º 1
0
int
gs_upmergepath(gs_state * pgs)
{
    /*
     * We really should be able to implement this as simply
     *   return gx_path_add_path(pgs->saved->path, pgs->path);
     * But because of the current_point members in the imager state,
     * we can't.
     */
    gs_state *saved = pgs->saved;
    int code;

    code = gx_path_add_path(saved->path, pgs->path);
    if (code < 0)
	return code;
    if (pgs->current_point_valid) {
	saved->current_point = pgs->current_point;
	saved->subpath_start = pgs->subpath_start;
	saved->current_point_valid = true;
    }
    return code;
}
Exemplo n.º 2
0
/* 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;
}