summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/cairo-render-context.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2014-02-12 12:12:39 +0000
committertavmjong-free <tavmjong@free.fr>2014-02-12 12:12:39 +0000
commite24b23c1189ab152ba877593e268b2cac1524903 (patch)
tree028aad9c98db95661f78236b56a142e3c48034b2 /src/extension/internal/cairo-render-context.cpp
parentFix for Bug #1248542 (fix for filters.svg) by v1nce. (diff)
downloadinkscape-e24b23c1189ab152ba877593e268b2cac1524903.tar.gz
inkscape-e24b23c1189ab152ba877593e268b2cac1524903.zip
Set bitmap upscaling preference in Cairo based PS and PDF output.
(bzr r13025)
Diffstat (limited to 'src/extension/internal/cairo-render-context.cpp')
-rw-r--r--src/extension/internal/cairo-render-context.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 47de62ac0..2916d9fa9 100644
--- a/src/extension/internal/cairo-render-context.cpp
+++ b/src/extension/internal/cairo-render-context.cpp
@@ -1433,7 +1433,7 @@ CairoRenderContext::renderPathVector(Geom::PathVector const & pathv, SPStyle con
}
bool CairoRenderContext::renderImage(Inkscape::Pixbuf *pb,
- Geom::Affine const &image_transform, SPStyle const * /*style*/)
+ Geom::Affine const &image_transform, SPStyle const *style)
{
g_assert( _is_valid );
@@ -1468,6 +1468,27 @@ bool CairoRenderContext::renderImage(Inkscape::Pixbuf *pb,
cairo_rectangle(_cr, 0, 0, w, h);
cairo_clip(_cr);
}
+
+ // Cairo filter method will be mapped to PS/PDF 'interpolate' true/false).
+ // See cairo-pdf-surface.c
+ if (style) {
+ // See: http://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty
+ // http://www.w3.org/TR/css4-images/#the-image-rendering
+ // style.h/style.cpp
+ switch (style->image_rendering.computed) {
+ case SP_CSS_COLOR_RENDERING_AUTO:
+ // Do nothing
+ break;
+ case SP_CSS_COLOR_RENDERING_OPTIMIZEQUALITY:
+ cairo_pattern_set_filter(cairo_get_source(_cr), CAIRO_FILTER_BEST );
+ break;
+ case SP_CSS_COLOR_RENDERING_OPTIMIZESPEED:
+ default:
+ cairo_pattern_set_filter(cairo_get_source(_cr), CAIRO_FILTER_NEAREST );
+ break;
+ }
+ }
+
cairo_paint_with_alpha(_cr, opacity);
cairo_restore(_cr);