Show a SVG file lazarus / 39-Graphics ---------------------------------------------------------------------- DeBritto · 2015-12-03 16:49 Hi, I have a simple question. I would like to know how to read an SVG file and show it on screen with FPVectorial. It would be nice to have a ZoomIn and ZoomOut option too. Can anyone help me on this? Best regards ---------------------------------------------------------------------- Graeme · 2015-12-04 10:58 I don't know FPVectorial or if you must use it. If you are open for alternatives, you can use AggPas to display and manipulate SVG images. ---------------------------------------------------------------------- Edson · 2015-12-04 12:27 I had problems when using  SVG files in FPVectorial: http://forum.laza rus.freepascal.org/index.php/topic,29621.msg187403.html#msg187403 It seems it's not correctly implemented. ---------------------------------------------------------------------- x2nie · 2015-12-04 13:25 if GR32 is your choice, you can try (finally use) my hand-crafted GR32  https://github.com/x2nie/GR32_SVG It was intended for Delphi user, but Lazarus would be no difficult to port. Because GR32 already works nicely in Lazarus. // i just not yet test it with Lazarus. ---------------------------------------------------------------------- x2nie · 2015-12-04 13:35 Quote from: Graeme on December 04, 2015, 11:58:30 amI don't know FPVectorial or if you must use it. If you are open for alternatives, you can use AggPas to display and manipulate SVG images. Hi Graeme, is there any AggPas demo/app that manipulates/edit SVG file ? I am curious. ---------------------------------------------------------------------- wp · 2015-12-04 16:06 Quote from: DeBritto on December 03, 2015, 05:49:35 pmI have a simple question. I would like to know how to read an SVG file and show it on screen with FPVectorial. It would be nice to have a ZoomIn and ZoomOut option too. In the Lazarus Code and Components Repository ("ccr"), folder "applications/fpvviewer", you find a simple graphics viewing application based upon fpvectorial (https://sourceforge.net/p/lazarus- ccr/svn/HEAD/tree/applications/fpvviewer/). It is more a test suite of the component developer than a stand-alone application, but it shows how many effects can be achieved. For zooming, for example, you can take advantage of the parameters AMulX and AMulY passed to the Render method of the TvVectorialPage. As noted by Edson above, however, you should be aware that svg support is not complete and buggy in some cases. Typically you access the ccr via svn. If you don't use svn there is a snapshot download of the entire repository, after the download just delete what you don't need. ---------------------------------------------------------------------- Graeme · 2015-12-06 10:22 Quote from: x2nie on December 04, 2015, 02:35:27 pmHi Graeme, is there any AggPas demo/app that manipulates/edit SVG file ? I am curious. Yes there are a few, take a look at the demos included with AggPas. ---------------------------------------------------------------------- DeBritto · 2015-12-10 15:12 Hi, First of all, I'm so sorry for the delay in my response. I was sick these days... Beyond this, I don't know why, I cannot reach the lazarus (web page and forum) web site through my Windows laptop. It works only on my Dual Boot Win/Linux Desktop... Thank you so much for the answers. It really threw light on my question. I'll not try to use FpVectorial anymore... But I've found AggPas too complex and difficult to understand. I Have the SVG file already, I just want to show it on the screen. It's a GraphViz svg graphic. The GR32_SVG component looks good, but I'll need to port it and don't know how where to start... Any Suggestions? Best regards From Brazil ---------------------------------------------------------------------- wp · 2015-12-10 15:18 Why don't you upload the svg file? I'm not the author of fpvectorial, but I could have a look, maybe it works, or maybe it's something easy. Nobody knows if nobody tries. ---------------------------------------------------------------------- DeBritto · 2015-12-10 16:31 Hi, This is what I'm talking about. I have a routine that generates this kind of graphics using Graphviz. I Just need to show it on the screen and give the user the option to ZoomIn and ZoomOut. Thanks ---------------------------------------------------------------------- x2nie · 2015-12-10 17:09 Quote from: DeBritto on December 10, 2015, 04:12:06 pmThe VG32_SVG component looks good, but I'll need to port it and don't know how where to start... Any Suggestions? Do you mean my GR32_SVG? I don't see any "VG32_SVG"  in google.com . If so, port to what from what? Sorry for I am being pedantic, it because my english skill is very limited to grammatical things, I can not understand any idiom. So you must speak english in formal grammatical way. Well, if you want to port that lib from delphi to lazarus, please make sure that you are installing GR32 library properly first. You might run any GR32 demo project, until there are no error message. After that, I will help you if any proble occured during your porting to Lazarus. I know Lazarus, I know GR32, I just didn't yet try my SVG+Lazarus yet. Let me know if I can help you further. THanks you ---------------------------------------------------------------------- wp · 2015-12-10 21:01 Let me see what I can do with fpvectorial. Your file does not display correctly (texts not centered in boxes, no gradients, no dotted lines), but I feel that it would not be too difficult to fix all that. Give me some time... ---------------------------------------------------------------------- DeBritto · 2015-12-11 11:57 Sorry x2Nie I mispeled the nameI  misspelled the name, I was  wanting to say GR32_SVG. Your component looks very interesting, but I need something that could be run in Mac OS/Linux/Windows. I'm still learning Lazarus but I think the component nedd some adjustments to run on it. Am I right? ---------------------------------------------------------------------- DeBritto · 2015-12-11 12:02 Hi wp , thank you so much for your efforts to show the graphic in fpvectrial. If it works I'll appreciate so much because I still not so good in Lazarus to do it by myself. I used to be a professional programmer a long time ago, in that good old Clipper/dBase times... Now I'm a sociologist and I'm using Lazarus to build a database for my doctoral thesis. I think that you'll like to know that is a Open Source program aimed to help poor communities - or facing socioambiental problems - to thrive. If you are really interested in now more about this work I can send to you a research paper. Thanks a lot for your efforts. ---------------------------------------------------------------------- wp · 2015-12-15 16:10 I uploaded a bunch of fpvectorial bug fixes to Lazarus trunk and wrote an example of an svg viewer based on Felipe's fpvviewer with zooming and panning capabilities (zoom by mouse wheel, pan by dragging with the left mouse button). Find the source on my own code repository (http://sourceforge.net/p/wp-laz/code/HEAD/tree/svgViewer/trunk/). In the attachment there's a screenshot of your file which loads much better now, some issues left, though (no gradient fill of the boxes, slight text misalignment, no dotted lines)... ---------------------------------------------------------------------- zamtmn · 2015-12-15 21:11 Unfortunately in my opinion it looks poorly, such a small file brings my I7 to a noise fans and hangs. If you make the scale big enough ---------------------------------------------------------------------- wp · 2015-12-15 21:48 Yes I know. It renders the entire page into a bitmap, but at high zoom level displays only a small part of it. My main intention was to have a workbed for testing fpvectorial which is more convenient to me than the fpvviewer. ---------------------------------------------------------------------- DeBritto · 2015-12-15 22:57 Hi WP, Thank you so much, I really appreciate your efforts. But, Unfortunately - as I told you before - this graphics are a part of a specific scientific methodology. In this case, the lines, colors and dotted lines have a special meaning. Do you think that is possible to improve fpVectorial more in the future? Again, I appreciate your efforts! Best regards ---------------------------------------------------------------------- wp · 2015-12-16 09:05 @zamtmn: Could you post the file? Maybe your trouble is not caused by the display program, but by features in the file which are incorrectly supported by fpvectorial. ---------------------------------------------------------------------- Graeme · 2015-12-16 09:16 Quote from: wp on December 15, 2015, 05:10:52 pmIn the attachment there's a screenshot of your file which loads much better now, some issues left, though (no gradient fill of the boxes, slight text misalignment, no dotted lines)... ...and no anti-aliased line drawing. But thanks for the efforts and good work! ---------------------------------------------------------------------- zamtmn · 2015-12-16 10:42 wp I spoke about the file of the original poster In my implementation dotted lines are visible, though of course the problems also missing