summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-02-19 10:48:41 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-02-19 10:48:41 +0000
commitf15ac06ffd9cc8dbb098b18a6b273b32fc904fc9 (patch)
tree482bc967d7e637d3f8817aa2074362a461465603 /src/extension
parentupdate to trunk (diff)
parentAdd SVG2 property 'paint-order'. (diff)
downloadinkscape-f15ac06ffd9cc8dbb098b18a6b273b32fc904fc9.tar.gz
inkscape-f15ac06ffd9cc8dbb098b18a6b273b32fc904fc9.zip
update to trunk
(bzr r11950.1.254)
Diffstat (limited to 'src/extension')
-rw-r--r--src/extension/internal/cairo-render-context.cpp23
-rw-r--r--src/extension/internal/gdkpixbuf-input.cpp22
-rw-r--r--src/extension/internal/pdfinput/svg-builder.cpp4
3 files changed, 43 insertions, 6 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);
diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp
index ec04b1dad..a384c7bde 100644
--- a/src/extension/internal/gdkpixbuf-input.cpp
+++ b/src/extension/internal/gdkpixbuf-input.cpp
@@ -30,22 +30,31 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri)
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool ask = prefs->getBool("/dialogs/import/ask");
Glib::ustring link = prefs->getString("/dialogs/import/link");
+ bool forcexdpi = prefs->getBool("/dialogs/import/forcexdpi");
Glib::ustring scale = prefs->getString("/dialogs/import/scale");
// std::cout << "GkdpixbufInput::open: "
// << " ask: " << ask
// << ", link: " << link
+ // << ", forcexdpi: " << forcexdpi
// << ", scale: " << scale << std::endl;
// std::cout << " in preferences: "
// << " ask: " << !mod->get_param_bool("do_not_ask")
// << ", link: " << mod->get_param_optiongroup("link")
+ // << ", mod_dpi: " << mod->get_param_optiongroup("dpi")
// << ", scale: " << mod->get_param_optiongroup("scale") << std::endl;
if( ask ) {
Glib::ustring mod_link = mod->get_param_optiongroup("link");
+ Glib::ustring mod_dpi = mod->get_param_optiongroup("dpi");
+ bool mod_forcexdpi = ( mod_dpi.compare( "from_default" ) == 0 );
Glib::ustring mod_scale = mod->get_param_optiongroup("scale");
if( link.compare( mod_link ) != 0 ) {
link = mod_link;
}
prefs->setString("/dialogs/import/link", link );
+ if( forcexdpi != mod_forcexdpi ) {
+ forcexdpi = mod_forcexdpi;
+ }
+ prefs->setBool("/dialogs/import/forcexdpi", forcexdpi );
if( scale.compare( mod_scale ) != 0 ) {
scale = mod_scale;
}
@@ -68,7 +77,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri)
double width = pb->width();
double height = pb->height();
double defaultxdpi = prefs->getDouble("/dialogs/import/defaultxdpi/value", Inkscape::Util::Quantity::convert(1, "in", "px"));
- bool forcexdpi = prefs->getBool("/dialogs/import/forcexdpi");
+ //bool forcexdpi = prefs->getBool("/dialogs/import/forcexdpi");
ImageResolution *ir = 0;
double xscale = 1;
double yscale = 1;
@@ -179,18 +188,21 @@ GdkpixbufInput::init(void)
"<name>%s</name>\n"
"<id>org.inkscape.input.gdkpixbuf.%s</id>\n"
- "<param name='link' type='optiongroup' appearance='full' _gui-text='" N_("Link or embed image:") "' >\n"
+ "<param name='link' type='optiongroup' appearance='full' _gui-text='" N_("Image Import Type:") "' _gui-description='" N_("Embed results in stand-alone, larger SVG files. Link references a file outside this SVG document and all files must be moved together.") "' >\n"
"<_option value='embed' >" N_("Embed") "</_option>\n"
"<_option value='link' >" N_("Link") "</_option>\n"
"</param>\n"
- "<_param name='help' type='description'>" N_("Embed results in stand-alone, larger SVG files. Link references a file outside this SVG document and all files must be moved together.") "</_param>\n"
- "<param name='scale' type='optiongroup' appearance='full' _gui-text='" N_("Scale image preference (image-rendering):") "' >\n"
+ "<param name='dpi' type='optiongroup' appearance='full' _gui-text='" N_("Image DPI:") "' _gui-description='" N_("Take information from file or use default bitmap import resolution as defined in the preferences.") "' >\n"
+ "<_option value='from_file' >" N_("From file") "</_option>\n"
+ "<_option value='from_default' >" N_("Default import resolution") "</_option>\n"
+ "</param>\n"
+
+ "<param name='scale' type='optiongroup' appearance='full' _gui-text='" N_("Image Rendering Mode:") "' _gui-description='" N_("When an image is upscaled, apply smoothing or keep blocky (pixelated). (Will not work in all browsers.)") "' >\n"
"<_option value='auto' >" N_("None (auto)") "</_option>\n"
"<_option value='optimizeQuality' >" N_("Smooth (optimizeQuality)") "</_option>\n"
"<_option value='optimizeSpeed' >" N_("Blocky (optimizeSpeed)") "</_option>\n"
"</param>\n"
- "<_param name='help' type='description'>" N_("When an image is upscaled, apply smoothing or keep blocky (pixelated). (Will not work in all browsers.)") "</_param>\n"
"<param name=\"do_not_ask\" _gui-description='" N_("Hide the dialog next time and always apply the same actions.") "' gui-text=\"" N_("Don't ask again") "\" type=\"boolean\" >false</param>\n"
"<input>\n"
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
index b3f15bbff..20cd74cdb 100644
--- a/src/extension/internal/pdfinput/svg-builder.cpp
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
@@ -1657,6 +1657,10 @@ Inkscape::XML::Node *SvgBuilder::_createImage(Stream *str, int width, int height
Inkscape::XML::Node *image_node = _xml_doc->createElement("svg:image");
sp_repr_set_svg_double(image_node, "width", 1);
sp_repr_set_svg_double(image_node, "height", 1);
+
+ // PS/PDF images are placed via a transformation matrix, no preserveAspectRatio used
+ image_node->setAttribute("preserveAspectRatio", "none");
+
// Set transformation
svgSetTransform(image_node, 1.0, 0.0, 0.0, -1.0, 0.0, 1.0);