Is there any way that I can draw with doubles number in the paintComponent method for JPanel?
I really need it to draw with double numbers
drawImage in graphics only for INT numbers?
Page 1 of 14 Replies  549 Views  Last Post: 02 March 2013  12:16 PM
Replies To: drawImage in graphics only for INT numbers?
#2
Re: drawImage in graphics only for INT numbers?
Posted 01 March 2013  10:33 PM
Pixels are discrete points. You can only paint at integer coordinates.
Per the documentation: Graphics class
Per the documentation: Graphics class
#3
Re: drawImage in graphics only for INT numbers?
Posted 02 March 2013  04:36 AM
Yeah. I don't get that, because you can draw Strings with
What's up with that?
drawString(String s, float x, float y);
What's up with that?
#4
Re: drawImage in graphics only for INT numbers?
Posted 02 March 2013  11:13 AM
Maybe I'm just blind, but according to the documentation I linked to, I only saw a drawString() method with int parameters. Why is it so important to be able to use floating point numbers anyways?
#5
Re: drawImage in graphics only for INT numbers?
Posted 02 March 2013  12:16 PM
Unless you have noted these methods (both in Graphics and Graphics2D) are abstract because you want an universal way to address a Graphic Card that can work (you don't know) with pixels or double coordinates. So they just delegate to the native code of the Graphic Card.
An affine transform will require double, a drawSring will need it to compute, based on the Font characteristics if the actual drawing will start at pixel: X,Y or X+1,Y or X,Y+1 or X+1,Y+1 based on certain rounding algorithm
An affine transform will require double, a drawSring will need it to compute, based on the Font characteristics if the actual drawing will start at pixel: X,Y or X+1,Y or X,Y+1 or X+1,Y+1 based on certain rounding algorithm
Page 1 of 1
