00001 /***************************************************************************/ 00002 /* */ 00003 /* ftbitmap.h */ 00004 /* */ 00005 /* FreeType utility functions for bitmaps (specification). */ 00006 /* */ 00007 /* Copyright 2004, 2005, 2006, 2008 by */ 00008 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 #ifndef __FTBITMAP_H__ 00020 #define __FTBITMAP_H__ 00021 00022 00023 #include <ft2build.h> 00024 #include FT_FREETYPE_H 00025 00026 #ifdef FREETYPE_H 00027 #error "freetype.h of FreeType 1 has been loaded!" 00028 #error "Please fix the directory search order for header files" 00029 #error "so that freetype.h of FreeType 2 is found first." 00030 #endif 00031 00032 00033 FT_BEGIN_HEADER 00034 00035 00036 /*************************************************************************/ 00037 /* */ 00038 /* <Section> */ 00039 /* bitmap_handling */ 00040 /* */ 00041 /* <Title> */ 00042 /* Bitmap Handling */ 00043 /* */ 00044 /* <Abstract> */ 00045 /* Handling FT_Bitmap objects. */ 00046 /* */ 00047 /* <Description> */ 00048 /* This section contains functions for converting FT_Bitmap objects. */ 00049 /* */ 00050 /*************************************************************************/ 00051 00052 00053 /*************************************************************************/ 00054 /* */ 00055 /* <Function> */ 00056 /* FT_Bitmap_New */ 00057 /* */ 00058 /* <Description> */ 00059 /* Initialize a pointer to an @FT_Bitmap structure. */ 00060 /* */ 00061 /* <InOut> */ 00062 /* abitmap :: A pointer to the bitmap structure. */ 00063 /* */ 00064 FT_EXPORT( void ) 00065 FT_Bitmap_New( FT_Bitmap *abitmap ); 00066 00067 00068 /*************************************************************************/ 00069 /* */ 00070 /* <Function> */ 00071 /* FT_Bitmap_Copy */ 00072 /* */ 00073 /* <Description> */ 00074 /* Copy a bitmap into another one. */ 00075 /* */ 00076 /* <Input> */ 00077 /* library :: A handle to a library object. */ 00078 /* */ 00079 /* source :: A handle to the source bitmap. */ 00080 /* */ 00081 /* <Output> */ 00082 /* target :: A handle to the target bitmap. */ 00083 /* */ 00084 /* <Return> */ 00085 /* FreeType error code. 0~means success. */ 00086 /* */ 00087 FT_EXPORT( FT_Error ) 00088 FT_Bitmap_Copy( FT_Library library, 00089 const FT_Bitmap *source, 00090 FT_Bitmap *target); 00091 00092 00093 /*************************************************************************/ 00094 /* */ 00095 /* <Function> */ 00096 /* FT_Bitmap_Embolden */ 00097 /* */ 00098 /* <Description> */ 00099 /* Embolden a bitmap. The new bitmap will be about `xStrength' */ 00100 /* pixels wider and `yStrength' pixels higher. The left and bottom */ 00101 /* borders are kept unchanged. */ 00102 /* */ 00103 /* <Input> */ 00104 /* library :: A handle to a library object. */ 00105 /* */ 00106 /* xStrength :: How strong the glyph is emboldened horizontally. */ 00107 /* Expressed in 26.6 pixel format. */ 00108 /* */ 00109 /* yStrength :: How strong the glyph is emboldened vertically. */ 00110 /* Expressed in 26.6 pixel format. */ 00111 /* */ 00112 /* <InOut> */ 00113 /* bitmap :: A handle to the target bitmap. */ 00114 /* */ 00115 /* <Return> */ 00116 /* FreeType error code. 0~means success. */ 00117 /* */ 00118 /* <Note> */ 00119 /* The current implementation restricts `xStrength' to be less than */ 00120 /* or equal to~8 if bitmap is of pixel_mode @FT_PIXEL_MODE_MONO. */ 00121 /* */ 00122 /* If you want to embolden the bitmap owned by a @FT_GlyphSlotRec, */ 00123 /* you should call @FT_GlyphSlot_Own_Bitmap on the slot first. */ 00124 /* */ 00125 FT_EXPORT( FT_Error ) 00126 FT_Bitmap_Embolden( FT_Library library, 00127 FT_Bitmap* bitmap, 00128 FT_Pos xStrength, 00129 FT_Pos yStrength ); 00130 00131 00132 /*************************************************************************/ 00133 /* */ 00134 /* <Function> */ 00135 /* FT_Bitmap_Convert */ 00136 /* */ 00137 /* <Description> */ 00138 /* Convert a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp to a */ 00139 /* bitmap object with depth 8bpp, making the number of used bytes per */ 00140 /* line (a.k.a. the `pitch') a multiple of `alignment'. */ 00141 /* */ 00142 /* <Input> */ 00143 /* library :: A handle to a library object. */ 00144 /* */ 00145 /* source :: The source bitmap. */ 00146 /* */ 00147 /* alignment :: The pitch of the bitmap is a multiple of this */ 00148 /* parameter. Common values are 1, 2, or 4. */ 00149 /* */ 00150 /* <Output> */ 00151 /* target :: The target bitmap. */ 00152 /* */ 00153 /* <Return> */ 00154 /* FreeType error code. 0~means success. */ 00155 /* */ 00156 /* <Note> */ 00157 /* It is possible to call @FT_Bitmap_Convert multiple times without */ 00158 /* calling @FT_Bitmap_Done (the memory is simply reallocated). */ 00159 /* */ 00160 /* Use @FT_Bitmap_Done to finally remove the bitmap object. */ 00161 /* */ 00162 /* The `library' argument is taken to have access to FreeType's */ 00163 /* memory handling functions. */ 00164 /* */ 00165 FT_EXPORT( FT_Error ) 00166 FT_Bitmap_Convert( FT_Library library, 00167 const FT_Bitmap *source, 00168 FT_Bitmap *target, 00169 FT_Int alignment ); 00170 00171 00172 /*************************************************************************/ 00173 /* */ 00174 /* <Function> */ 00175 /* FT_GlyphSlot_Own_Bitmap */ 00176 /* */ 00177 /* <Description> */ 00178 /* Make sure that a glyph slot owns `slot->bitmap'. */ 00179 /* */ 00180 /* <Input> */ 00181 /* slot :: The glyph slot. */ 00182 /* */ 00183 /* <Return> */ 00184 /* FreeType error code. 0~means success. */ 00185 /* */ 00186 /* <Note> */ 00187 /* This function is to be used in combination with */ 00188 /* @FT_Bitmap_Embolden. */ 00189 /* */ 00190 FT_EXPORT( FT_Error ) 00191 FT_GlyphSlot_Own_Bitmap( FT_GlyphSlot slot ); 00192 00193 00194 /*************************************************************************/ 00195 /* */ 00196 /* <Function> */ 00197 /* FT_Bitmap_Done */ 00198 /* */ 00199 /* <Description> */ 00200 /* Destroy a bitmap object created with @FT_Bitmap_New. */ 00201 /* */ 00202 /* <Input> */ 00203 /* library :: A handle to a library object. */ 00204 /* */ 00205 /* bitmap :: The bitmap object to be freed. */ 00206 /* */ 00207 /* <Return> */ 00208 /* FreeType error code. 0~means success. */ 00209 /* */ 00210 /* <Note> */ 00211 /* The `library' argument is taken to have access to FreeType's */ 00212 /* memory handling functions. */ 00213 /* */ 00214 FT_EXPORT( FT_Error ) 00215 FT_Bitmap_Done( FT_Library library, 00216 FT_Bitmap *bitmap ); 00217 00218 00219 /* */ 00220 00221 00222 FT_END_HEADER 00223 00224 #endif /* __FTBITMAP_H__ */ 00225 00226 00227 /* END */