SVG/PNG Serializer
http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Main
User Documentation

Serializers
Overview

Default
HTML Serializer

Core
XHTML Serializer
XML Serializer
Text Serializer
WAP/WML Serializer
SVG Serializer
SVG/XML Serializer
SVG/JPEG Serializer
SVG/PNG Serializer
SVG/TIFF Serializer
VRML Serializer
Link Serializer
Zip archive Serializer

Optional
PDF Serializer
PS Serializer
PCL Serializer
HSSF (XLS) Serializer

SVG/PNG Serializer

The SVG/PNG serializes an xml svg document to a png image. The serialization uses the Batik's PNGTranscoder internally.

  • Name : svg2png
  • Class: org.apache.cocoon.serialization.SVGSerializer
  • Cacheable: yes
Sitemap Configuration

A minimal sitemap configuration snippet declaring the svg2png serializer:

<map:serializers..
  <map:serializer name="svg2png"
    src="org.apache.cocoon.serialization.SVGSerializer"
    mime-type="image/png"
    logger="sitemap.serializer.svg2png"
  >
  </map:serializer>

A sitemap pipeline snippet using the svg2png serializer:

<map:match pattern="svg/*.png">
  <map:generate src="docs/samples/svg/{1}.svg"/>
  <map:serialize type="svg2png"/>
</map:match>

In the declaration section of the svg2png a number of parameters can be specified. The following snippet set the background color explicitly:

<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>
PNGTranscoder Parameters

General ImageTranscoder parameters are described at the SVG Serializer user documentation.

The following section presents PNGTranscoder specific parameters configurable for the PNGTranscoder.

ParameterTypeComment
force_transparent_whitebooleanIt 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.
However, note that the modified image will display differently over a white background in a viewer that supports transparency.
gammafloatControls the gamma correction of the png image; by default its value is approx 2.22.
Further Reading

Further details about PNGTranscoder, ImageTranscoder is available at Batik.

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.