diff options
| author | Ulf Erikson <ulferikson@gmail.com> | 2006-08-05 21:07:34 +0000 |
|---|---|---|
| committer | ulferikson <ulferikson@users.sourceforge.net> | 2006-08-05 21:07:34 +0000 |
| commit | 7800cec1073e2476c5712f280ba9768cd8961626 (patch) | |
| tree | d2d4de34cf28d3e00a5ac2922b6b03701d7f27ab /src/extension/internal/pdf.cpp | |
| parent | Bug 1527659 (Lack of canvas dimensions integrity from SVG to PDF) (diff) | |
| download | inkscape-7800cec1073e2476c5712f280ba9768cd8961626.tar.gz inkscape-7800cec1073e2476c5712f280ba9768cd8961626.zip | |
Fix for eccentric elliptic gradients.
(bzr r1563)
Diffstat (limited to 'src/extension/internal/pdf.cpp')
| -rw-r--r-- | src/extension/internal/pdf.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/extension/internal/pdf.cpp b/src/extension/internal/pdf.cpp index 50e98d00c..bd65cd318 100644 --- a/src/extension/internal/pdf.cpp +++ b/src/extension/internal/pdf.cpp @@ -685,6 +685,13 @@ PrintPDF::print_fill_alpha(SVGOStringStream &os, SPStyle const *const style, NRR 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) {
// convert to userspace
NR::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
@@ -877,6 +884,13 @@ PrintPDF::print_fill_style(SVGOStringStream &os, SPStyle const *const style, NRR 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) {
// convert to userspace
NR::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
|
