michael@0: /***************************************************************************/ michael@0: /* */ michael@0: /* ftrender.h */ michael@0: /* */ michael@0: /* FreeType renderer modules public interface (specification). */ michael@0: /* */ michael@0: /* Copyright 1996-2001, 2005, 2006, 2010 by */ michael@0: /* David Turner, Robert Wilhelm, and Werner Lemberg. */ michael@0: /* */ michael@0: /* This file is part of the FreeType project, and may only be used, */ michael@0: /* modified, and distributed under the terms of the FreeType project */ michael@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ michael@0: /* this file you indicate that you have read the license and */ michael@0: /* understand and accept it fully. */ michael@0: /* */ michael@0: /***************************************************************************/ michael@0: michael@0: michael@0: #ifndef __FTRENDER_H__ michael@0: #define __FTRENDER_H__ michael@0: michael@0: michael@0: #include michael@0: #include FT_MODULE_H michael@0: #include FT_GLYPH_H michael@0: michael@0: michael@0: FT_BEGIN_HEADER michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /*
*/ michael@0: /* module_management */ michael@0: /* */ michael@0: /*************************************************************************/ michael@0: michael@0: michael@0: /* create a new glyph object */ michael@0: typedef FT_Error michael@0: (*FT_Glyph_InitFunc)( FT_Glyph glyph, michael@0: FT_GlyphSlot slot ); michael@0: michael@0: /* destroys a given glyph object */ michael@0: typedef void michael@0: (*FT_Glyph_DoneFunc)( FT_Glyph glyph ); michael@0: michael@0: typedef void michael@0: (*FT_Glyph_TransformFunc)( FT_Glyph glyph, michael@0: const FT_Matrix* matrix, michael@0: const FT_Vector* delta ); michael@0: michael@0: typedef void michael@0: (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph, michael@0: FT_BBox* abbox ); michael@0: michael@0: typedef FT_Error michael@0: (*FT_Glyph_CopyFunc)( FT_Glyph source, michael@0: FT_Glyph target ); michael@0: michael@0: typedef FT_Error michael@0: (*FT_Glyph_PrepareFunc)( FT_Glyph glyph, michael@0: FT_GlyphSlot slot ); michael@0: michael@0: /* deprecated */ michael@0: #define FT_Glyph_Init_Func FT_Glyph_InitFunc michael@0: #define FT_Glyph_Done_Func FT_Glyph_DoneFunc michael@0: #define FT_Glyph_Transform_Func FT_Glyph_TransformFunc michael@0: #define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc michael@0: #define FT_Glyph_Copy_Func FT_Glyph_CopyFunc michael@0: #define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc michael@0: michael@0: michael@0: struct FT_Glyph_Class_ michael@0: { michael@0: FT_Long glyph_size; michael@0: FT_Glyph_Format glyph_format; michael@0: FT_Glyph_InitFunc glyph_init; michael@0: FT_Glyph_DoneFunc glyph_done; michael@0: FT_Glyph_CopyFunc glyph_copy; michael@0: FT_Glyph_TransformFunc glyph_transform; michael@0: FT_Glyph_GetBBoxFunc glyph_bbox; michael@0: FT_Glyph_PrepareFunc glyph_prepare; michael@0: }; michael@0: michael@0: michael@0: typedef FT_Error michael@0: (*FT_Renderer_RenderFunc)( FT_Renderer renderer, michael@0: FT_GlyphSlot slot, michael@0: FT_UInt mode, michael@0: const FT_Vector* origin ); michael@0: michael@0: typedef FT_Error michael@0: (*FT_Renderer_TransformFunc)( FT_Renderer renderer, michael@0: FT_GlyphSlot slot, michael@0: const FT_Matrix* matrix, michael@0: const FT_Vector* delta ); michael@0: michael@0: michael@0: typedef void michael@0: (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer, michael@0: FT_GlyphSlot slot, michael@0: FT_BBox* cbox ); michael@0: michael@0: michael@0: typedef FT_Error michael@0: (*FT_Renderer_SetModeFunc)( FT_Renderer renderer, michael@0: FT_ULong mode_tag, michael@0: FT_Pointer mode_ptr ); michael@0: michael@0: /* deprecated identifiers */ michael@0: #define FTRenderer_render FT_Renderer_RenderFunc michael@0: #define FTRenderer_transform FT_Renderer_TransformFunc michael@0: #define FTRenderer_getCBox FT_Renderer_GetCBoxFunc michael@0: #define FTRenderer_setMode FT_Renderer_SetModeFunc michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* */ michael@0: /* FT_Renderer_Class */ michael@0: /* */ michael@0: /* */ michael@0: /* The renderer module class descriptor. */ michael@0: /* */ michael@0: /* */ michael@0: /* root :: The root @FT_Module_Class fields. */ michael@0: /* */ michael@0: /* glyph_format :: The glyph image format this renderer handles. */ michael@0: /* */ michael@0: /* render_glyph :: A method used to render the image that is in a */ michael@0: /* given glyph slot into a bitmap. */ michael@0: /* */ michael@0: /* transform_glyph :: A method used to transform the image that is in */ michael@0: /* a given glyph slot. */ michael@0: /* */ michael@0: /* get_glyph_cbox :: A method used to access the glyph's cbox. */ michael@0: /* */ michael@0: /* set_mode :: A method used to pass additional parameters. */ michael@0: /* */ michael@0: /* raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */ michael@0: /* This is a pointer to its raster's class. */ michael@0: /* */ michael@0: typedef struct FT_Renderer_Class_ michael@0: { michael@0: FT_Module_Class root; michael@0: michael@0: FT_Glyph_Format glyph_format; michael@0: michael@0: FT_Renderer_RenderFunc render_glyph; michael@0: FT_Renderer_TransformFunc transform_glyph; michael@0: FT_Renderer_GetCBoxFunc get_glyph_cbox; michael@0: FT_Renderer_SetModeFunc set_mode; michael@0: michael@0: FT_Raster_Funcs* raster_class; michael@0: michael@0: } FT_Renderer_Class; michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* */ michael@0: /* FT_Get_Renderer */ michael@0: /* */ michael@0: /* */ michael@0: /* Retrieve the current renderer for a given glyph format. */ michael@0: /* */ michael@0: /* */ michael@0: /* library :: A handle to the library object. */ michael@0: /* */ michael@0: /* format :: The glyph format. */ michael@0: /* */ michael@0: /* */ michael@0: /* A renderer handle. 0~if none found. */ michael@0: /* */ michael@0: /* */ michael@0: /* An error will be returned if a module already exists by that name, */ michael@0: /* or if the module requires a version of FreeType that is too great. */ michael@0: /* */ michael@0: /* To add a new renderer, simply use @FT_Add_Module. To retrieve a */ michael@0: /* renderer by its name, use @FT_Get_Module. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Renderer ) michael@0: FT_Get_Renderer( FT_Library library, michael@0: FT_Glyph_Format format ); michael@0: michael@0: michael@0: /*************************************************************************/ michael@0: /* */ michael@0: /* */ michael@0: /* FT_Set_Renderer */ michael@0: /* */ michael@0: /* */ michael@0: /* Set the current renderer to use, and set additional mode. */ michael@0: /* */ michael@0: /* */ michael@0: /* library :: A handle to the library object. */ michael@0: /* */ michael@0: /* */ michael@0: /* renderer :: A handle to the renderer object. */ michael@0: /* */ michael@0: /* num_params :: The number of additional parameters. */ michael@0: /* */ michael@0: /* parameters :: Additional parameters. */ michael@0: /* */ michael@0: /* */ michael@0: /* FreeType error code. 0~means success. */ michael@0: /* */ michael@0: /* */ michael@0: /* In case of success, the renderer will be used to convert glyph */ michael@0: /* images in the renderer's known format into bitmaps. */ michael@0: /* */ michael@0: /* This doesn't change the current renderer for other formats. */ michael@0: /* */ michael@0: /* Currently, only the B/W renderer, if compiled with */ michael@0: /* FT_RASTER_OPTION_ANTI_ALIASING (providing a 5-levels */ michael@0: /* anti-aliasing mode; this option must be set directly in */ michael@0: /* `ftraster.c' and is undefined by default) accepts a single tag */ michael@0: /* `pal5' to set its gray palette as a character string with */ michael@0: /* 5~elements. Consequently, the third and fourth argument are zero */ michael@0: /* normally. */ michael@0: /* */ michael@0: FT_EXPORT( FT_Error ) michael@0: FT_Set_Renderer( FT_Library library, michael@0: FT_Renderer renderer, michael@0: FT_UInt num_params, michael@0: FT_Parameter* parameters ); michael@0: michael@0: michael@0: /* */ michael@0: michael@0: michael@0: FT_END_HEADER michael@0: michael@0: #endif /* __FTRENDER_H__ */ michael@0: michael@0: michael@0: /* END */