BArtWell
BArtWell

Reputation: 4044

Why pixels is float?

All methods of Canvas class using coordinates in float type. But why? As I know this coordinates mean count of pixels to point on display. Pixel can be separated?

Upvotes: 5

Views: 1316

Answers (1)

spencer7593
spencer7593

Reputation: 108450

Some devices support subpixel accuracy.


On a standard LCD screen, a pixel is really three subpixels, one red, one green, one blue. (Red Green Blue). And rendering at the subpixel level allows for sharper, better looking images.

As a crude example, rather than specifying the location of one white "RGB" pixel on the screen, there's opportunity to more closely render a white "pixel" in a slightly different location on the screen by actually using two pixels on the screen.

Consider three RGB pixels on the screen. Consider the display of a white pixel by lighting the R,G and B subpixels on pixel two:

one   two   three 
----- ----- -----
_ _ _ R G B _ _ _

and compare that to rendering by subpixel:

one   two   three
----- ----- -----
_ _ B R G _ _ _ _
_ _ _ R G B _ _ _ 
_ _ _ _ G B R _ _ 

To the human eye, all of those look like a white pixel, but subpixel rendering allows for greater control over placement. And this technique of lighting just portions of pixels, and lighting portions of adjacent pixels is effective in "line smoothing" (anti-aliasing).

And there are other screen technologies other than the traditional RGB stripe LCD. Consider, for example the variety of RGBG Amoled format screens (Samsung Galaxy displays).

Upvotes: 8

Related Questions