modules/freetype2/include/ftrender.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

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 /* ftrender.h */
michael@0 4 /* */
michael@0 5 /* FreeType renderer modules public interface (specification). */
michael@0 6 /* */
michael@0 7 /* Copyright 1996-2001, 2005, 2006, 2010 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 __FTRENDER_H__
michael@0 20 #define __FTRENDER_H__
michael@0 21
michael@0 22
michael@0 23 #include <ft2build.h>
michael@0 24 #include FT_MODULE_H
michael@0 25 #include FT_GLYPH_H
michael@0 26
michael@0 27
michael@0 28 FT_BEGIN_HEADER
michael@0 29
michael@0 30
michael@0 31 /*************************************************************************/
michael@0 32 /* */
michael@0 33 /* <Section> */
michael@0 34 /* module_management */
michael@0 35 /* */
michael@0 36 /*************************************************************************/
michael@0 37
michael@0 38
michael@0 39 /* create a new glyph object */
michael@0 40 typedef FT_Error
michael@0 41 (*FT_Glyph_InitFunc)( FT_Glyph glyph,
michael@0 42 FT_GlyphSlot slot );
michael@0 43
michael@0 44 /* destroys a given glyph object */
michael@0 45 typedef void
michael@0 46 (*FT_Glyph_DoneFunc)( FT_Glyph glyph );
michael@0 47
michael@0 48 typedef void
michael@0 49 (*FT_Glyph_TransformFunc)( FT_Glyph glyph,
michael@0 50 const FT_Matrix* matrix,
michael@0 51 const FT_Vector* delta );
michael@0 52
michael@0 53 typedef void
michael@0 54 (*FT_Glyph_GetBBoxFunc)( FT_Glyph glyph,
michael@0 55 FT_BBox* abbox );
michael@0 56
michael@0 57 typedef FT_Error
michael@0 58 (*FT_Glyph_CopyFunc)( FT_Glyph source,
michael@0 59 FT_Glyph target );
michael@0 60
michael@0 61 typedef FT_Error
michael@0 62 (*FT_Glyph_PrepareFunc)( FT_Glyph glyph,
michael@0 63 FT_GlyphSlot slot );
michael@0 64
michael@0 65 /* deprecated */
michael@0 66 #define FT_Glyph_Init_Func FT_Glyph_InitFunc
michael@0 67 #define FT_Glyph_Done_Func FT_Glyph_DoneFunc
michael@0 68 #define FT_Glyph_Transform_Func FT_Glyph_TransformFunc
michael@0 69 #define FT_Glyph_BBox_Func FT_Glyph_GetBBoxFunc
michael@0 70 #define FT_Glyph_Copy_Func FT_Glyph_CopyFunc
michael@0 71 #define FT_Glyph_Prepare_Func FT_Glyph_PrepareFunc
michael@0 72
michael@0 73
michael@0 74 struct FT_Glyph_Class_
michael@0 75 {
michael@0 76 FT_Long glyph_size;
michael@0 77 FT_Glyph_Format glyph_format;
michael@0 78 FT_Glyph_InitFunc glyph_init;
michael@0 79 FT_Glyph_DoneFunc glyph_done;
michael@0 80 FT_Glyph_CopyFunc glyph_copy;
michael@0 81 FT_Glyph_TransformFunc glyph_transform;
michael@0 82 FT_Glyph_GetBBoxFunc glyph_bbox;
michael@0 83 FT_Glyph_PrepareFunc glyph_prepare;
michael@0 84 };
michael@0 85
michael@0 86
michael@0 87 typedef FT_Error
michael@0 88 (*FT_Renderer_RenderFunc)( FT_Renderer renderer,
michael@0 89 FT_GlyphSlot slot,
michael@0 90 FT_UInt mode,
michael@0 91 const FT_Vector* origin );
michael@0 92
michael@0 93 typedef FT_Error
michael@0 94 (*FT_Renderer_TransformFunc)( FT_Renderer renderer,
michael@0 95 FT_GlyphSlot slot,
michael@0 96 const FT_Matrix* matrix,
michael@0 97 const FT_Vector* delta );
michael@0 98
michael@0 99
michael@0 100 typedef void
michael@0 101 (*FT_Renderer_GetCBoxFunc)( FT_Renderer renderer,
michael@0 102 FT_GlyphSlot slot,
michael@0 103 FT_BBox* cbox );
michael@0 104
michael@0 105
michael@0 106 typedef FT_Error
michael@0 107 (*FT_Renderer_SetModeFunc)( FT_Renderer renderer,
michael@0 108 FT_ULong mode_tag,
michael@0 109 FT_Pointer mode_ptr );
michael@0 110
michael@0 111 /* deprecated identifiers */
michael@0 112 #define FTRenderer_render FT_Renderer_RenderFunc
michael@0 113 #define FTRenderer_transform FT_Renderer_TransformFunc
michael@0 114 #define FTRenderer_getCBox FT_Renderer_GetCBoxFunc
michael@0 115 #define FTRenderer_setMode FT_Renderer_SetModeFunc
michael@0 116
michael@0 117
michael@0 118 /*************************************************************************/
michael@0 119 /* */
michael@0 120 /* <Struct> */
michael@0 121 /* FT_Renderer_Class */
michael@0 122 /* */
michael@0 123 /* <Description> */
michael@0 124 /* The renderer module class descriptor. */
michael@0 125 /* */
michael@0 126 /* <Fields> */
michael@0 127 /* root :: The root @FT_Module_Class fields. */
michael@0 128 /* */
michael@0 129 /* glyph_format :: The glyph image format this renderer handles. */
michael@0 130 /* */
michael@0 131 /* render_glyph :: A method used to render the image that is in a */
michael@0 132 /* given glyph slot into a bitmap. */
michael@0 133 /* */
michael@0 134 /* transform_glyph :: A method used to transform the image that is in */
michael@0 135 /* a given glyph slot. */
michael@0 136 /* */
michael@0 137 /* get_glyph_cbox :: A method used to access the glyph's cbox. */
michael@0 138 /* */
michael@0 139 /* set_mode :: A method used to pass additional parameters. */
michael@0 140 /* */
michael@0 141 /* raster_class :: For @FT_GLYPH_FORMAT_OUTLINE renderers only. */
michael@0 142 /* This is a pointer to its raster's class. */
michael@0 143 /* */
michael@0 144 typedef struct FT_Renderer_Class_
michael@0 145 {
michael@0 146 FT_Module_Class root;
michael@0 147
michael@0 148 FT_Glyph_Format glyph_format;
michael@0 149
michael@0 150 FT_Renderer_RenderFunc render_glyph;
michael@0 151 FT_Renderer_TransformFunc transform_glyph;
michael@0 152 FT_Renderer_GetCBoxFunc get_glyph_cbox;
michael@0 153 FT_Renderer_SetModeFunc set_mode;
michael@0 154
michael@0 155 FT_Raster_Funcs* raster_class;
michael@0 156
michael@0 157 } FT_Renderer_Class;
michael@0 158
michael@0 159
michael@0 160 /*************************************************************************/
michael@0 161 /* */
michael@0 162 /* <Function> */
michael@0 163 /* FT_Get_Renderer */
michael@0 164 /* */
michael@0 165 /* <Description> */
michael@0 166 /* Retrieve the current renderer for a given glyph format. */
michael@0 167 /* */
michael@0 168 /* <Input> */
michael@0 169 /* library :: A handle to the library object. */
michael@0 170 /* */
michael@0 171 /* format :: The glyph format. */
michael@0 172 /* */
michael@0 173 /* <Return> */
michael@0 174 /* A renderer handle. 0~if none found. */
michael@0 175 /* */
michael@0 176 /* <Note> */
michael@0 177 /* An error will be returned if a module already exists by that name, */
michael@0 178 /* or if the module requires a version of FreeType that is too great. */
michael@0 179 /* */
michael@0 180 /* To add a new renderer, simply use @FT_Add_Module. To retrieve a */
michael@0 181 /* renderer by its name, use @FT_Get_Module. */
michael@0 182 /* */
michael@0 183 FT_EXPORT( FT_Renderer )
michael@0 184 FT_Get_Renderer( FT_Library library,
michael@0 185 FT_Glyph_Format format );
michael@0 186
michael@0 187
michael@0 188 /*************************************************************************/
michael@0 189 /* */
michael@0 190 /* <Function> */
michael@0 191 /* FT_Set_Renderer */
michael@0 192 /* */
michael@0 193 /* <Description> */
michael@0 194 /* Set the current renderer to use, and set additional mode. */
michael@0 195 /* */
michael@0 196 /* <InOut> */
michael@0 197 /* library :: A handle to the library object. */
michael@0 198 /* */
michael@0 199 /* <Input> */
michael@0 200 /* renderer :: A handle to the renderer object. */
michael@0 201 /* */
michael@0 202 /* num_params :: The number of additional parameters. */
michael@0 203 /* */
michael@0 204 /* parameters :: Additional parameters. */
michael@0 205 /* */
michael@0 206 /* <Return> */
michael@0 207 /* FreeType error code. 0~means success. */
michael@0 208 /* */
michael@0 209 /* <Note> */
michael@0 210 /* In case of success, the renderer will be used to convert glyph */
michael@0 211 /* images in the renderer's known format into bitmaps. */
michael@0 212 /* */
michael@0 213 /* This doesn't change the current renderer for other formats. */
michael@0 214 /* */
michael@0 215 /* Currently, only the B/W renderer, if compiled with */
michael@0 216 /* FT_RASTER_OPTION_ANTI_ALIASING (providing a 5-levels */
michael@0 217 /* anti-aliasing mode; this option must be set directly in */
michael@0 218 /* `ftraster.c' and is undefined by default) accepts a single tag */
michael@0 219 /* `pal5' to set its gray palette as a character string with */
michael@0 220 /* 5~elements. Consequently, the third and fourth argument are zero */
michael@0 221 /* normally. */
michael@0 222 /* */
michael@0 223 FT_EXPORT( FT_Error )
michael@0 224 FT_Set_Renderer( FT_Library library,
michael@0 225 FT_Renderer renderer,
michael@0 226 FT_UInt num_params,
michael@0 227 FT_Parameter* parameters );
michael@0 228
michael@0 229
michael@0 230 /* */
michael@0 231
michael@0 232
michael@0 233 FT_END_HEADER
michael@0 234
michael@0 235 #endif /* __FTRENDER_H__ */
michael@0 236
michael@0 237
michael@0 238 /* END */

mercurial