2ARSJcdocuyVu7LfjUnB
2ARSJcdocuyVu7LfjUnB

Reputation: 435

Drawing an image at floating points - Java

Graphics2D's drawImage() method requires strictly integers.

How could one draw an image using floating points in Java2D, if at all?

If not what would SO recommend?

Upvotes: 1

Views: 391

Answers (1)

nhouser9
nhouser9

Reputation: 6780

You can't - the screen is partitioned into pixels, which are represented as integers. You physically cant tell the screen to draw something at half a pixel because that's not how screens work.

The best solution is just to round your float to the nearest integer and draw the object there.

Upvotes: 1

Related Questions