Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/freetype2/freetype/ftbitmap.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /****************************************************************************
0002  *
0003  * ftbitmap.h
0004  *
0005  *   FreeType utility functions for bitmaps (specification).
0006  *
0007  * Copyright (C) 2004-2023 by
0008  * David Turner, Robert Wilhelm, and Werner Lemberg.
0009  *
0010  * This file is part of the FreeType project, and may only be used,
0011  * modified, and distributed under the terms of the FreeType project
0012  * license, LICENSE.TXT.  By continuing to use, modify, or distribute
0013  * this file you indicate that you have read the license and
0014  * understand and accept it fully.
0015  *
0016  */
0017 
0018 
0019 #ifndef FTBITMAP_H_
0020 #define FTBITMAP_H_
0021 
0022 
0023 #include <freetype/freetype.h>
0024 #include <freetype/ftcolor.h>
0025 
0026 #ifdef FREETYPE_H
0027 #error "freetype.h of FreeType 1 has been loaded!"
0028 #error "Please fix the directory search order for header files"
0029 #error "so that freetype.h of FreeType 2 is found first."
0030 #endif
0031 
0032 
0033 FT_BEGIN_HEADER
0034 
0035 
0036   /**************************************************************************
0037    *
0038    * @section:
0039    *   bitmap_handling
0040    *
0041    * @title:
0042    *   Bitmap Handling
0043    *
0044    * @abstract:
0045    *   Handling FT_Bitmap objects.
0046    *
0047    * @description:
0048    *   This section contains functions for handling @FT_Bitmap objects,
0049    *   automatically adjusting the target's bitmap buffer size as needed.
0050    *
0051    *   Note that none of the functions changes the bitmap's 'flow' (as
0052    *   indicated by the sign of the `pitch` field in @FT_Bitmap).
0053    *
0054    *   To set the flow, assign an appropriate positive or negative value to
0055    *   the `pitch` field of the target @FT_Bitmap object after calling
0056    *   @FT_Bitmap_Init but before calling any of the other functions
0057    *   described here.
0058    */
0059 
0060 
0061   /**************************************************************************
0062    *
0063    * @function:
0064    *   FT_Bitmap_Init
0065    *
0066    * @description:
0067    *   Initialize a pointer to an @FT_Bitmap structure.
0068    *
0069    * @inout:
0070    *   abitmap ::
0071    *     A pointer to the bitmap structure.
0072    *
0073    * @note:
0074    *   A deprecated name for the same function is `FT_Bitmap_New`.
0075    */
0076   FT_EXPORT( void )
0077   FT_Bitmap_Init( FT_Bitmap  *abitmap );
0078 
0079 
0080   /* deprecated */
0081   FT_EXPORT( void )
0082   FT_Bitmap_New( FT_Bitmap  *abitmap );
0083 
0084 
0085   /**************************************************************************
0086    *
0087    * @function:
0088    *   FT_Bitmap_Copy
0089    *
0090    * @description:
0091    *   Copy a bitmap into another one.
0092    *
0093    * @input:
0094    *   library ::
0095    *     A handle to a library object.
0096    *
0097    *   source ::
0098    *     A handle to the source bitmap.
0099    *
0100    * @output:
0101    *   target ::
0102    *     A handle to the target bitmap.
0103    *
0104    * @return:
0105    *   FreeType error code.  0~means success.
0106    *
0107    * @note:
0108    *   `source->buffer` and `target->buffer` must neither be equal nor
0109    *   overlap.
0110    */
0111   FT_EXPORT( FT_Error )
0112   FT_Bitmap_Copy( FT_Library        library,
0113                   const FT_Bitmap  *source,
0114                   FT_Bitmap        *target );
0115 
0116 
0117   /**************************************************************************
0118    *
0119    * @function:
0120    *   FT_Bitmap_Embolden
0121    *
0122    * @description:
0123    *   Embolden a bitmap.  The new bitmap will be about `xStrength` pixels
0124    *   wider and `yStrength` pixels higher.  The left and bottom borders are
0125    *   kept unchanged.
0126    *
0127    * @input:
0128    *   library ::
0129    *     A handle to a library object.
0130    *
0131    *   xStrength ::
0132    *     How strong the glyph is emboldened horizontally.  Expressed in 26.6
0133    *     pixel format.
0134    *
0135    *   yStrength ::
0136    *     How strong the glyph is emboldened vertically.  Expressed in 26.6
0137    *     pixel format.
0138    *
0139    * @inout:
0140    *   bitmap ::
0141    *     A handle to the target bitmap.
0142    *
0143    * @return:
0144    *   FreeType error code.  0~means success.
0145    *
0146    * @note:
0147    *   The current implementation restricts `xStrength` to be less than or
0148    *   equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO.
0149    *
0150    *   If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, you
0151    *   should call @FT_GlyphSlot_Own_Bitmap on the slot first.
0152    *
0153    *   Bitmaps in @FT_PIXEL_MODE_GRAY2 and @FT_PIXEL_MODE_GRAY@ format are
0154    *   converted to @FT_PIXEL_MODE_GRAY format (i.e., 8bpp).
0155    */
0156   FT_EXPORT( FT_Error )
0157   FT_Bitmap_Embolden( FT_Library  library,
0158                       FT_Bitmap*  bitmap,
0159                       FT_Pos      xStrength,
0160                       FT_Pos      yStrength );
0161 
0162 
0163   /**************************************************************************
0164    *
0165    * @function:
0166    *   FT_Bitmap_Convert
0167    *
0168    * @description:
0169    *   Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, 8bpp or 32bpp to
0170    *   a bitmap object with depth 8bpp, making the number of used bytes per
0171    *   line (a.k.a. the 'pitch') a multiple of `alignment`.
0172    *
0173    * @input:
0174    *   library ::
0175    *     A handle to a library object.
0176    *
0177    *   source ::
0178    *     The source bitmap.
0179    *
0180    *   alignment ::
0181    *     The pitch of the bitmap is a multiple of this argument.  Common
0182    *     values are 1, 2, or 4.
0183    *
0184    * @output:
0185    *   target ::
0186    *     The target bitmap.
0187    *
0188    * @return:
0189    *   FreeType error code.  0~means success.
0190    *
0191    * @note:
0192    *   It is possible to call @FT_Bitmap_Convert multiple times without
0193    *   calling @FT_Bitmap_Done (the memory is simply reallocated).
0194    *
0195    *   Use @FT_Bitmap_Done to finally remove the bitmap object.
0196    *
0197    *   The `library` argument is taken to have access to FreeType's memory
0198    *   handling functions.
0199    *
0200    *   `source->buffer` and `target->buffer` must neither be equal nor
0201    *   overlap.
0202    */
0203   FT_EXPORT( FT_Error )
0204   FT_Bitmap_Convert( FT_Library        library,
0205                      const FT_Bitmap  *source,
0206                      FT_Bitmap        *target,
0207                      FT_Int            alignment );
0208 
0209 
0210   /**************************************************************************
0211    *
0212    * @function:
0213    *   FT_Bitmap_Blend
0214    *
0215    * @description:
0216    *   Blend a bitmap onto another bitmap, using a given color.
0217    *
0218    * @input:
0219    *   library ::
0220    *     A handle to a library object.
0221    *
0222    *   source ::
0223    *     The source bitmap, which can have any @FT_Pixel_Mode format.
0224    *
0225    *   source_offset ::
0226    *     The offset vector to the upper left corner of the source bitmap in
0227    *     26.6 pixel format.  It should represent an integer offset; the
0228    *     function will set the lowest six bits to zero to enforce that.
0229    *
0230    *   color ::
0231    *     The color used to draw `source` onto `target`.
0232    *
0233    * @inout:
0234    *   target ::
0235    *     A handle to an `FT_Bitmap` object.  It should be either initialized
0236    *     as empty with a call to @FT_Bitmap_Init, or it should be of type
0237    *     @FT_PIXEL_MODE_BGRA.
0238    *
0239    *   atarget_offset ::
0240    *     The offset vector to the upper left corner of the target bitmap in
0241    *     26.6 pixel format.  It should represent an integer offset; the
0242    *     function will set the lowest six bits to zero to enforce that.
0243    *
0244    * @return:
0245    *   FreeType error code.  0~means success.
0246    *
0247    * @note:
0248    *   This function doesn't perform clipping.
0249    *
0250    *   The bitmap in `target` gets allocated or reallocated as needed; the
0251    *   vector `atarget_offset` is updated accordingly.
0252    *
0253    *   In case of allocation or reallocation, the bitmap's pitch is set to
0254    *   `4 * width`.  Both `source` and `target` must have the same bitmap
0255    *   flow (as indicated by the sign of the `pitch` field).
0256    *
0257    *   `source->buffer` and `target->buffer` must neither be equal nor
0258    *   overlap.
0259    *
0260    * @since:
0261    *   2.10
0262    */
0263   FT_EXPORT( FT_Error )
0264   FT_Bitmap_Blend( FT_Library         library,
0265                    const FT_Bitmap*   source,
0266                    const FT_Vector    source_offset,
0267                    FT_Bitmap*         target,
0268                    FT_Vector         *atarget_offset,
0269                    FT_Color           color );
0270 
0271 
0272   /**************************************************************************
0273    *
0274    * @function:
0275    *   FT_GlyphSlot_Own_Bitmap
0276    *
0277    * @description:
0278    *   Make sure that a glyph slot owns `slot->bitmap`.
0279    *
0280    * @input:
0281    *   slot ::
0282    *     The glyph slot.
0283    *
0284    * @return:
0285    *   FreeType error code.  0~means success.
0286    *
0287    * @note:
0288    *   This function is to be used in combination with @FT_Bitmap_Embolden.
0289    */
0290   FT_EXPORT( FT_Error )
0291   FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot  slot );
0292 
0293 
0294   /**************************************************************************
0295    *
0296    * @function:
0297    *   FT_Bitmap_Done
0298    *
0299    * @description:
0300    *   Destroy a bitmap object initialized with @FT_Bitmap_Init.
0301    *
0302    * @input:
0303    *   library ::
0304    *     A handle to a library object.
0305    *
0306    *   bitmap ::
0307    *     The bitmap object to be freed.
0308    *
0309    * @return:
0310    *   FreeType error code.  0~means success.
0311    *
0312    * @note:
0313    *   The `library` argument is taken to have access to FreeType's memory
0314    *   handling functions.
0315    */
0316   FT_EXPORT( FT_Error )
0317   FT_Bitmap_Done( FT_Library  library,
0318                   FT_Bitmap  *bitmap );
0319 
0320 
0321   /* */
0322 
0323 
0324 FT_END_HEADER
0325 
0326 #endif /* FTBITMAP_H_ */
0327 
0328 
0329 /* END */