[Biojava-l] SequencePanel arbitrary setGraphicsOrigin

Keith James kdj@sanger.ac.uk
29 May 2001 10:09:16 +0100


>>>>> "David" == S M Huen <smh1008@cus.cam.ac.uk> writes:

[...]

    David> If you could send me you renderer code I could have a look
    David> at why it might be doing this. Do you have a
    David> framing/clipping transform to put it in the panel like the
    David> MultilineRenderer and LayeredRenderer classes?  It is those
    David> original transforms that really do the work of placing the
    David> drawing - the setGraphicsOrigin() is just a workround that
    David> makes them work properly with potentially huge pixel
    David> coordinates.  I think you must be drawing directly rather
    David> than in one of the wrapper classes that create a transform
    David> for the other panels that has resulted in this going funny
    David> and why removing the offset fixes it.

If drawing directly is a bad thing, then this could be the problem as
I think this is what I'm doing. I make a new BufferedImage and get a
Graphics2D from it which I pass to the paint method of a
SequenceRenderer:

renderer.paint(g2d, panel);

where g2d is from the BufferedImage and panel is my context (a
SequencePanel, in this case).

When the BufferedImage is dumped as a png the pixel offset appears.

-- 

-= Keith James - kdj@sanger.ac.uk - http://www.sanger.ac.uk/Users/kdj =-
The Sanger Centre, Wellcome Trust Genome Campus, Hinxton, Cambs CB10 1SA