Offset uniqueness in vector of ColorSteps

Michael Stahl mst at libreoffice.org
Thu Mar 16 11:35:02 UTC 2023


On 15.03.23 16:24, Regina Henschel wrote:
> Hi Armin, hi Michael,
> 
> Michael, I have put you an CC, because this is about ODF. Do you prefer 
> one of the ideas (A)(B)(C)(D) or have a better idea?
> 
> Armin Le Grand schrieb am 15.03.2023 um 11:20:
>> Hi Regina,
> {..]
> 
>>
>> Yes, we cannot change our stuff too far to get to svg definitions - we 
>> will not get rid of these. We will also not have a svg:spreadMethod. 
>> The currently important point is to use existing svg definitions (to 
>> not get even further away from svg as needed) as far as possible, as 
>> far in their svg meaning as possible, too.
>>
>> For now we need to get the Color-Stops added to 'our' gradients. Do 
>> you have concrete examples/advice how to do that?
> 
> I can think of these ways:
> (A)
> Add a child element <draw:gradient-stop-list> as optional child element 
> to <draw:gradient>.
> Specify that if a <draw:gradient-stop-list> child element is present, 
> then the attributes draw:start-color, draw:start-intensity, 
> draw:end-color, draw:end-intensity and draw:gradien-step-count are 
> ignored.
> The <draw:gradient-stop-list> element has <svg:stop> child elements, in RNG
>      <rng:zeroOrMore>
>          <rng:ref name="svg-stop"/>
>      </rng:zeroOrMore>
> Specify that the rules in 13.2.4 SVG 1.1. for interpreting the 
> svg:offset values and handling of less than two <svg:stop> elements 
> shall be followed.

i don't get what is the point of doing this, why not just use 
svg:lineargradient then?

> (B)
> Add
>      <rng:zeroOrMore>
>          <rng:ref name="svg-stop"/>
>      </rng:zeroOrMore>
> as child elements to <draw:gradient> and a boolean attribute
> draw:multicolor.
> If draw:multicolor is true, then the child elements <svg:stop> are used 
> and draw:start-color ... are ignored, otherwise draw:start-color ... are 
> used.
> Specify that the rules in 13.2.4 SVG 1.1. ... shall be followed.

this is very similar to (A), so same question.

> (C)
> Add total new <draw:multicolor-gradient> element. Define it that way, 
> that it is suitable to describe OOXML gradFill and suitable to describe 
> a multi-color version of LO's current <draw:gradient> element. That 
> includes not only a list of gradient stops but in addition a focus 
> rectangle and a tile rectangle.

i really don't like adding a 3rd way to specify gradients.

> (D)
> Add
>      <rng:zeroOrMore>
>          <rng:ref name="svg-stop"/>
>      </rng:zeroOrMore>
> as child elements to <draw:gradient>
> Add that in case <svg:stop> child elements exist, draw:start-color 
> together with draw:start-intensity is treated as being a <svg:stop> 
> element with svg:offset="0%" and svg:opacity="1" before all given 
> <svg:stop> elements,
> and draw:end-color together with draw:end-intensity is treated as being 
> a svg:stop element with svg:offset="100%" and svg:opacity="1" after all 
> given <svg:stop> elements,
> and draw:gradient-step-count is treated as "0".
> Specify that the rules in 13.2.4 SVG 1.1. ... shall be followed.

that sounds good, so the new elements would just add to the existing 
functionality, as far as possible.

it would mean that an old LO version would display some sort of gradient 
(ignoring the stop elements), which is probably better than no gradient?

>>>> I would take out from this the StartColor (AKA offset == 0.0) and 
>>>> the EndColor (AKA offset == 1.0), so in the normal case there would 
>>>> be no change at all. >
>>>> If there are ColorSteps with offset != 0.0 or 1.0 I would create 
>>>> that extra-entries for these.
>>>
>>> What do you mean by "take out"?
>>
>>
>> Just that for 0% I would use our draw:start-color and for 100% our 
>> draw:end-color. I would only write new entries in svg-conform semantic 
>> for offsets ]0%..100%[. This is to stay as compatible as possible. It 
>> also makes no sense to 'double' the information with having the same 
>> color represented e.g. for StartColor once as draw:start-color and 
>> once as <stop offset="0%"/>.
> 
> I think, that would be like I have described as way (D).
> 
> 
> Because the introduction of theme colors, it might be needed to extend 
> <svg:stop> to not only have stop-color attribute in the sense of SVG but 
> allow a reference to a scheme-color in addition. In case of (D) that 
> would have to be added for start- and end-color too.
> 
> Kind regards,
> Regina



More information about the LibreOffice mailing list