comparison src/octave-svgconvert.cc @ 31228:4c1be4d6d0d1

Hint SVG renderers to not interpolate images (bug #62998) * octave-svgconvert.cc (add_custom_properites): New function that currently only sets the "image-rendering" attribute of image elements to "optimizeSpeed".
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 01 Sep 2022 22:32:29 +0200
parents 55415fa6a20f
children 24bd675bceab
comparison
equal deleted inserted replaced
31227:0dec459a4064 31228:4c1be4d6d0d1
825 825
826 for (int ii = 0; ii < collection.count (); ii++) 826 for (int ii = 0; ii < collection.count (); ii++)
827 replace_polygons (parent_elt, collection[ii].first, collection[ii].second); 827 replace_polygons (parent_elt, collection[ii].first, collection[ii].second);
828 } 828 }
829 829
830 void add_custom_properties (QDomElement& parent_elt)
831 {
832 QDomNodeList nodes = parent_elt.childNodes ();
833
834 for (int ii = 0; ii < nodes.count (); ii++)
835 {
836 QDomNode node = nodes.at (ii);
837 if (! node.isElement ())
838 continue;
839
840 QDomElement elt = node.toElement ();
841
842 if (elt.tagName () == "image")
843 elt.setAttribute ("image-rendering", "optimizeSpeed");
844 else
845 add_custom_properties (elt);
846 }
847
848 }
849
830 #if defined (OCTAVE_USE_WINDOWS_API) && defined (_UNICODE) 850 #if defined (OCTAVE_USE_WINDOWS_API) && defined (_UNICODE)
831 extern "C" 851 extern "C"
832 int 852 int
833 wmain (int argc, wchar_t **wargv) 853 wmain (int argc, wchar_t **wargv)
834 { 854 {
961 981
962 // Do basic polygons reconstruction 982 // Do basic polygons reconstruction
963 if (QString (argv[5]).toInt ()) 983 if (QString (argv[5]).toInt ())
964 reconstruct_polygons (root); 984 reconstruct_polygons (root);
965 985
986 // Add custom properties to SVG
987 add_custom_properties (root);
988
966 // Draw 989 // Draw
967 if (! strcmp (argv[2], "pdf")) 990 if (! strcmp (argv[2], "pdf"))
968 { 991 {
969 // PDF painter 992 // PDF painter
970 pdfpainter painter (fout.fileName (), vp); 993 pdfpainter painter (fout.fileName (), vp);