Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

draw pixel at position that is float

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I wanted to draw a pixel at position 1.6 and I am using method g.drawLine(x,y,x,y); but it needs ints in it how can I draw at position that includes floating points?
 
Sheriff
Posts: 21971
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The coordinate system is in pixels, so how can you draw a pixel at a location that spans to pixels?
 
Anissa Pary
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Rob Spoor wrote:The coordinate system is in pixels, so how can you draw a pixel at a location that spans to pixels?


Ok may be I wrote not correctly I need to draw a point but 1 site call points as pixels that is why I am calling them like this as well
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same thing. A point maps to a pixel position on screen.

For simulating subpixel resolution, look into the *2D classes (Point2D, Line2D ...) along with Graphics2D and RenderingHints.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic