xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thieler Jens <Jens.Thie...@dwd.de>
Subject AW: Using URL rather than embedded PNG from SVGGraphics2D
Date Mon, 16 Jul 2001 15:52:39 GMT
>Hi all, 
>Does anyone have an example of some code to create an SVG document
>with an image referenced by a URL, rather >than an embedded png?
>I know the SVG fragment needs to look something like this:
><image x="0" y="0" width="570"
xlink:href="http://www.myimagelink.ishere..."

If you are using a recent CVS version of Batik
you may try the following constructor:

   /**
    * @param domFactory Factory which will produce Elements for the DOM tree
    *                    this Graphics2D generates.
    * @param imageHandler defines how images are referenced in the
    *                     generated SVG fragment
    * @param extensionHandler defines how Java 2D API extensions map
    *                         to SVG Nodes.
    * @param textAsShapes if true, all text is turned into SVG shapes in the
    *        convertion. No SVG text is output.
    *
    * @exception SVGGraphics2DRuntimeException if domFactory is null.
    */
   public SVGGraphics2D(Document domFactory,
                        ImageHandler imageHandler,
                        ExtensionHandler extensionHandler,
                        boolean textAsShapes)

Three ImageHandlers are available.
The default is ImageHandlerBase64Encoder.
You may want to play with this one:
   /**
    * @param imageDir directory where this handler should generate images.
    *        If null, an IllegalArgumentException is thrown.
    * @param urlRoot root for the urls that point to images created by this
    *        image handler. If null, then the url corresponding to imageDir
    *        is used.
    */
   public ImageHandlerPNGEncoder(String imageDir, String urlRoot)

Jens Thieler

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message