tags:

views:

152

answers:

4

I mean, for pixel position, sizes, etc. It's not like I'll be making a rectangle that's 100 and a half pixels high. These might as well be integers.

+2  A: 

Not yet you won't, perhaps. But as more resolutions are added, the fact that Apple measure screens in their own units rather than pixels could become more useful in time.

h4xxr
A: 

Some coordinate systems interpret float coordinates by approximating the location between two pixels with different shades to enable smoother animation and eliminate jagged edges.

cfeduke
+11  A: 

If you draw anti-aliased geometry, you need fractional coordinates.

If your geometry might be rescaled by the underlying API to display on a variety of screens you need fractional coordinates.

If you want to be able to tell the API to rotate, scale or shear your geometry you need fractional coordinates.

If you want to be able to break a line from A to C into a piece from A to B and a piece from B to C, and have them join up to look just like the original line, then you need fractional coordinates.

If you want to have a high precision internal representation of your geometry that's independent of the low precision details of the underlying display hardware, you need fractional coordinates.

If your API doesn't do these things now, but you need it to support these things in the next version without breaking compatibility, then you need fractional coordinates.

+1  A: 

For simple graphics, window positions, etc, you're right, you don't need them.

For more complicated graphics, they're necessary because the screen resolution might not be fine enough to do justice to what you're trying to display. Turning an idealised, fractional view of the world into something that a screen with a finite number of pixels can display is known as rasterisation, and it's a pretty big topic.

I always see this as an extreme example of model-view-controller: decoupling what you're trying to draw from how it's being drawn on the screen.

Dan