You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by th...@kodak.com on 2008/10/01 02:45:23 UTC
Re: How to create a RasterImageNode from BufferedImage
Hi Declan,
"Declan Shanaghy" <ds...@w5networks.com> wrote on 09/30/2008 03:13:18
PM:
> I wish to create barcodes on the fly from a symbology and data attribute
of
> A custom ?barcode? element. I have registerde a BrigeExtension class
> which extends SVGImageElementBridge
>
> It behaves weirdly though.
> When I first load squiggle (with my extensions) my barcodes will
> not show up unless I have previously loaded an SVG file with an ?image?
> element.
> My approach is simply to base64 encode the barcode and stuff it into the
> xlink:href attr.
My first guess would be that somehow the Image decoders aren't
being bootstrapped properly. Or perhaps when you hand off your
fake 'svg:image' element to the base class something isn't right
> I decided to try another route and I came across this post
> which says the BufferedImage could be placed in a RasterImageNode
> bu I haven?t been able to figure out how to do this.
public void RasterImageNode.setImage(Filter newImage)
In conjunction with:
import org.apache.batik.ext.awt.image.red.CachableRed;
import
org.apache.batik.ext.awt.image.red.BufferedImageCachableRed;
import org.apache.batik.ext.awt.image.rable.Filter;
import org.apache.batik.ext.awt.image.rable.RedRable;
CachableRed red;
red = new BufferedImageCachableRed(buffered_image);
Filter f = new RedRable(red);
> Can someone please point me onto the right track.
> http://osdir.com/ml/text.xml.batik.user/2005-03/msg00166.html
>
> ?You can just stuff a buffered image into a GVT RasterImageNode?
As long as you are tied into the SVG -> GVT stuff through the
bridge you shouldn't have to worry to much about the rebuild stuff...
RE: How to create a RasterImageNode from BufferedImage
Posted by Declan Shanaghy <ds...@w5networks.com>.
Thanks for the help that's working nicely.
Just have to work on the other member methods of the class now to
position the image properly.
________________________________
From: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com]
Sent: Tuesday, September 30, 2008 5:45 PM
To: batik-users@xmlgraphics.apache.org
Cc: batik-users@xmlgraphics.apache.org
Subject: Re: How to create a RasterImageNode from BufferedImage
Hi Declan,
"Declan Shanaghy" <ds...@w5networks.com> wrote on 09/30/2008
03:13:18 PM:
> I wish to create barcodes on the fly from a symbology and data
attribute of
> A custom 'barcode' element. I have registerde a BrigeExtension class
> which extends SVGImageElementBridge
>
> It behaves weirdly though.
> When I first load squiggle (with my extensions) my barcodes will
> not show up unless I have previously loaded an SVG file with an
'image'
> element.
> My approach is simply to base64 encode the barcode and stuff it into
the
> xlink:href attr.
My first guess would be that somehow the Image decoders aren't
being bootstrapped properly. Or perhaps when you hand off your
fake 'svg:image' element to the base class something isn't right
> I decided to try another route and I came across this post
> which says the BufferedImage could be placed in a RasterImageNode
> bu I haven't been able to figure out how to do this.
public void RasterImageNode.setImage(Filter newImage)
In conjunction with:
import org.apache.batik.ext.awt.image.red.CachableRed;
import
org.apache.batik.ext.awt.image.red.BufferedImageCachableRed;
import org.apache.batik.ext.awt.image.rable.Filter;
import org.apache.batik.ext.awt.image.rable.RedRable;
CachableRed red;
red = new BufferedImageCachableRed(buffered_image);
Filter f = new RedRable(red);
> Can someone please point me onto the right track.
> http://osdir.com/ml/text.xml.batik.user/2005-03/msg00166.html
>
> "You can just stuff a buffered image into a GVT RasterImageNode"
As long as you are tied into the SVG -> GVT stuff through the
bridge you shouldn't have to worry to much about the rebuild stuff...