[CREATE] ORA spec: adding additional layer effects

Andrew Chadwick a.t.chadwick at gmail.com
Fri Feb 24 14:19:12 PST 2012


The OpenRaster spec currently states (working from memory here) that
ORA files may use uses the SVG compositing ops[1]. These do not
provide colorize layer modes, nor modes for luminosity-setting,
hue-setting or saturation-setting. I'd quite like to implement these
but because it would require a change to the OpenRaster specification,
I haven't yet. Users are clamouring for it however, and I think
MyPaint should implement colourize at least (not to mention I have
some sample code kicking around locally).

Currently layers with compositing modes other than "svg:src-over" are
written to layers.xml with a suitable "composite-op" attribute:

  <layer composite-op="svg:src-over" opacity="1.0"
src="data/layer001.png" visibility="visible" x="0" y="0" />

What I suggest doing is extending the current definition with the
following modes:

* SOMEPREFIXhue - src hue, and luminance and saturation of the dst
* SOMEPREFIXsaturation - saturation of the src layer, with the hue and
luminance of the dst
* SOMEPREFIXcolor - hue and saturation of the src, with the luminance of the dst
* SOMEPREFIXluminosity - luminance of the src, over the hue and
saturation of the dst

Definitions of these blending modes can be found in various PDF
specifications[2], and work well up until one has to composite with an
opacity setting using scaled ints. Which is a whole new kind of fun.

What should we use for SOMEPREFIX? "pdf:blend-" is one possibility if
we want to slavishly adopt that... but I'd rather refer to a more open
specification if I can (not to mention that I want to use the Rec. 709
primaries[3] for the perceptual-ish bit). Current SVG specification
(1.1) is indeed luminosity/luma aware for feColorMatrix, but does not
define these blend modes, sadly.

MyPaint could of course just do its own thing here, or copy Krita.
I've had a quick poke around the Krita and GIMP implementations of
these layer modes, but they seem to use HSV only, which seems
limiting. Is there any particular reason for this?


[1] http://www.w3.org/TR/SVGCompositing/
[2] The shortest and most relevant one is probably the "PDF Blend
Modes: Addendum" for the PDF Reference, fifth edition, version 1.6,
dated Jan 23 2006 - available from Adobe via your search engine of
choice.
[3] https://en.wikipedia.org/wiki/Rec._709

-- 
Andrew Chadwick


More information about the CREATE mailing list