xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Declan Shanaghy" <dshana...@w5networks.com>
Subject RE: How to create a RasterImageNode from BufferedImage
Date Thu, 02 Oct 2008 17:32:12 GMT
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" <dshanaghy@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
> element. 

> My approach is simply to base64 encode the barcode and stuff it into
> 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.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... 

View raw message