1 2 // Copyright 2019 - 2021 Michael D. Parker 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 module bindbc.freetype.bind.ftstroke; 8 9 import bindbc.freetype.config; 10 import bindbc.freetype.bind.freetype, 11 bindbc.freetype.bind.ftimage, 12 bindbc.freetype.bind.ftglyph, 13 bindbc.freetype.bind.ftsystem, 14 bindbc.freetype.bind.fttypes; 15 16 struct FT_StrokerRec; 17 alias FT_Stroker = FT_StrokerRec*; 18 19 alias FT_Stroker_LineJoin = int; 20 enum { 21 FT_STROKER_LINEJOIN_ROUND = 0, 22 FT_STROKER_LINEJOIN_BEVEL = 1, 23 FT_STROKER_LINEJOIN_MITER_VARIABLE = 2, 24 FT_STROKER_LINEJOIN_MITER = FT_STROKER_LINEJOIN_MITER_VARIABLE, 25 FT_STROKER_LINEJOIN_MITER_FIXED = 3 26 } 27 28 alias FT_Stroker_LineCap = int; 29 enum { 30 FT_STROKER_LINECAP_BUTT = 0, 31 FT_STROKER_LINECAP_ROUND, 32 FT_STROKER_LINECAP_SQUARE 33 } 34 35 alias FT_StrokerBorder = int; 36 enum { 37 FT_STROKER_BORDER_LEFT = 0, 38 FT_STROKER_BORDER_RIGHT 39 } 40 41 static if(staticBinding) { 42 extern(C) @nogc nothrow { 43 FT_StrokerBorder FT_Outline_GetInsideBorder(FT_Outline* outline); 44 FT_StrokerBorder FT_Outline_GetOutsideBorder(FT_Outline* outline); 45 FT_Error FT_Stroker_New(FT_Library library, FT_Stroker* astroker); 46 void FT_Stroker_Set(FT_Stroker stroker, FT_Fixed radius, FT_Stroker_LineCap line_cap, FT_Stroker_LineJoin line_join, FT_Fixed miter_limit); 47 void FT_Stroker_Rewind(FT_Stroker stroker); 48 FT_Error FT_Stroker_ParseOutline(FT_Stroker stroker, FT_Outline* outline, FT_Bool opened); 49 FT_Error FT_Stroker_BeginSubPath(FT_Stroker stroker, FT_Vector* to, FT_Bool open); 50 FT_Error FT_Stroker_EndSubPath(FT_Stroker stroker); 51 FT_Error FT_Stroker_LineTo(FT_Stroker stroker, FT_Vector* to); 52 FT_Error FT_Stroker_ConicTo(FT_Stroker stroker, FT_Vector* control, FT_Vector* to); 53 FT_Error FT_Stroker_CubicTo(FT_Stroker stroker, FT_Vector* control1, FT_Vector* control2, FT_Vector* to); 54 FT_Error FT_Stroker_GetBorderCounts(FT_Stroker stroker, FT_StrokerBorder border, FT_UInt* anum_points, FT_UInt* anum_contours); 55 void FT_Stroker_ExportBorder(FT_Stroker stroker, FT_StrokerBorder border, FT_Outline* outline); 56 FT_Error FT_Stroker_GetCounts(FT_Stroker stroker, FT_UInt* anum_points, FT_UInt* anum_contours); 57 void FT_Stroker_Export(FT_Stroker stroker, FT_Outline* outline); 58 void FT_Stroker_Done(FT_Stroker stroker); 59 FT_Error FT_Glyph_Stroke(FT_Glyph* pglyph, FT_Stroker stroker, FT_Bool destroy); 60 FT_Error FT_Glyph_StrokeBorder(FT_Glyph* pglyph, FT_Stroker stroker, FT_Bool inside, FT_Bool destroy); 61 } 62 } 63 else { 64 extern(C) @nogc nothrow { 65 alias pFT_Outline_GetInsideBorder = FT_StrokerBorder function(FT_Outline* outline); 66 alias pFT_Outline_GetOutsideBorder = FT_StrokerBorder function(FT_Outline* outline); 67 alias pFT_Stroker_New = FT_Error function(FT_Library library, FT_Stroker* astroker); 68 alias pFT_Stroker_Set = void function(FT_Stroker stroker, FT_Fixed radius, FT_Stroker_LineCap line_cap, FT_Stroker_LineJoin line_join, FT_Fixed miter_limit); 69 alias pFT_Stroker_Rewind = void function(FT_Stroker stroker); 70 alias pFT_Stroker_ParseOutline = FT_Error function(FT_Stroker stroker, FT_Outline* outline, FT_Bool opened); 71 alias pFT_Stroker_BeginSubPath = FT_Error function(FT_Stroker stroker, FT_Vector* to, FT_Bool open); 72 alias pFT_Stroker_EndSubPath = FT_Error function(FT_Stroker stroker); 73 alias pFT_Stroker_LineTo = FT_Error function(FT_Stroker stroker, FT_Vector* to); 74 alias pFT_Stroker_ConicTo = FT_Error function(FT_Stroker stroker, FT_Vector* control, FT_Vector* to); 75 alias pFT_Stroker_CubicTo = FT_Error function(FT_Stroker stroker, FT_Vector* control1, FT_Vector* control2, FT_Vector* to); 76 alias pFT_Stroker_GetBorderCounts = FT_Error function(FT_Stroker stroker, FT_StrokerBorder border, FT_UInt* anum_points, FT_UInt* anum_contours); 77 alias pFT_Stroker_ExportBorder = void function(FT_Stroker stroker, FT_StrokerBorder border, FT_Outline* outline); 78 alias pFT_Stroker_GetCounts = FT_Error function(FT_Stroker stroker, FT_UInt* anum_points, FT_UInt* anum_contours); 79 alias pFT_Stroker_Export = void function(FT_Stroker stroker, FT_Outline* outline); 80 alias pFT_Stroker_Done = void function(FT_Stroker stroker); 81 alias pFT_Glyph_Stroke = FT_Error function(FT_Glyph* pglyph, FT_Stroker stroker, FT_Bool destroy); 82 alias pFT_Glyph_StrokeBorder = FT_Error function(FT_Glyph* pglyph, FT_Stroker stroker, FT_Bool inside, FT_Bool destroy); 83 } 84 85 __gshared { 86 pFT_Outline_GetInsideBorder FT_Outline_GetInsideBorder; 87 pFT_Outline_GetOutsideBorder FT_Outline_GetOutsideBorder; 88 pFT_Stroker_New FT_Stroker_New; 89 pFT_Stroker_Set FT_Stroker_Set; 90 pFT_Stroker_Rewind FT_Stroker_Rewind; 91 pFT_Stroker_ParseOutline FT_Stroker_ParseOutline; 92 pFT_Stroker_BeginSubPath FT_Stroker_BeginSubPath; 93 pFT_Stroker_EndSubPath FT_Stroker_EndSubPath; 94 pFT_Stroker_LineTo FT_Stroker_LineTo; 95 pFT_Stroker_ConicTo FT_Stroker_ConicTo; 96 pFT_Stroker_CubicTo FT_Stroker_CubicTo; 97 pFT_Stroker_GetBorderCounts FT_Stroker_GetBorderCounts; 98 pFT_Stroker_ExportBorder FT_Stroker_ExportBorder; 99 pFT_Stroker_GetCounts FT_Stroker_GetCounts; 100 pFT_Stroker_Export FT_Stroker_Export; 101 pFT_Stroker_Done FT_Stroker_Done; 102 pFT_Glyph_Stroke FT_Glyph_Stroke; 103 pFT_Glyph_StrokeBorder FT_Glyph_StrokeBorder; 104 } 105 }