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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 30, 2008 5:45 PM
To: [email protected]
Cc: [email protected]
Subject: Re: How to create a RasterImageNode from BufferedImage

 


Hi Declan, 

"Declan Shanaghy" <[EMAIL PROTECTED]> 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... 

Reply via email to