xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edison Too" <edison...@yahoo.com.sg>
Subject Possible bug in AbstractGraphicsNode?
Date Tue, 10 Jul 2001 14:15:44 GMT
Hi,

I guess this question is probably for Vincent who is the author of this
class (and the author of a fantastic book on Java2D, which I've bought
;P)...

I'm interested in using the GVT within my application, following is a
description of what I think might be a bug.

1) When attempting to paint a TextNode by calling paint(g2d,rc), I get a
NullPointerException at
	TextNode.getPrimitiveBounds();

2) After some investigation, I found that the FontRenderContext and
TextPainter was missing even though I've provided a
GraphicsNodeRenderContext that have both of them.

3) After searching through AbstractGraphicsNode.paint(g2d,rc), I found that
the RenderingHints of the rc is being replaced by the RenderingHints of the
g2d ...

        g2d.setRenderingHint(RenderingHintsKeyExt.KEY_AREA_OF_INTEREST,
                             curClip);
        rc.setTransform(g2d.getTransform());
        rc.setRenderingHints(g2d.getRenderingHints()); <<-- RenderingHints
being replaced
        rc.setAreaOfInterest(curClip);

This implies that whatever RenderingHints previously placed into rc
(including FontRenderContext and TextPainter) is not in the new
RenderingHints (of the rc) unless it is explicitly transfered over.

4)Somewhere earlier in the code, there is some adding of hints to g2d's
hints..
        if (hints != null) {
            defaultHints = g2d.getRenderingHints();
            g2d.addRenderingHints(hints);  <<-- adding of hints to g2d's
hints
        }
However, I believe this is the hint stored in the GraphicsNode and not the
RenderContext.

Conclusion :
Please verify if this is indeed an oversight (i.e. forgot to transfer the
relevant RenderingHints to g2d's hint). If not, may  be a short explanation
will enlighten me as to where I went wrong. Currently, to work around it, I
put the FontRenderContext etc into g2d's RenderingHints (which removes the
NullPointerException).

Thanks and Regards,
Edison :)


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


Mime
View raw message