20#include FT_INTERNAL_DEBUG_H
22#include FT_LCD_FILTER_H
24#include FT_INTERNAL_OBJECTS_H
27#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
32#define FT_SHIFTCLAMP( x ) ( x >>= 8, (FT_Byte)( x > 255 ? 255 : x ) )
42 FT_Bitmap_LcdFilterFunc lcd_filter_func;
46 if (
slot->face &&
slot->face->internal->lcd_filter_func )
48 lcd_weights =
slot->face->internal->lcd_weights;
49 lcd_filter_func =
slot->face->internal->lcd_filter_func;
53 lcd_weights =
slot->library->lcd_weights;
54 lcd_filter_func =
slot->library->lcd_filter_func;
57 if ( lcd_filter_func == ft_lcd_filter_fir )
59 *
Min -= lcd_weights[0] ? 43 :
60 lcd_weights[1] ? 22 : 0;
61 *
Max += lcd_weights[4] ? 43 :
62 lcd_weights[3] ? 22 : 0;
118 line[
xx - 2] = FT_SHIFTCLAMP( fir[0] );
121 line[
xx - 2] = FT_SHIFTCLAMP( fir[1] );
122 line[
xx - 1] = FT_SHIFTCLAMP( fir[2] );
152 for ( yy = 2; yy <
height; yy++, col -= pitch )
161 col[pitch * 2] = FT_SHIFTCLAMP( fir[0] );
164 col[pitch * 2] = FT_SHIFTCLAMP( fir[1] );
165 col[pitch] = FT_SHIFTCLAMP( fir[2] );
184 static const unsigned int filters[3][3] =
186 { 65538 * 9/13, 65538 * 1/6, 65538 * 1/13 },
187 { 65538 * 3/13, 65538 * 4/6, 65538 * 3/13 },
188 { 65538 * 1/13, 65538 * 1/6, 65538 * 9/13 }
216 r = filters[0][0] *
p;
217 g = filters[0][1] *
p;
218 b = filters[0][2] *
p;
221 r += filters[1][0] *
p;
222 g += filters[1][1] *
p;
223 b += filters[1][2] *
p;
226 r += filters[2][0] *
p;
227 g += filters[2][1] *
p;
228 b += filters[2][2] *
p;
253 r = filters[0][0] *
p;
254 g = filters[0][1] *
p;
255 b = filters[0][2] *
p;
258 r += filters[1][0] *
p;
259 g += filters[1][1] *
p;
260 b += filters[1][2] *
p;
263 r += filters[2][0] *
p;
264 g += filters[2][1] *
p;
265 b += filters[2][2] *
p;
268 col[pitch] = (
FT_Byte)(
g / 65536 );
269 col[pitch * 2] = (
FT_Byte)(
b / 65536 );
283 return FT_THROW( Invalid_Library_Handle );
286 return FT_THROW( Invalid_Argument );
289 library->lcd_filter_func = ft_lcd_filter_fir;
300 { 0x08, 0x4d, 0x56, 0x4d, 0x08 };
302 { 0x00, 0x55, 0x56, 0x55, 0x00 };
306 return FT_THROW( Invalid_Library_Handle );
318 library->lcd_filter_func = ft_lcd_filter_fir;
325 library->lcd_filter_func = ft_lcd_filter_fir;
332 library->lcd_filter_func = _ft_lcd_filter_legacy;
338 return FT_THROW( Invalid_Argument );
366 return FT_THROW( Unimplemented_Feature );
377 return FT_THROW( Unimplemented_Feature );
enum FT_Render_Mode_ FT_Render_Mode
FT_BEGIN_HEADER typedef signed long FT_Pos
FT_Library_SetLcdFilter(FT_Library library, FT_LcdFilter filter)
FT_Library_SetLcdFilterWeights(FT_Library library, unsigned char *weights)
ft_lcd_padding(FT_Pos *Min, FT_Pos *Max, FT_GlyphSlot slot)
#define FT_LCD_FILTER_FIVE_TAPS
FT_BEGIN_HEADER enum FT_LcdFilter_ FT_LcdFilter
FT_Byte FT_LcdFiveTapFilter[FT_LCD_FILTER_FIVE_TAPS]
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter