aboutsummaryrefslogtreecommitdiff
path: root/freetype/docs/reference/ft2-lcd_filtering.html
diff options
context:
space:
mode:
Diffstat (limited to 'freetype/docs/reference/ft2-lcd_filtering.html')
-rw-r--r--freetype/docs/reference/ft2-lcd_filtering.html18
1 files changed, 16 insertions, 2 deletions
diff --git a/freetype/docs/reference/ft2-lcd_filtering.html b/freetype/docs/reference/ft2-lcd_filtering.html
index 9965c432d..da50ff5f5 100644
--- a/freetype/docs/reference/ft2-lcd_filtering.html
+++ b/freetype/docs/reference/ft2-lcd_filtering.html
@@ -3,7 +3,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>FreeType-2.4.11 API Reference</title>
+<title>FreeType-2.5.0 API Reference</title>
<style type="text/css">
body { font-family: Verdana, Geneva, Arial, Helvetica, serif;
color: #000000;
@@ -35,7 +35,7 @@
<table align=center><tr><td><font size=-1>[<a href="ft2-index.html">Index</a>]</font></td>
<td width="100%"></td>
<td><font size=-1>[<a href="ft2-toc.html">TOC</a>]</font></td></tr></table>
-<center><h1>FreeType-2.4.11 API Reference</h1></center>
+<center><h1>FreeType-2.5.0 API Reference</h1></center>
<center><h1>
LCD Filtering
@@ -49,6 +49,20 @@ LCD Filtering
<table align=center width="87%"><tr><td>
<p>The <a href="ft2-lcd_filtering.html#FT_Library_SetLcdFilter">FT_Library_SetLcdFilter</a> API can be used to specify a low-pass filter which is then applied to LCD-optimized bitmaps generated through <a href="ft2-base_interface.html#FT_Render_Glyph">FT_Render_Glyph</a>. This is useful to reduce color fringes which would occur with unfiltered rendering.</p>
<p>Note that no filter is active by default, and that this function is <b>not</b> implemented in default builds of the library. You need to #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your &lsquo;ftoption.h&rsquo; file in order to activate it.</p>
+<p>FreeType generates alpha coverage maps, which are linear by nature. For instance, the value 0x80 in bitmap representation means that (within numerical precision) 0x80/0xff fraction of that pixel is covered by the glyph's outline. The blending function for placing text over a background is</p>
+<pre class="colored">
+ dst = alpha * src + (1 - alpha) * dst ,
+</pre>
+<p>which is known as OVER. However, when calculating the output of the OVER operator, the source colors should first be transformed to a linear color space, then alpha blended in that space, and transformed back to the output color space.</p>
+<p>When linear light blending is used, the default FIR5 filtering weights (as given by FT_LCD_FILTER_DEFAULT) are no longer optimal, as they have been designed for black on white rendering while lacking gamma correction. To preserve color neutrality, weights for a FIR5 filter should be chosen according to two free parameters &lsquo;a&rsquo; and &lsquo;c&rsquo;, and the FIR weights should be</p>
+<pre class="colored">
+ [a - c, a + c, 2 * a, a + c, a - c] .
+</pre>
+<p>This formula generates equal weights for all the color primaries across the filter kernel, which makes it colorless. One suggested set of weights is</p>
+<pre class="colored">
+ [0x10, 0x50, 0x60, 0x50, 0x10] ,
+</pre>
+<p>where &lsquo;a&rsquo; has value 0x30 and &lsquo;b&rsquo; value 0x20. The weights in filter may have a sum larger than 0x100, which increases coloration slightly but also improves contrast.</p>
</td></tr></table><br>
<table align=center width="75%"><tr><td>
<h4><a name="FT_LcdFilter">FT_LcdFilter</a></h4>