[Libreoffice] [Patch] SVG export filter improvements

Thorsten Behrens thb at documentfoundation.org
Wed Feb 2 06:09:12 PST 2011

KUROSAWA, Takeshi wrote:
> Here are some patches to improve SVG export filter.
Hi Takeshi,

wow, this is great work! I have only one comment (and a suggestion,
see below):

> 0003: Make filter export linear and axial gradients as SVG <linearGradient>s.
> Use SVG's native gradient instead of polygon fallback.
> With this patch, gradient steps of linear and axial gradient are ignored.
> In other words, linear and axial gradients are always exported as
> "smooth" gradients.
> However, as far as I know, the manual steps function is for printing.
> So I suppose ignoring gradient steps is safe.
Nope, this is still in use, especially in legacy binary documents
(soon to be axed I guess), and more importantly, for all those svm
metafiles. Could you keep both code paths - i.e. falling back to the
old code, should there be a step count (with 0 meaning smooth
gradient, and maybe you can even cut off at something like 100 or so

I have not yet applied the patches, to not interfere with potential
rework on your side.

A bit orthogonal to this great improvement, let me point you to
https://github.com/knobo/OOo-svg-Export.git - this is an early stage
of a slightly different attempt, using the new drawing layer
primitives (that contain more high-level geometry information, like
stroking etc.). I attach two changes I had lying around locally -
maybe you're also interested in looking into that.

Additionally (though not sure it's of help here, as it's designed
for high-level ODF-style gradients) - there's
basegfx/inc/basegfx/tools/gradienttools.hxx, that encapsulates most
of the pain involved in converting gradient types.

> To support native gradients, I need to calculate a bounding box of a gradient.
> Currently it is done in OutputDevice::ImplDrawLinearGradient and
> OutputDevice::ImplDrawComplexGradient.
> So I moved that to Gradient class (0002 patch) to use it in filter code.
This is fine.

> 0004: Make filter export transparencies as SVG <mask>s.
> SVG export filter supports only solid transparency of solid fill (i.e.
> color) until now.
> The patch extends support to support solid and gradient transparency
> of all fill styles.
> # Some SVG viewers including WebKit don't support <mask> yet :-(.
I'd take that route anyway.


-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Write-header-more-compile-fixes.patch
Type: text/x-patch
Size: 13038 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110202/c5498f17/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-More-tweaks.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110202/c5498f17/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110202/c5498f17/attachment-0001.pgp>

More information about the LibreOffice mailing list