I wonder if there is any graphics library that supports RGB subpixel rendering (like ClearType) for general graphics, not just for text. This would allow one to practically triple the horizontal resolution, and put graphics on third-pixel x positions.
While I think this would be very useful, I couldn't find much on the internet about it, except the following:
- How Sub-Pixel Font Rendering Works (there are some line images around the middle)
- Subpixel rendering and image resizing (some interesting thoughts on applying subpixel rendering to resizing bitmaps)
Is there any library that implements this, or are there efforts to bring something like this to the Cairo library, for example?
Update:
I'm referring specifically to rendering techniques that take into account that current LCD screens use sub-pixels of different colors. To make a white point, you set all sub-pixels to 'on' or 255. A white line would be several subpixels on top of each other:
...RGB...
...RGB...
...RGB...
...RGB...
...RGB...
...111...
(where .
is a fully black sub-pixel, and R
, G
or B
are fully-lit red, green, or blue sub-pixels). Because our eyes can't resolve the sub-pixels, they blend together to make a white line. I could however also make a white line from the following:
....GBR..
....GBR..
....GBR..
....GBR..
....GBR..
....111..
Note that it is perfectly sharp, but positioned at x = 1 1/3 pixels. This is not possible with traditional rendering techniques that draw a slightly blurry white line instead. Here for example R
=70% lit, r
=30% lit. I didn't work out the math, this is just so you get the idea:
...RGBrgb...
...RGBrgb...
...RGBrgb...
...RGBrgb...
...RGBrgb...
...777333...
Another example is a slope, which you can do a) with full pixels, b) antialiased, or c) with subpixel rendering:
a) RGB...... b) RGB...... c) RGB......
RGB...... RGBrgb... .GBR.....
...RGB... rgbRGB... ..BRG....
...RGB... ...RGB... ...RGB...
...RGB... ...RGBrgb ....GBR..
......RGB ...rgbRGB .....BRG.
......RGB ......RGB ......RGB
Again, note that this is just a crude example to give you the general idea, but you see that a) is jaggy or aliased, b) is blurry, and c) is as sharp as you can get it on a LCD.
Real implementations of this, for font display (ClearType on Windows and the subpixel rendering in FreeType) have a more sophisticated algorithm. They take into account that individual sub-pixels bleed or shine into each other, they preserve the total color intensity or energy. They also take into account that the subpixel spacing is not even (the spacing between R and G, or G and B (in the pixel) may be smaller than between B and R), and finally that some displays have entirely different pixel layouts.