Hi Thomas,
I added the UpdateManager as you had suggested but I still don't get the
updates. I am sure about doing something wrong but couldn't figure out what.
So, here is the initialization code:
I do the updates in the updatemenager runnable thread and later call the
updatemanager.updateRendering method.
and I get the offscreen buffer by the getRepaintManager().getOffscreen
method.
It would be also helpful if you could point me to the batik source files
that I must look at.
Thanks for your help,
Javid
public void initialize() {
GraphicsNode gvtRoot = null ;
try {
ctx.setDynamicState(BridgeContext.DYNAMIC);
gvtRoot = builder.build(ctx, svgDocument);
}
catch (BridgeException e) { e.printStackTrace(); }
renderer = PavisRenderer.getPavisRenderer();
float docWidth = (float) ctx.getDocumentSize().getWidth();
float docHeight = (float) ctx.getDocumentSize().getHeight();
float xscale = clientDisplaySize.width/docWidth;
float yscale = clientDisplaySize.height/docHeight;
float scale = Math.min(xscale, yscale);
AffineTransform px = AffineTransform.getScaleInstance(scale,
scale);
double tx = -0 + (clientDisplaySize.width/scale - docWidth)/2;
double ty = -0 + (clientDisplaySize.height/scale - docHeight)/2;
px.translate(tx, ty);
CanvasGraphicsNode cgn = getGraphicsNode(gvtRoot);
if (cgn != null) {
cgn.setViewingTransform(px);
curTxf = new AffineTransform();
} else {
curTxf = px;
}
manager = new UpdateManager(ctx, gvtRoot, svgDocument);
ImageRenderer ren = renderer.getImageRenderer();
ren.updateOffScreen(clientDisplaySize.width,
clientDisplaySize.height);
ren.setTree(gvtRoot);
ren.setTransform(curTxf);
manager.manageUpdates(renderer.getImageRenderer());
manager.getUpdateRunnableQueue().invokeLater(new Runnable() {
public void run() {
java.awt.Rectangle r = new java.awt.Rectangle(
0, 0,
clientDisplaySize.width, clientDisplaySize.height);
manager.updateRendering(curTxf, true, r,
clientDisplaySize.width,
clientDisplaySize.height);
render();
}
});
this.gvtRoot = gvtRoot;
}
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 04, 2006 7:36 AM
To: [email protected]
Cc: batik
Subject: Re: Batik offscreen rendering howto?
Hi Javid,
"Javid Alimohideen" <[EMAIL PROTECTED]> wrote on 03/03/2006 08:28:03 PM:
> I have a dynamic renderer in my application to render the svg content
> (offscreen). The rendering works fine but if I make some changes to the
> document the renderer.repaint method doesn't reflect the changes made to
the
> dom.
It sounds like you didn't build the Rendering trying with the
Bridge set to DYNAMIC. In this case it won't register listeners
with the Dom tree to keep the GVT tree in sync with the DOM.
Also the dynamic renderer alone is not sufficient to handle
the 'updates' you need to give it the 'dirty' regions. Which
is part of what the UpdateManager normally does for you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]