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