MCGR repair broken offset on import

Regina Henschel rb.henschel at
Wed Apr 5 11:58:56 UTC 2023

Hi Armin, hi all,

I'm currently working on import of multicolor gradients from ODF.

With my proposal for standardizing multicolor gradients the offset 
values would be in interval [0.0,1.0] and sorted in ascending order in a 
valid file markup.

Should I nevertheless repair a broken sequence of gradient stops to be 
tolerant in regard to invalid markup?

If yes, how to handle offsets out of range? It could be:
(1) remove such stops
(2) round up values < 0.0 to 0.0 and round down values > 1.0 to 1.0.
(2) corresponds to section SVG specification [1]

If yes, how to handle out of order?
My suggestion would be to do the same as specified for SVG [1]

My proposal for standardizing multicolor gradients contains the rule:
"If the first <draw:gradient-stop> element has a svg:offset value larger 
than 0.0, consumers shall behave as if there is an additional 
<draw:gradient-stop> element with svg:offset="0.0" and same 
<style:enhanced-color> and <style:color-transform> child elements as in 
the first <draw:gradient-stop> element."
and analogous for 1.0.

I could add such additional stop on import. Should I do that, or do you 
always handle such situation already in this sense?

or at the end of section 13.2 in

Kind regards,

More information about the LibreOffice mailing list