[CREATE] OpenRaster specifications

Johann ELSASS circular at operamail.com
Fri Jun 1 10:09:42 UTC 2018


Hello people,

I am the author of LazPaint and I have added support for OpenRaster (without substacks for now) in my software. 

I am considering adding new features to my software and would be happy that it would be added to OpenRaster as well:
- having a layer rendered from an original (SVG file, image file or an SVG shape)
- having an affine transformation to be applied to the original
- adding effects to the original (I suggest using SVG format)

The idea is that while current readers would read the file just the same, the layer node would have a subnode that contains how to produce the image of the layer.

Note on units: I suggest to use a DPI of 96 for embedded SVG as it is quite common. For SVG directly writting in the stack, I suggest to use either percentage and use the pixel coordinates as default (and avoid the DPI mess).

For the sake of simplicity, we can limit the number of elements to 1 in the layer.  It is still possible to achieve multiple shapes by using multiple layers, for example in a stack element.

Also we can support only basic SVG nodes, i.e. <ellipse>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>.

For example, the following file has a gradient background, a blurred embedded SVG on top of it, and a PNG on top of it.

<?xml version="1.0" encoding="utf-8"?>
<image h="1024" w="1024">
  <defs>
    <filter id="filter1">
      <feGaussianBlur stdDeviation="4"/>
    </filter>
    <linearGradient id="gradient1" x1="0%" y1="0%" x2="100%" y2="0%">
        <stop offset="5%"  stop-color="green"/>
        <stop offset="95%" stop-color="gold"/>
    </linearGradient>
  </defs>
  <stack>
    <layer x="100" y="50" src="data/layer2.png" name="rectangle" opacity="1.000" visibility="visible" composite-op="svg:src-over">
      <image src="originals/original2.png" transform="translate(200,50) rotate(90)"/>
    </layer>
    <layer x="50" y="50" src="data/layer1.png" name="rectangle" opacity="1.000" visibility="visible" composite-op="svg:src-over">
      <svg src="originals/original1.svg" transform="translate(50,50) scale(2,2)" filter="url(#filter1)"/>
    </layer>
    <layer x="0" y="0" src="data/layer0.png" name="gradient" opacity="1.000" visibility="visible" composite-op="svg:src-over">
      <rect x="0" y="0" width="1024" height="1024" fill="url(#gradient1)"/>
    </layer>
  </stack>
</image>

Regards,

-- 
  Johann ELSASS
  circular at operamail.com


More information about the CREATE mailing list