/* reset all gstate parameters except CTM */ void pdf_reset_gstate(PDF *p) { pdf_gstate *gs = &p->curr_ppt->gstate[p->curr_ppt->sl]; pdf_set_default_color(p, pdc_true); pdf__setlinewidth(p, 1); pdf__setlinecap(p, 0); pdf__setlinejoin(p, 0); pdf__setmiterlimit(p, 10); pdf__setdash(p, 0, 0); if (gs->flatness != -1) pdf__setflat(p, 1); }
PDFLIB_API void PDFLIB_CALL PDF_setlinewidth(PDF *p, float width) { static const char fn[] = "PDF_setlinewidth"; if (!pdf_enter_api(p, fn, pdf_state_content, "(p[%p], %g)\n", (void *) p, width)) return; if (width <= (float) 0.0) pdc_error(p->pdc, PDC_E_ILLARG_FLOAT, "width", pdc_errprintf(p->pdc, "%f", width), 0, 0); pdf__setlinewidth(p, width); }
/* reset all gstate parameters except CTM */ void pdf_reset_gstate(PDF *p) { pdf_gstate *gs = &p->gstate[p->sl]; pdf__setcolor(p, "fillstroke", "gray", (float) 0, (float) 0, (float) 0, (float) 0); pdf__setlinewidth(p, 1); pdf__setlinecap(p, 0); pdf__setlinejoin(p, 0); pdf__setmiterlimit(p, 10); pdf__setdash(p, 0, 0); if (gs->flatness != (float) -1) pdf__setflat(p, (float) 1.0); }
void pdf_draw_mbox_rectangle(PDF *p, pdf_mbox *mbox, int flags) { pdc_bool drawleft, drawright, drawbottom, drawtop; pdc_bool saverestore = (flags & mbox_saverestore) && ((flags & mbox_area && mbox->fillcolor.type != (int) color_none) || (flags & mbox_border && mbox->strokecolor.type != (int) color_none && mbox->borderwidth > 0)); if (saverestore) pdf__save(p); if (flags & mbox_area && mbox->fillcolor.type != (int) color_none && mbox->rect.llx != mbox->rect.urx && mbox->rect.lly != mbox->rect.ury) { pdf_set_coloropt(p, pdf_fill, &mbox->fillcolor); pdf__moveto(p, mbox->rect.llx, mbox->rect.lly); pdf__lineto(p, mbox->rect.urx, mbox->rect.lly); pdf__lineto(p, mbox->rect.urx, mbox->rect.ury); pdf__lineto(p, mbox->rect.llx, mbox->rect.ury); pdf__lineto(p, mbox->rect.llx, mbox->rect.lly); pdf__fill(p); } if (flags & mbox_border && mbox->strokecolor.type != (int) color_none && mbox->borderwidth > 0) { pdf_set_coloropt(p, pdf_stroke, &mbox->strokecolor); pdf__setlinewidth(p, mbox->borderwidth); pdf_setdashpattern_internal(p, mbox->dasharray, mbox->dashlength, mbox->dashphase); pdf__setlinecap(p, mbox->linecap); pdf__setlinejoin(p, mbox->linejoin); drawbottom = mbox->drawbottom && (!(flags & mbox_openbottom) || !mbox->openrect); if (drawbottom) { pdf__moveto(p, mbox->rect.llx, mbox->rect.lly); pdf__lineto(p, mbox->rect.urx, mbox->rect.lly); } drawright = mbox->drawright && (!(flags & mbox_openright) || !mbox->openrect); if (drawright) { if (!drawbottom) pdf__moveto(p, mbox->rect.urx, mbox->rect.lly); pdf__lineto(p, mbox->rect.urx, mbox->rect.ury); } drawtop = mbox->drawtop && (!(flags & mbox_opentop) || !mbox->openrect); if (drawtop) { if (!drawright) pdf__moveto(p, mbox->rect.urx, mbox->rect.ury); pdf__lineto(p, mbox->rect.llx, mbox->rect.ury); } drawleft = mbox->drawleft && (!(flags & mbox_openleft) || !mbox->openrect); if (drawleft) { if (!drawtop) pdf__moveto(p, mbox->rect.llx, mbox->rect.ury); if (drawbottom && drawright && drawtop) pdf__closepath(p); else pdf__lineto(p, mbox->rect.llx, mbox->rect.lly); } pdf__stroke(p); } if (saverestore) pdf__restore(p); }