summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ee81030)
raw | patch | inline | side by side (parent: ee81030)
author | miklosh <miklosh@users.sourceforge.net> | |
Sun, 6 Aug 2006 21:23:04 +0000 (21:23 +0000) | ||
committer | miklosh <miklosh@users.sourceforge.net> | |
Sun, 6 Aug 2006 21:23:04 +0000 (21:23 +0000) |
src/extension/internal/pdf-cairo.cpp | patch | blob | history |
index a79bb2a01e74c7840818da5738baccfc4cb3def7..0b3148d85228b4d6ecdca341e648aa0b103010d2 100644 (file)
// printf("Page Bounding Box: %s\n", pageBoundingBox ? "TRUE" : "FALSE");
if (pageBoundingBox) {
d.x0 = d.y0 = 0;
- d.x1 = ceil(_width);
- d.y1 = ceil(_height);
+ d.x1 = _width;
+ d.y1 = _height;
} else {
SPItem* doc_item = SP_ITEM(sp_document_root(doc));
sp_item_invoke_bbox(doc_item, &d, sp_item_i2r_affine(doc_item), TRUE);
fclose(_stream);
_stream = 0;
- return 0;
+ return 1;
}
unsigned int
cairo_pattern_t*
PrintCairoPDF::create_pattern_for_paint(SPPaintServer const *const paintserver, NRRect const *pbox, float alpha)
{
- cairo_pattern_t *pattern = NULL;
+ cairo_pattern_t *pattern = NULL;
bool apply_bbox2user = false;
if (SP_IS_LINEARGRADIENT (paintserver)) {
@@ -462,6 +462,13 @@ PrintCairoPDF::create_pattern_for_paint(SPPaintServer const *const paintserver,
NR::Point c (rg->cx.computed, rg->cy.computed);
NR::Point f (rg->fx.computed, rg->fy.computed);
double r = rg->r.computed;
+
+ NR::Coord const df = hypot(f[NR::X] - c[NR::X], f[NR::Y] - c[NR::Y]);
+ if (df >= r) {
+ f[NR::X] = c[NR::X] + (f[NR::X] - c[NR::X] ) * r / (float) df;
+ f[NR::Y] = c[NR::Y] + (f[NR::Y] - c[NR::Y] ) * r / (float) df;
+ }
+
if (pbox && SP_GRADIENT(rg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX)
apply_bbox2user = true;
@@ -560,8 +567,6 @@ PrintCairoPDF::fill(Inkscape::Extension::Print *mod, NRBPath const *bpath, NRMat
float alpha = 1.0;
alpha *= SP_SCALE24_TO_FLOAT(style->fill_opacity.value);
-if (alpha != 1.0)
-g_printf( "fa: %f a:%f fa*a = %f\n", alpha, _alpha_stack[_alpha_ptr], alpha*_alpha_stack[_alpha_ptr]);
alpha *= _alpha_stack[_alpha_ptr];
cairo_save(cr);