xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject RE: Accessing pixels in an <image>
Date Tue, 02 May 2006 23:48:22 GMT
Hi Phil,

"Philip Feldman" <pfeldman@proteus-technologies.com> wrote on 05/02/2006 
02:46:18 PM:

> Anyway, I'm wondering where you get the BridgeContext. Do I create a new
> UserAgent and then a new BridgeContext? Or access the (protected)
> JSVGCanvas.CanvasUserAgent somehow? Or is there an accesable
> BridgeContext I can use directly?

   Most people go through:  canvas.getUpdateManager().getBridgeContext()

   BTW you will also have to do something so the canvas knows it
needs to update the display... 

> > I am reading an image in as part of an SVG file that I need to do some
> 
> > processing on (changing the color of some pixels periodically). I see
> that 
> > Batik maps the <image> tag to an SVGOMImageElement. Is there any way 
> > to
> get at
> > the pixels directly?
> 
>    It isn't very easy.  From the SVGOMImageElement you can use the
> BridgeContext getGraphicsNode method to get the GraphicsNode that is the
> 'peer' to the Image element.  You can then poke around it's subtree, and
> find the RasterImageNode child (assuming the image references a raster
> format).  The RasterImageNode has a 'Filter' which is the image - but it
> is a resolution independent view of the image.  You can get this
> rendered to a fixed size and use the RenderedImage interface to get data
> out of it.
> 
>    I would suggest that manipulations of the graphic display are best
> done using svg rather than trying to twiddle raster images...
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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


Mime
View raw message