Recent

Author Topic: Show a SVG file  (Read 13704 times)

DeBritto

  • Jr. Member
  • **
  • Posts: 68
Show a SVG file
« on: December 03, 2015, 05:49:35 pm »
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

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Show a SVG file
« Reply #1 on: December 04, 2015, 11:58:30 am »
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.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Edson

  • Hero Member
  • *****
  • Posts: 1302
Re: Show a SVG file
« Reply #2 on: December 04, 2015, 01:27:57 pm »
I had problems when using  SVG files in FPVectorial: http://forum.lazarus.freepascal.org/index.php/topic,29621.msg187403.html#msg187403

It seems it's not correctly implemented.

Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Show a SVG file
« Reply #3 on: December 04, 2015, 02:25:06 pm »
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.

When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

x2nie

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Show a SVG file
« Reply #4 on: December 04, 2015, 02:35:27 pm »
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.


Hi Graeme, is there any AggPas demo/app that manipulates/edit SVG file ? I am curious. 8-) ;)
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Show a SVG file
« Reply #5 on: December 04, 2015, 05:06:26 pm »
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.
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

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Show a SVG file
« Reply #6 on: December 06, 2015, 11:22:48 am »
Hi Graeme, is there any AggPas demo/app that manipulates/edit SVG file ? I am curious. 8-) ;)
Yes there are a few, take a look at the demos included with AggPas.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

DeBritto

  • Jr. Member
  • **
  • Posts: 68
Re: Show a SVG file
« Reply #7 on: December 10, 2015, 04:12:06 pm »
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
« Last Edit: December 11, 2015, 12:53:17 pm by DeBritto »

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Show a SVG file
« Reply #8 on: December 10, 2015, 04:18:18 pm »
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

  • Jr. Member
  • **
  • Posts: 68
Re: Show a SVG file
« Reply #9 on: December 10, 2015, 05:31:54 pm »
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

  • Hero Member
  • *****
  • Posts: 515
  • Impossible=I don't know the way
    • impossible is nothing - www.x2nie.com
Re: Show a SVG file
« Reply #10 on: December 10, 2015, 06:09:16 pm »
The 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
« Last Edit: December 10, 2015, 06:10:58 pm by x2nie »
When you were logged in, you can see attachments.
Lazarus Github @ UbuntuCinnamon-v22.04.1 + LinuxMintDebianEdition5

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Show a SVG file
« Reply #11 on: December 10, 2015, 10:01:03 pm »
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

  • Jr. Member
  • **
  • Posts: 68
Re: Show a SVG file
« Reply #12 on: December 11, 2015, 12:57:16 pm »
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

  • Jr. Member
  • **
  • Posts: 68
Re: Show a SVG file
« Reply #13 on: December 11, 2015, 01:02:28 pm »
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

  • Hero Member
  • *****
  • Posts: 11916
Re: Show a SVG file
« Reply #14 on: December 15, 2015, 05:10:52 pm »
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)...

 

TinyPortal © 2005-2018