SVG to PNG convertion


#1

Is it possible to use Cinder as SVG rasterizer to PNG?
I am thinking of using Cinder as dll or executable in my application in order to display SVG files that contain complicated elements like text, gradients, transparency etc.
I’d like to use Cinder over Qt SVG for rendering because Qt’s SVG supports only SVG 1.2 Tiny and I’d like 1.1.
My application target platforms are Mac OS and Windows, Unix (for development).

Thanks in advance :slight_smile:


#2

Yep, have a look at samples/_svg/EuroMap, and specifically the renderSvgToTexture function. You can use ci::writeImage to dump srf.getSurface() to disk rather than uploading it as a texture.

You can use the cairo cinderblock that comes with cinder to render your svg as well.


#3

Thanks a lot! I will check it out and write result.


#4

Hello again!
I did git clone --recursive https://github.com/cinder/Cinder.git.
I followed instructions @ linux notes ubuntu above 14.04 and failed while executing make:
got the following output:

[ 50%] Building CXX object CMakeFiles/BasicApp.dir/home/vadixem/projects/Cinder/samples/BasicApp
/src/BasicApp.cpp.o

[100%] Linking CXX executable Debug/BasicApp/BasicApp

/usr/bin/ld: /home/vadixem/projects/Cinder/lib/linux/x86_64//libboost_system.a(error_code.o): relocation 
R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

/usr/bin/ld: /home/vadixem/projects/Cinder/lib/linux/x86_64//libboost_filesystem.a(operations.o): relocation 
R_X86_64_32 against symbol `_ZN5boost10filesystem16filesystem_errorD1Ev' can not be used when making 

    a shared object; recompile with -fPIC

/usr/bin/ld: /home/vadixem/projects/Cinder/lib/linux/x86_64//libboost_filesystem.a(path.o): relocation 
R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

/usr/bin/ld: final link failed: Nonrepresentable section on output

collect2: error: ld returned 1 exit status

CMakeFiles/BasicApp.dir/build.make:116: recipe for target 'Debug/BasicApp/BasicApp' failed

make[2]: *** [Debug/BasicApp/BasicApp] Error 1

Than tried the solution : http://discourse.libcinder.org/t/solved-cinder-with-arch/887/2
Didn’t work and gave me:

CMake Error at /usr/share/cmake-3.9/Modules/FindBoost.cmake:1898 (message): Unable to find the requested Boost libraries.

  Boost version: 1.65.1

  Boost include path: /usr/local/include

  Could not find the following Boost libraries:

      boost_system
      boost_filesystem

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
          directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  proj/cmake/platform_linux.cmake:168 (find_package)
  CMakeLists.txt:29 (include)

#5

Sorry mate, I know bugger all about the linux situation. @petros is your man.


#6

Hi,

under which Linux flavor are you trying to build this on? It seems that boost-system and boost-filesystem are not installed. Make sure to install the development version of the packages so that the header files are also installed.

HTH,
Petros