Skip to content

Give ColorExtensions the option of processing in RGBA space

As described in #419 (closed), the ColorExtension API called the function for processing of colors and opacities separately, so one didn't know about the other.

This API change allows extensions to override the pass_rgba static class variable, which makes the modify_color method receive an RGBA color and write a returned RGBA value back into the style. For this purpose, pairs of properties {"fill" : "fill-opacity", "stroke" : "stroke-opacity", "stop-color" : "stop-opacity"} are considered.

It also makes use of the relatively new Style API, which led to a test fail of the randomize extension because more color values were processed (and thus leading to different random results). So for the unit tests, the _rand function is now deterministic (it sets the seed to the value being changed, so everytime this value is passed, the same random result is returned).

So much for an explanation of the seemingly unrelated changes; I couldn't get the unit tests to pass otherwise.

Closes #419 (closed)

Edited by Jonathan Neuhauser

Merge request reports