#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftobjs.h>
#include <freetype/ftoutln.h>
#include "ftsmooth.h"
#include "ftgrays.h"
#include "ftsmerrs.h"
static FT_Error
ft_smooth_set_mode( FT_Renderer render,
FT_ULong mode_tag,
FT_Pointer data )
{ … }
static FT_Error
ft_smooth_transform( FT_Renderer render,
FT_GlyphSlot slot,
const FT_Matrix* matrix,
const FT_Vector* delta )
{ … }
static void
ft_smooth_get_cbox( FT_Renderer render,
FT_GlyphSlot slot,
FT_BBox* cbox )
{ … }
TOrigin;
#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
static FT_Error
ft_smooth_init( FT_Module module )
{ … }
static void
ft_smooth_lcd_spans( int y,
int count,
const FT_Span* spans,
void* target_ )
{ … }
static FT_Error
ft_smooth_raster_lcd( FT_Renderer render,
FT_Outline* outline,
FT_Bitmap* bitmap )
{ … }
static FT_Error
ft_smooth_raster_lcdv( FT_Renderer render,
FT_Outline* outline,
FT_Bitmap* bitmap )
{ … }
#else
static FT_Error
ft_smooth_init( FT_Module module )
{
FT_Renderer render = (FT_Renderer)module;
FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT );
render->clazz->raster_class->raster_reset( render->raster, NULL, 0 );
return 0;
}
static FT_Error
ft_smooth_raster_lcd( FT_Renderer render,
FT_Outline* outline,
FT_Bitmap* bitmap )
{
FT_Error error = FT_Err_Ok;
FT_Vector* points = outline->points;
FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
FT_Vector* vec;
FT_Raster_Params params;
params.target = bitmap;
params.source = outline;
params.flags = FT_RASTER_FLAG_AA;
for ( vec = points; vec < points_end; vec++ )
vec->x *= 3;
error = render->raster_render( render->raster, ¶ms );
for ( vec = points; vec < points_end; vec++ )
vec->x /= 3;
return error;
}
static FT_Error
ft_smooth_raster_lcdv( FT_Renderer render,
FT_Outline* outline,
FT_Bitmap* bitmap )
{
FT_Error error = FT_Err_Ok;
FT_Vector* points = outline->points;
FT_Vector* points_end = FT_OFFSET( points, outline->n_points );
FT_Vector* vec;
FT_Raster_Params params;
params.target = bitmap;
params.source = outline;
params.flags = FT_RASTER_FLAG_AA;
for ( vec = points; vec < points_end; vec++ )
vec->y *= 3;
error = render->raster_render( render->raster, ¶ms );
for ( vec = points; vec < points_end; vec++ )
vec->y /= 3;
return error;
}
#endif
#define SCALE …
static void
ft_smooth_overlap_spans( int y,
int count,
const FT_Span* spans,
void* target_ )
{ … }
static FT_Error
ft_smooth_raster_overlap( FT_Renderer render,
FT_Outline* outline,
FT_Bitmap* bitmap )
{ … }
#undef SCALE
static FT_Error
ft_smooth_render( FT_Renderer render,
FT_GlyphSlot slot,
FT_Render_Mode mode,
const FT_Vector* origin )
{ … }
FT_DEFINE_RENDERER(
ft_smooth_renderer_class,
FT_MODULE_RENDERER,
sizeof ( FT_RendererRec ),
"smooth",
0x10000L,
0x20000L,
NULL,
(FT_Module_Constructor)ft_smooth_init,
(FT_Module_Destructor) NULL,
(FT_Module_Requester) NULL,
FT_GLYPH_FORMAT_OUTLINE,
(FT_Renderer_RenderFunc) ft_smooth_render,
(FT_Renderer_TransformFunc)ft_smooth_transform,
(FT_Renderer_GetCBoxFunc) ft_smooth_get_cbox,
(FT_Renderer_SetModeFunc) ft_smooth_set_mode,
(FT_Raster_Funcs*)&ft_grays_raster
)