ftrender.h
上传用户:yisoukefu
上传日期:2020-08-09
资源大小:39506k
文件大小:11k
源码类别:

其他游戏

开发平台:

Visual C++

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  ftrender.h                                                             */
  4. /*                                                                         */
  5. /*    FreeType renderer modules public interface (specification).          */
  6. /*                                                                         */
  7. /*  Copyright 1996-2001, 2005, 2006 by                                     */
  8. /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
  9. /*                                                                         */
  10. /*  This file is part of the FreeType project, and may only be used,       */
  11. /*  modified, and distributed under the terms of the FreeType project      */
  12. /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
  13. /*  this file you indicate that you have read the license and              */
  14. /*  understand and accept it fully.                                        */
  15. /*                                                                         */
  16. /***************************************************************************/
  17. #ifndef __FTRENDER_H__
  18. #define __FTRENDER_H__
  19. #include <ft2build.h>
  20. #include FT_MODULE_H
  21. #include FT_GLYPH_H
  22. FT_BEGIN_HEADER
  23.   /*************************************************************************/
  24.   /*                                                                       */
  25.   /* <Section>                                                             */
  26.   /*    module_management                                                  */
  27.   /*                                                                       */
  28.   /*************************************************************************/
  29.   /* create a new glyph object */
  30.   typedef FT_Error
  31.   (*FT_Glyph_InitFunc)( FT_Glyph      glyph,
  32.                         FT_GlyphSlot  slot );
  33.   /* destroys a given glyph object */
  34.   typedef void
  35.   (*FT_Glyph_DoneFunc)( FT_Glyph  glyph );
  36.   typedef void
  37.   (*FT_Glyph_TransformFunc)( FT_Glyph          glyph,
  38.                              const FT_Matrix*  matrix,
  39.                              const FT_Vector*  delta );
  40.   typedef void
  41.   (*FT_Glyph_GetBBoxFunc)( FT_Glyph  glyph,
  42.                            FT_BBox*  abbox );
  43.   typedef FT_Error
  44.   (*FT_Glyph_CopyFunc)( FT_Glyph   source,
  45.                         FT_Glyph   target );
  46.   typedef FT_Error
  47.   (*FT_Glyph_PrepareFunc)( FT_Glyph      glyph,
  48.                            FT_GlyphSlot  slot );
  49. /* deprecated */
  50. #define FT_Glyph_Init_Func       FT_Glyph_InitFunc
  51. #define FT_Glyph_Done_Func       FT_Glyph_DoneFunc
  52. #define FT_Glyph_Transform_Func  FT_Glyph_TransformFunc
  53. #define FT_Glyph_BBox_Func       FT_Glyph_GetBBoxFunc
  54. #define FT_Glyph_Copy_Func       FT_Glyph_CopyFunc
  55. #define FT_Glyph_Prepare_Func    FT_Glyph_PrepareFunc
  56.   struct  FT_Glyph_Class_
  57.   {
  58.     FT_Long                 glyph_size;
  59.     FT_Glyph_Format         glyph_format;
  60.     FT_Glyph_InitFunc       glyph_init;
  61.     FT_Glyph_DoneFunc       glyph_done;
  62.     FT_Glyph_CopyFunc       glyph_copy;
  63.     FT_Glyph_TransformFunc  glyph_transform;
  64.     FT_Glyph_GetBBoxFunc    glyph_bbox;
  65.     FT_Glyph_PrepareFunc    glyph_prepare;
  66.   };
  67.   typedef FT_Error
  68.   (*FT_Renderer_RenderFunc)( FT_Renderer       renderer,
  69.                              FT_GlyphSlot      slot,
  70.                              FT_UInt           mode,
  71.                              const FT_Vector*  origin );
  72.   typedef FT_Error
  73.   (*FT_Renderer_TransformFunc)( FT_Renderer       renderer,
  74.                                 FT_GlyphSlot      slot,
  75.                                 const FT_Matrix*  matrix,
  76.                                 const FT_Vector*  delta );
  77.   typedef void
  78.   (*FT_Renderer_GetCBoxFunc)( FT_Renderer   renderer,
  79.                               FT_GlyphSlot  slot,
  80.                               FT_BBox*      cbox );
  81.   typedef FT_Error
  82.   (*FT_Renderer_SetModeFunc)( FT_Renderer  renderer,
  83.                               FT_ULong     mode_tag,
  84.                               FT_Pointer   mode_ptr );
  85. /* deprecated identifiers */
  86. #define FTRenderer_render  FT_Renderer_RenderFunc
  87. #define FTRenderer_transform  FT_Renderer_TransformFunc
  88. #define FTRenderer_getCBox  FT_Renderer_GetCBoxFunc
  89. #define FTRenderer_setMode  FT_Renderer_SetModeFunc
  90.   /*************************************************************************/
  91.   /*                                                                       */
  92.   /* <Struct>                                                              */
  93.   /*    FT_Renderer_Class                                                  */
  94.   /*                                                                       */
  95.   /* <Description>                                                         */
  96.   /*    The renderer module class descriptor.                              */
  97.   /*                                                                       */
  98.   /* <Fields>                                                              */
  99.   /*    root         :: The root @FT_Module_Class fields.                  */
  100.   /*                                                                       */
  101.   /*    glyph_format :: The glyph image format this renderer handles.      */
  102.   /*                                                                       */
  103.   /*    render_glyph :: A method used to render the image that is in a     */
  104.   /*                    given glyph slot into a bitmap.                    */
  105.   /*                                                                       */
  106.   /*    set_mode     :: A method used to pass additional parameters.       */
  107.   /*                                                                       */
  108.   /*    raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.  This */
  109.   /*                    is a pointer to its raster's class.                */
  110.   /*                                                                       */
  111.   /*    raster       :: For @FT_GLYPH_FORMAT_OUTLINE renderers only.  This */
  112.   /*                    is a pointer to the corresponding raster object,   */
  113.   /*                    if any.                                            */
  114.   /*                                                                       */
  115.   typedef struct  FT_Renderer_Class_
  116.   {
  117.     FT_Module_Class       root;
  118.     FT_Glyph_Format       glyph_format;
  119.     FT_Renderer_RenderFunc     render_glyph;
  120.     FT_Renderer_TransformFunc  transform_glyph;
  121.     FT_Renderer_GetCBoxFunc    get_glyph_cbox;
  122.     FT_Renderer_SetModeFunc    set_mode;
  123.     FT_Raster_Funcs*           raster_class;
  124.   } FT_Renderer_Class;
  125.   /*************************************************************************/
  126.   /*                                                                       */
  127.   /* <Function>                                                            */
  128.   /*    FT_Get_Renderer                                                    */
  129.   /*                                                                       */
  130.   /* <Description>                                                         */
  131.   /*    Retrieves the current renderer for a given glyph format.           */
  132.   /*                                                                       */
  133.   /* <Input>                                                               */
  134.   /*    library :: A handle to the library object.                         */
  135.   /*                                                                       */
  136.   /*    format  :: The glyph format.                                       */
  137.   /*                                                                       */
  138.   /* <Return>                                                              */
  139.   /*    A renderer handle.  0 if none found.                               */
  140.   /*                                                                       */
  141.   /* <Note>                                                                */
  142.   /*    An error will be returned if a module already exists by that name, */
  143.   /*    or if the module requires a version of FreeType that is too great. */
  144.   /*                                                                       */
  145.   /*    To add a new renderer, simply use @FT_Add_Module.  To retrieve a   */
  146.   /*    renderer by its name, use @FT_Get_Module.                          */
  147.   /*                                                                       */
  148.   FT_EXPORT( FT_Renderer )
  149.   FT_Get_Renderer( FT_Library       library,
  150.                    FT_Glyph_Format  format );
  151.   /*************************************************************************/
  152.   /*                                                                       */
  153.   /* <Function>                                                            */
  154.   /*    FT_Set_Renderer                                                    */
  155.   /*                                                                       */
  156.   /* <Description>                                                         */
  157.   /*    Sets the current renderer to use, and set additional mode.         */
  158.   /*                                                                       */
  159.   /* <InOut>                                                               */
  160.   /*    library    :: A handle to the library object.                      */
  161.   /*                                                                       */
  162.   /* <Input>                                                               */
  163.   /*    renderer   :: A handle to the renderer object.                     */
  164.   /*                                                                       */
  165.   /*    num_params :: The number of additional parameters.                 */
  166.   /*                                                                       */
  167.   /*    parameters :: Additional parameters.                               */
  168.   /*                                                                       */
  169.   /* <Return>                                                              */
  170.   /*    FreeType error code.  0 means success.                             */
  171.   /*                                                                       */
  172.   /* <Note>                                                                */
  173.   /*    In case of success, the renderer will be used to convert glyph     */
  174.   /*    images in the renderer's known format into bitmaps.                */
  175.   /*                                                                       */
  176.   /*    This doesn't change the current renderer for other formats.        */
  177.   /*                                                                       */
  178.   FT_EXPORT( FT_Error )
  179.   FT_Set_Renderer( FT_Library     library,
  180.                    FT_Renderer    renderer,
  181.                    FT_UInt        num_params,
  182.                    FT_Parameter*  parameters );
  183.   /* */
  184. FT_END_HEADER
  185. #endif /* __FTRENDER_H__ */
  186. /* END */