Results 1 to 6 of 6
- 05-10-2011, 06:04 PM #1
Graphics with floating points instead of Integers
I think i forgot to actually post this last time but anyways my question is I want to know if there is a way to use some kind of graphics where I don't have to use integers, for example
g.fillOval(int w, int h, int x, int y);
I want to know if there is someway to be able to use say doubles or floating point integers. Is there some special package for this? would OpenGL be good to use?
- 05-10-2011, 06:25 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,605
- Rep Power
- 5
See the API for shape: Shape (Java Platform SE 6)
In particular, the classes which implement the interface, many of which take double or float values and since they implement the Shape interface, can be drawn using Graphics2D.draw or fill methods
- 05-10-2011, 06:29 PM #3
Read the API for Graphics2D and go through the tutorial:
Trail: 2D Graphics (The Java™ Tutorials)
Wherever a method (such as paintComponent) is passed a Graphics reference, you can safely cast the reference to Graphics2D. In all current Java versions (and some obsolete versions too) every Graphics object is a Graphics2D.
Just remember that screen rendering is always integral, there's nothing like painting half a pixel. The illusion of fractional resolution can be created by anti-aliasing.
db
- 05-10-2011, 07:35 PM #4
- 05-10-2011, 07:50 PM #5
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,605
- Rep Power
- 5
- 05-10-2011, 10:55 PM #6
Similar Threads
-
floating point errors
By mikele83 in forum New To JavaReplies: 8Last Post: 04-24-2011, 03:52 PM -
Displaying floating point value
By NuxlyStardust in forum New To JavaReplies: 11Last Post: 04-14-2011, 06:40 PM -
if it is floating point number
By Stephen Douglas in forum New To JavaReplies: 26Last Post: 07-06-2010, 09:17 AM -
a navigation bar that has floating images
By shayz in forum Advanced JavaReplies: 3Last Post: 02-07-2009, 01:52 PM -
given number of points(cordinates) , find max points lie on the same line ?
By Hayzam in forum New To JavaReplies: 2Last Post: 08-24-2008, 12:30 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks