blob: 2dc95decf3e12ce41b9caaacf791dcfe28efdb5a [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "../../dtd/document-v10.dtd">
<document>
<header>
<title>SVG/PNG Serializer</title>
<version>0.9</version>
<type>Technical document</type>
<authors>
<person name="Carsten Ziegeler" email="cziegeler@apache.org"/>
<person name="Bernhard Huber" email="huber@apache.org"/>
</authors>
<abstract>This document describes the svg/png serializer of Cocoon.</abstract>
</header>
<body>
<s1 title="SVG/PNG Serializer">
<p>
The SVG/PNG serializes an xml svg document to a png image.
The serialization uses the Batik's PNGTranscoder internally.
</p>
<ul>
<li>Name : svg2png</li>
<li>Class: org.apache.cocoon.serialization.SVGSerializer</li>
<li>Cacheable: yes</li>
</ul>
<s2 title="Sitemap Configuration">
<p>
A minimal sitemap configuration snippet declaring the svg2png serializer:
</p>
<source><![CDATA[
<map:serializers..
<map:serializer name="svg2png"
src="org.apache.cocoon.serialization.SVGSerializer"
mime-type="image/png"
logger="sitemap.serializer.svg2png"
>
</map:serializer>
]]></source>
<p>
A sitemap pipeline snippet using the svg2png serializer:
</p>
<source><![CDATA[
<map:match pattern="svg/*.png">
<map:generate src="docs/samples/svg/{1}.svg"/>
<map:serialize type="svg2png"/>
</map:match>
]]></source>
<p>
In the declaration section of the svg2png a number of parameters can be specified.
The following snippet set the background color explicitly:
</p>
<source><![CDATA[
<map:serializers..
<map:serializer name="svg2png"
src="org.apache.cocoon.serialization.SVGSerializer"
mime-type="image/png"
logger="sitemap.serializer.svg2png"
>
<parameter name="background_color" type="color" value="#ff00ff"/>
</map:serializer>
]]></source>
</s2>
<s2 title="PNGTranscoder Parameters">
<p>
General ImageTranscoder parameters are described
at the <link href="svg-serializer.html">SVG Serializer</link> user documentation.
</p>
<p>
The following section presents PNGTranscoder specific parameters configurable
for the PNGTranscoder.
</p>
<table>
<tr><th>Parameter</th><th>Type</th><th>Comment</th></tr>
<tr><td>force_transparent_white</td><td>boolean</td><td>It controls whether the encoder should
force the image's fully transparent pixels to be fully transparent
white instead of fully transparent black. This is usefull when the
encoded PNG is displayed in a browser which does not support PNG
transparency and lets the image display with a white background instead
of a black background. <br /> However, note that the modified image
will display differently over a white background in a viewer that
supports transparency.</td>
</tr>
<tr><td>gamma</td><td>float</td><td>Controls the gamma correction of the png image;
by default its value is approx <code>2.22</code>.
</td>
</tr>
</table>
</s2>
<s2 title="Further Reading">
<p>
Further details about PNGTranscoder, ImageTranscoder is available
at <link href="http://xml.apache.org/batik">Batik</link>.
</p>
</s2>
</s1>
</body>
</document>