This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes draw pixel at position that is float Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "draw pixel at position that is float" Watch "draw pixel at position that is float" New topic
Author

draw pixel at position that is float

Anissa Pary
Ranch Hand

Joined: Jan 02, 2012
Posts: 40
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?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20131
    
  30

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


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Anissa Pary
Ranch Hand

Joined: Jan 02, 2012
Posts: 40
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
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 5045
    
  10

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.


luck, db
There are no new questions, but there may be new answers.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: draw pixel at position that is float
 
jQuery in Action, 3rd edition