Exemplo n.º 1
0
void pdf_stroke(gfxdevice_t*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*color, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit)
{
    internal_t*i = (internal_t*)dev->internal;
    if(width<1e-6)
	return;
    reset_matrix(i);
    PDF_setlinewidth(i->p, width);
    PDF_setlinecap(i->p, cap_style==gfx_capButt?0:(cap_style==gfx_capRound?1:2));
    PDF_setlinejoin(i->p, joint_style==gfx_joinMiter?0:(joint_style==gfx_joinRound?1:2));
    
    PDF_setrgbcolor_stroke(i->p, color->r/255.0, color->g/255.0, color->b/255.0);

    if(joint_style==gfx_joinMiter)
	PDF_setmiterlimit(i->p, miterLimit);
    if(mkline(line, i->p, i->config_xpad, i->config_ypad, 1.0, 0))
	PDF_stroke(i->p);
}
Exemplo n.º 2
0
PDFLIB_API void PDFLIB_CALL
PDF_setrgbcolor(PDF *p, float red, float green, float blue)
{
    if (PDF_SANITY_CHECK_FAILED(p))
	return;

    if (red < 0.0 || red > EPSILON || green < 0.0 || green > EPSILON ||
	blue < 0.0 || blue > EPSILON) {
	pdf_error(p, PDF_NonfatalError, 
	    "Bogus color value (%f/%f/%f) in PDF_setrgbcolor",
	    red, green, blue);
	return;
    }

    if (red == green && green == blue)
	PDF_setgray(p, red);
    else {
	PDF_setrgbcolor_fill(p, red, green, blue);
	PDF_setrgbcolor_stroke(p, red, green, blue);
    }
}