Re: Offset uniqueness in vector of ColorSteps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Regina,

good to hear from you, wanted to contact you already anyways, but we were just moving, so I was pretty busy :-)

On 3/14/23 14:09, Regina Henschel wrote:
Hi Armin,

you put the ColorSteps into a sorted vector with unique offsets of the ColorSteps.

I see a problem with "unique". Both OOXML and SVG allow several color stops to have the same offset. Users need it in OOXML and SVG gradients to create stepped gradients like those from ODF draw:gradient.

Thus forcing uniqueness in our core will give problems in import filter and in implementing the <svg:radialGradient> and <svg:linearGradient> from ODF.

Very good hints, thanks for that.

Indeed I thought about having two (or more) identical ColorStops to allow a 'rapid' color change at the same offset. I abandoned that by thinking that a very small step could be used that will never get visible, so e.g.

  0.5
  0.5000001

But allowing multiple identical may express that indeed better.

The problem is and why I chose uniqueness is also/mainly the UI - how to represent equal ColorSteps in a UI trying to visualize the ColorSteps...?

So:

- It should then be OK to have a maximum of *two* ColorStops with identical offset?

- When correcting that, and there are more than two, delete all but 1st and last? So the in-between ones?

- Also dependent of used colors: if all the same color, identicals can be deleted, so go to uniqueness.


And Questions for ODF format:

I see e.g. in SVG something like

<linearGradient id="Gradient2" x1="0" x2="0" y1="0" y2="1">
      <stop offset="0%" stop-color="red" />
      <stop offset="50%" stop-color="black" stop-opacity="0" />
      <stop offset="100%" stop-color="blue" />
</linearGradient>

so I would just add elements like

      <stop offset="0%" stop-color="red" />

to our ODF, is that OK from your POV? I remember we once discussed that already, so should be no problem to do that I guess?

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.

Currently we have something like

<draw:gradient draw:name="Gradient_20_2"
    draw:display-name="Gradient 2" draw:style="radial" draw:cx="50%" draw:cy="50%"
    draw:start-color="#bf0041"
    draw:end-color="#127622"
    draw:start-intensity="100%" draw:end-intensity="100%" draw:border="0%"/>

which would then be something like

<draw:gradient draw:name="Gradient_20_2"
    draw:display-name="Gradient 2" draw:style="radial" draw:cx="50%" draw:cy="50%"
    draw:start-color="#bf0041"
    <stop offset="0%" stop-color="red" />
    draw:end-color="#127622"
    draw:start-intensity="100%" draw:end-intensity="100%" draw:border="0%"/>

For import of 'older' stuff all will be good.

For import of new stuff in older Offices we would fallback to Start/EndColor and ignore the In-Between steps - any ways the best we can do AFAIS.

Greetings & thanks in advance,

Armin



Kind regards,
Regina

--
--
ALG (PGP: EE1C 4B3F E751 D8BC C485 DEC1 3C59 F953 D81C F4A2)




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux