cppfw / svgren

:camera: SVG rendering library in C++
MIT License
206 stars 41 forks source link

fit image (svg) in window, on render test project under msvs_solution #64

Closed goodyes closed 5 years ago

goodyes commented 5 years ago

Is there any way to fit the image on to window ? (width and height)

igagis commented 5 years ago

Try explicitly setting the width and height of the resulting image:

svgren::Parameters p;
p.widthRequest = 1024; //0 means use width from SVG document
p.heightRequest = 768; //0 means use height from SVG document
auto result = svgren::render(*dom, p);
goodyes commented 5 years ago

Done, thks, it works wellThe only downside is that to load the svg takes too much time. But rest is nice. En jueves, 20 de diciembre de 2018 15:47:58 CET, Ivan Gagis notifications@github.com escribió:

Try explicitly set the width and height of the resulting image: svgren::Parameters p; p.widthRequest = 1024; //0 means use width from SVG document p.heightRequest = 768; //0 means use height from SVG document auto result = svgren::render(*dom, p); — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

igagis commented 5 years ago

well, you have to load it only once ;). Rendering also can be slow, but that's for complex SVGs