Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2026-09

New in FPC: SVG support.

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hi,

FPC for a long time had support for raster images in fcl-image. It now has support for what is probably the most used vector image today: SVG.

Support is broad:

- All drawing primitives.
- Full font support (using platform native font support, freetype as fallback).
- CSS support (using fcl-css)
- Animation support (SMIL)
- Filters
- paint servers (patterns)

What is not supported:
- Javascript
- The DOM
- Color profiles (still planned)
Which is logical, since we're not in the browser.

The code renders a SVG file to a fcl-image supported format. For animated SVGs, the code can render a single frame at any given timestamp, or create a series of image frames in a GIF.

The results have been carefully tuned and compared with the W3C SVG reference set of images, and conformance to the standard is very good: mean/median difference <3%, barely visible with the naked eye.

An example of what can be done is viewable in

https://www.freepascal.org/~michael/svg/

As part of the work, the existing GIF reader was extended and a GIF writer was created - making the animation in the above page possible.

The code is compilable with FPC 3.2.2, I'll upload the code to a separate repo for those that want to use it with FPC 3.2.2
(it then needs trunk's fcl-css and image support included)

Still to do:
- Color profiles
- Generate a PDF image from the SVG.
- Lazarus component(s).

Enjoy!

Michael.

Reply by email

Zbyněk Fiala
to Michael Van Canneyt

Great!

Thank you very much!

ne 20.?9.?2026 v 22:58 odes?latel Michael Van Canneyt via lazarus <

Show quoted text 60 lines
napsal: Hi, FPC for a long time had support for raster images in fcl-image. It now has support for what is probably the most used vector image today: SVG. Support is broad: - All drawing primitives. - Full font support (using platform native font support, freetype as fallback). - CSS support (using fcl-css) - Animation support (SMIL) - Filters - paint servers (patterns) What is not supported: - Javascript - The DOM - Color profiles (still planned) Which is logical, since we're not in the browser. The code renders a SVG file to a fcl-image supported format. For animated SVGs, the code can render a single frame at any given timestamp, or create a series of image frames in a GIF. The results have been carefully tuned and compared with the W3C SVG reference set of images, and conformance to the standard is very good: mean/median difference <3%, barely visible with the naked eye. An example of what can be done is viewable in https://www.freepascal.org/~michael/svg/ As part of the work, the existing GIF reader was extended and a GIF writer was created - making the animation in the above page possible. The code is compilable with FPC 3.2.2, I'll upload the code to a separate repo for those that want to use it with FPC 3.2.2 (it then needs trunk's fcl-css and image support included) Still to do: - Color profiles - Generate a PDF image from the SVG. - Lazarus component(s). Enjoy! Michael. -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20260921/0da17fa3/attachment.htm>

Reply by email

Mattias Gaertner
to Michael Van Canneyt: FPC for a long time had support for raster images in fcl-image. It now has support for…
Michael Van Canneyt wrote 6 lines
Hi, FPC for a long time had support for raster images in fcl-image. It now has support for what is probably the most used vector image today: SVG.

Hooray \O/, an old dream coming true!

I added a package SVGImgLaz.lpk with a TSVGGraphic to let TPicture load svg images.
You can access and alter the SVG DOM and save the resulting svg.

The fcl-css and fcl-svg was copied and is used for fpc < 3.3.1.

It needs some optimizations.

Mattias

Reply by email

Michael Van Canneyt
to Mattias Gaertner
Mattias Gaertner wrote 15 lines
On 9/20/26 22:58, Michael Van Canneyt via fpc-pascal wrote: > > Hi, > > FPC for a long time had support for raster images in fcl-image. > It now has support for what is probably the most used vector image today: > SVG. Hooray \O/, an old dream coming true! I added a package SVGImgLaz.lpk with a TSVGGraphic to let TPicture load svg images. You can access and alter the SVG DOM and save the resulting svg.

Cool, so I no longer need to do this :-)

thanks !

The fcl-css and fcl-svg was copied and is used for fpc < 3.3.1.

You may want to add the updated gif support as well ?

It needs some optimizations.

Well, I did some optimizations already, so it at least matches RGBABitmap in speed, (although it has much more features) but I am definitely open to further suggestions...

Michael.

Reply by email

Denis Kozlov
to Mattias Gaertner: Hooray \O/, an old dream coming true! I added a package SVGImgLaz.lpk with a TSVGGraphic…

Thank you, Michael and Mattias. This is indeed an amazing and long-awaited feature.

I'm curious if this could eventually make SVG enough on its own for all common application needs:

- Application icons
- Image lists
- Control glyphs

With automatic scaling for high-DPI setups, and as a fallback when a resolution-specific image is not available.

Denis

Mattias Gaertner wrote 13 lines
On 9/20/26 22:58, Michael Van Canneyt via fpc-pascal wrote: > > FPC for a long time had support for raster images in fcl-image. > It now has support for what is probably the most used vector image > today: SVG. Hooray \O/, an old dream coming true! I added a package SVGImgLaz.lpk with a TSVGGraphic to let TPicture load svg images. You can access and alter the SVG DOM and save the resulting svg.

Reply by email

Michael Van Canneyt
to Denis Kozlov
Denis Kozlov wrote 13 lines
Thank you, Michael and Mattias. This is indeed an amazing and long-awaited feature. I'm curious if this could eventually make SVG enough on its own for all common application needs: - Application icons - Image lists - Control glyphs With automatic scaling for high-DPI setups, and as a fallback when a resolution-specific image is not available.

Theoretically this is certainly possible, but it will require some work. I do not know if all the standard icons in lazarus are available as SVG. If they are not, it would require designing them, on top of the integration work.

Michael.

Reply by email

Werner Pamler
to Michael Van Canneyt
Michael Van Canneyt wrote
I do not know if all the standard icons in lazarus are available as SVG.

Most of the Lazarus icons have been designed by Roland Hahn as SVG (even at different sizes for improved quality of the small images) from which the PNG images were created. The SVG originals can be found at https://gitlab.com/freepascal.org/lazarus/resources/-/tree/main/image_sources?ref_type=heads. Likewise, components in CCR with revised icons have their SVG sources in https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/image_sources/.

Reply by email