[fpc-pascal] New in FPC: SVG support.
Thomas Kurz
fpc.2021 at t-net.ruhr
Mon Sep 21 21:24:41 CEST 2026
That's great news! Cool!
Thank you for that. It's a really useful enhancement. 👍
----- Original Message -----
From: Michael Van Canneyt via fpc-pascal <fpc-pascal at lists.freepascal.org>
To: FPC mailing list <fpc-pascal at lists.freepascal.org>
Sent: Sunday, September 20, 2026, 22:58:36
Subject: [fpc-pascal] New in FPC: SVG support.
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.
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list