34 m_outline( aOutline ),
91 return cubicTo( aControlPoint,
nullptr, aEndPoint, aCallbackData );
96 const FT_Vector* aSecondControlPoint,
const FT_Vector* aEndPoint,
101 std::vector<VECTOR2D> bezier;
103 bezier.push_back(
toVector2D( aFirstControlPoint ) );
105 if( aSecondControlPoint )
108 bezier.push_back(
toVector2D( aSecondControlPoint ) );
113 std::vector<VECTOR2D> result;
130 FT_Outline_Funcs callbacks;
132 callbacks.move_to =
moveTo;
133 callbacks.line_to =
lineTo;
139 FT_Error e = FT_Outline_Decompose( &
m_outline, &callbacks,
this );
145 c.m_Winding =
winding( c.m_Points );
158 if( aContour.size() < 2 )
168 size_t len = aContour.size();
170 for(
size_t i = 0; i < len - 1; i++ )
175 sum += ( ( p2.
x - p1.
x ) * ( p2.
y + p1.
y ) );
178 sum += ( ( aContour[0].x - aContour[len - 1].x ) * ( aContour[0].y + aContour[len - 1].y ) );
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
Bezier curves to polygon converter.
void GetPoly(std::vector< VECTOR2I > &aOutput, int aMaxError=10)
Convert a Bezier curve to a polygon.
void addContourPoint(const VECTOR2D &p)
OUTLINE_DECOMPOSER(FT_Outline &aOutline)
std::vector< CONTOUR > * m_contours
static int cubicTo(const FT_Vector *aFirstControlPoint, const FT_Vector *aSecondControlPoint, const FT_Vector *aEndPoint, void *aCallbackData)
static int moveTo(const FT_Vector *aEndPoint, void *aCallbackData)
bool OutlineToSegments(std::vector< CONTOUR > *aContours)
static int lineTo(const FT_Vector *aEndPoint, void *aCallbackData)
static int quadraticTo(const FT_Vector *aControlPoint, const FT_Vector *aEndPoint, void *aCallbackData)
int winding(const std::vector< VECTOR2D > &aContour) const
constexpr double GLYPH_SIZE_SCALER
static VECTOR2D toVector2D(const FT_Vector *aFreeTypeVector)
FT_Orientation m_Orientation
VECTOR2< double > VECTOR2D