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

其他游戏

开发平台:

Visual C++

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*  ftbitmap.h                                                             */
  4. /*                                                                         */
  5. /*    FreeType utility functions for converting 1bpp, 2bpp, 4bpp, and 8bpp */
  6. /*    bitmaps into 8bpp format (specification).                            */
  7. /*                                                                         */
  8. /*  Copyright 2004, 2005, 2006 by                                          */
  9. /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
  10. /*                                                                         */
  11. /*  This file is part of the FreeType project, and may only be used,       */
  12. /*  modified, and distributed under the terms of the FreeType project      */
  13. /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
  14. /*  this file you indicate that you have read the license and              */
  15. /*  understand and accept it fully.                                        */
  16. /*                                                                         */
  17. /***************************************************************************/
  18. #ifndef __FTBITMAP_H__
  19. #define __FTBITMAP_H__
  20. #include <ft2build.h>
  21. #include FT_FREETYPE_H
  22. #ifdef FREETYPE_H
  23. #error "freetype.h of FreeType 1 has been loaded!"
  24. #error "Please fix the directory search order for header files"
  25. #error "so that freetype.h of FreeType 2 is found first."
  26. #endif
  27. FT_BEGIN_HEADER
  28.   /*************************************************************************/
  29.   /*                                                                       */
  30.   /* <Section>                                                             */
  31.   /*    bitmap_handling                                                    */
  32.   /*                                                                       */
  33.   /* <Title>                                                               */
  34.   /*    Bitmap Handling                                                    */
  35.   /*                                                                       */
  36.   /* <Abstract>                                                            */
  37.   /*    Handling FT_Bitmap objects.                                        */
  38.   /*                                                                       */
  39.   /* <Description>                                                         */
  40.   /*    This section contains functions for converting FT_Bitmap objects.  */
  41.   /*                                                                       */
  42.   /*************************************************************************/
  43.   /*************************************************************************/
  44.   /*                                                                       */
  45.   /* <Function>                                                            */
  46.   /*    FT_Bitmap_New                                                      */
  47.   /*                                                                       */
  48.   /* <Description>                                                         */
  49.   /*    Initialize a pointer to an @FT_Bitmap structure.                   */
  50.   /*                                                                       */
  51.   /* <InOut>                                                               */
  52.   /*    abitmap :: A pointer to the bitmap structure.                      */
  53.   /*                                                                       */
  54.   FT_EXPORT( void )
  55.   FT_Bitmap_New( FT_Bitmap  *abitmap );
  56.   /*************************************************************************/
  57.   /*                                                                       */
  58.   /* <Function>                                                            */
  59.   /*    FT_Bitmap_Copy                                                     */
  60.   /*                                                                       */
  61.   /* <Description>                                                         */
  62.   /*    Copies an bitmap into another one.                                 */
  63.   /*                                                                       */
  64.   /* <Input>                                                               */
  65.   /*    library :: A handle to a library object.                           */
  66.   /*                                                                       */
  67.   /*    source  :: A handle to the source bitmap.                          */
  68.   /*                                                                       */
  69.   /* <Output>                                                              */
  70.   /*    target  :: A handle to the target bitmap.                          */
  71.   /*                                                                       */
  72.   /* <Return>                                                              */
  73.   /*    FreeType error code.  0 means success.                             */
  74.   /*                                                                       */
  75.   FT_EXPORT( FT_Error )
  76.   FT_Bitmap_Copy( FT_Library        library,
  77.                   const FT_Bitmap  *source,
  78.                   FT_Bitmap        *target);
  79.   /*************************************************************************/
  80.   /*                                                                       */
  81.   /* <Function>                                                            */
  82.   /*    FT_Bitmap_Embolden                                                 */
  83.   /*                                                                       */
  84.   /* <Description>                                                         */
  85.   /*    Embolden a bitmap.  The new bitmap will be about `xStrength'       */
  86.   /*    pixels wider and `yStrength' pixels higher.  The left and bottom   */
  87.   /*    borders are kept unchanged.                                        */
  88.   /*                                                                       */
  89.   /* <Input>                                                               */
  90.   /*    library   :: A handle to a library object.                         */
  91.   /*                                                                       */
  92.   /*    xStrength :: How strong the glyph is emboldened horizontally.      */
  93.   /*                 Expressed in 26.6 pixel format.                       */
  94.   /*                                                                       */
  95.   /*    yStrength :: How strong the glyph is emboldened vertically.        */
  96.   /*                 Expressed in 26.6 pixel format.                       */
  97.   /*                                                                       */
  98.   /* <InOut>                                                               */
  99.   /*    bitmap    :: A handle to the target bitmap.                        */
  100.   /*                                                                       */
  101.   /* <Return>                                                              */
  102.   /*    FreeType error code.  0 means success.                             */
  103.   /*                                                                       */
  104.   /* <Note>                                                                */
  105.   /*    The current implementation restricts `xStrength' to be less than   */
  106.   /*    or equal to 8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.      */
  107.   /*                                                                       */
  108.   /*    If you want to embolden the bitmap owned by a @FT_GlyphSlotRec,    */
  109.   /*    you should call `FT_GlyphSlot_Own_Bitmap' on the slot first.       */
  110.   /*                                                                       */
  111.   FT_EXPORT( FT_Error )
  112.   FT_Bitmap_Embolden( FT_Library  library,
  113.                       FT_Bitmap*  bitmap,
  114.                       FT_Pos      xStrength,
  115.                       FT_Pos      yStrength );
  116.   /*************************************************************************/
  117.   /*                                                                       */
  118.   /* <Function>                                                            */
  119.   /*    FT_Bitmap_Convert                                                  */
  120.   /*                                                                       */
  121.   /* <Description>                                                         */
  122.   /*    Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a  */
  123.   /*    bitmap object with depth 8bpp, making the number of used bytes per */
  124.   /*    line (a.k.a. the `pitch') a multiple of `alignment'.               */
  125.   /*                                                                       */
  126.   /* <Input>                                                               */
  127.   /*    library   :: A handle to a library object.                         */
  128.   /*                                                                       */
  129.   /*    source    :: The source bitmap.                                    */
  130.   /*                                                                       */
  131.   /*    alignment :: The pitch of the bitmap is a multiple of this         */
  132.   /*                 parameter.  Common values are 1, 2, or 4.             */
  133.   /*                                                                       */
  134.   /* <Output>                                                              */
  135.   /*    target    :: The target bitmap.                                    */
  136.   /*                                                                       */
  137.   /* <Return>                                                              */
  138.   /*    FreeType error code.  0 means success.                             */
  139.   /*                                                                       */
  140.   /* <Note>                                                                */
  141.   /*    It is possible to call @FT_Bitmap_Convert multiple times without   */
  142.   /*    calling @FT_Bitmap_Done (the memory is simply reallocated).        */
  143.   /*                                                                       */
  144.   /*    Use @FT_Bitmap_Done to finally remove the bitmap object.           */
  145.   /*                                                                       */
  146.   /*    The `library' argument is taken to have access to FreeType's       */
  147.   /*    memory handling functions.                                         */
  148.   /*                                                                       */
  149.   FT_EXPORT( FT_Error )
  150.   FT_Bitmap_Convert( FT_Library        library,
  151.                      const FT_Bitmap  *source,
  152.                      FT_Bitmap        *target,
  153.                      FT_Int            alignment );
  154.   /*************************************************************************/
  155.   /*                                                                       */
  156.   /* <Function>                                                            */
  157.   /*    FT_Bitmap_Done                                                     */
  158.   /*                                                                       */
  159.   /* <Description>                                                         */
  160.   /*    Destroy a bitmap object created with @FT_Bitmap_New.               */
  161.   /*                                                                       */
  162.   /* <Input>                                                               */
  163.   /*    library :: A handle to a library object.                           */
  164.   /*                                                                       */
  165.   /*    bitmap  :: The bitmap object to be freed.                          */
  166.   /*                                                                       */
  167.   /* <Return>                                                              */
  168.   /*    FreeType error code.  0 means success.                             */
  169.   /*                                                                       */
  170.   /* <Note>                                                                */
  171.   /*    The `library' argument is taken to have access to FreeType's       */
  172.   /*    memory handling functions.                                         */
  173.   /*                                                                       */
  174.   FT_EXPORT( FT_Error )
  175.   FT_Bitmap_Done( FT_Library  library,
  176.                   FT_Bitmap  *bitmap );
  177.   /* */
  178. FT_END_HEADER
  179. #endif /* __FTBITMAP_H__ */
  180. /* END */