Line does not display
Hi all:
I have created a buffered image and trying to draw a line. There is no error message but the line does not display. What am I doing wrong?
BufferedImage bimage =new BufferedImage(300, 400, BufferedImage.TYPE_INT_RGB);
Graphics2D g2bi = bimage.createGraphics();
g2bi.setColor(Color.BLUE);
Line2D.Double line =new Line2D.Double(727432.487,2960594.127,727335.051,2960618.728)
g2bi.translate(727432.487,2960594.127);
g2bi.draw(line);
try taking a look at where you're drawing the line. I think your translation is in the wrong direction, and I think you're trying to translate to accomodate the wrong point.
are you trying to take the point (727432.487, 2960594.127) and translate that to (0, 0)? then the other end of the line would be approx (-97, 22), which would not be in your image. Also, I think the translation of the graphics object needs to be negative (but I'm not positive on that last part). something like this:
translate(-727335.051, -2960594.127).
I beleive that then you will see the line in your image.
- Adam