21#include FT_TRIGONOMETRY_H
23#include FT_INTERNAL_MEMORY_H
24#include FT_INTERNAL_DEBUG_H
25#include FT_INTERNAL_OBJECTS_H
67#define FT_SMALL_CONIC_THRESHOLD ( FT_ANGLE_PI / 6 )
68#define FT_SMALL_CUBIC_THRESHOLD ( FT_ANGLE_PI / 8 )
72#define FT_IS_SMALL( x ) ( (x) > -FT_EPSILON && (x) < FT_EPSILON )
78 return x >= 0 ?
x : -
x;
167 base[3].x = (
a +
b ) / 2;
177 base[3].y = (
a +
b ) / 2;
200 FT_Int close1, close2, close3;
305#define FT_STROKE_TAG_BEGIN_END ( FT_STROKE_TAG_BEGIN | FT_STROKE_TAG_END )
330 if ( new_max > old_max )
336 while ( cur_max < new_max )
337 cur_max += ( cur_max >> 1 ) + 16;
343 border->max_points = cur_max;
380 for ( ; vec1 < vec2; vec1++, vec2-- )
397 for ( ; tag1 < tag2; tag1++, tag2-- )
455 border->movable = movable;
527#define FT_ARC_CUBIC_ANGLE ( FT_ANGLE_PI / 2 )
575 ( 0x10000L +
FT_Cos( theta ) ) * 3 );
674 if ( in_contour != 0 )
679 else if ( in_contour == 0 )
689 if ( in_contour != 0 )
695 *anum_points = num_points;
696 *anum_contours = num_contours;
766#define FT_SIDE_TO_ROTATE( s ) ( FT_ANGLE_PI2 - (s) * FT_ANGLE_PI )
805 return FT_THROW( Invalid_Library_Handle );
808 return FT_THROW( Invalid_Argument );
838 stroker->radius = radius;
839 stroker->line_cap = line_cap;
840 stroker->line_join = line_join;
841 stroker->miter_limit = miter_limit;
844 if ( stroker->miter_limit < 0x10000L )
845 stroker->miter_limit = 0x10000L;
849 stroker->line_join_saved = line_join;
881 stroker->library =
NULL;
907 stroker->angle_in +
rotate,
926 stroker->angle_in =
angle;
943 delta.
x += stroker->center.x + delta2.
x;
944 delta.
y += stroker->center.y + delta2.
y;
953 delta.
x += delta2.
x + stroker->center.x;
954 delta.
y += delta2.
y + stroker->center.y;
969 delta.
x += stroker->center.x;
970 delta.
y += stroker->center.y;
978 delta.
x += stroker->center.x;
979 delta.
y += stroker->center.y;
1005 theta =
FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2;
1010 if ( !
border->movable || line_length == 0 ||
1011 theta > 0x59C000 || theta < -0x59C000 )
1020 intersect =
FT_BOOL( min_length &&
1021 stroker->line_length >= min_length &&
1022 line_length >= min_length );
1028 stroker->angle_out +
rotate );
1029 delta.
x += stroker->center.x;
1030 delta.
y += stroker->center.y;
1037 phi = stroker->angle_in + theta;
1044 delta.
x += stroker->center.x;
1045 delta.
y += stroker->center.y;
1070 FT_Fixed sigma = 0, radius = stroker->radius;
1086 theta =
FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
1091 phi = stroker->angle_in;
1096 phi = stroker->angle_in + theta +
rotate;
1100 sigma =
FT_MulFix( stroker->miter_limit, thcos );
1103 if ( sigma < 0x10000L )
1107 if ( fixed_bevel ||
ft_pos_abs( theta ) > 57 )
1123 stroker->angle_out +
rotate );
1124 delta.
x += stroker->center.x;
1125 delta.
y += stroker->center.y;
1139 FT_MulFix( radius, stroker->miter_limit ),
1141 middle.
x += stroker->center.x;
1142 middle.
y += stroker->center.y;
1149 delta.
x += middle.
x;
1150 delta.
y += middle.
y;
1158 delta.
x += middle.
x;
1159 delta.
y += middle.
y;
1167 if ( line_length == 0 )
1171 stroker->angle_out +
rotate );
1173 delta.
x += stroker->center.x;
1174 delta.
y += stroker->center.y;
1189 delta.
x += stroker->center.x;
1190 delta.
y += stroker->center.y;
1198 if ( line_length == 0 )
1202 stroker->angle_out +
rotate );
1203 delta.
x += stroker->center.x;
1204 delta.
y += stroker->center.y;
1225 turn =
FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
1233 inside_side = ( turn < 0 );
1264 point.
x = stroker->center.x + delta.
x;
1265 point.
y = stroker->center.y + delta.
y;
1267 border = stroker->borders;
1272 point.
x = stroker->center.x - delta.
x;
1273 point.
y = stroker->center.y - delta.
y;
1280 stroker->subpath_angle = start_angle;
1281 stroker->first_point =
FALSE;
1282 stroker->subpath_line_length = line_length;
1303 if ( !stroker || !to )
1304 return FT_THROW( Invalid_Argument );
1306 delta.
x = to->x - stroker->center.x;
1307 delta.
y = to->y - stroker->center.y;
1310 if ( delta.
x == 0 && delta.
y == 0 )
1320 if ( stroker->first_point )
1332 stroker->angle_out =
angle;
1339 for (
border = stroker->borders, side = 1; side >= 0; side--,
border++ )
1356 stroker->angle_in =
angle;
1357 stroker->center = *to;
1358 stroker->line_length = line_length;
1379 if ( !stroker || !
control || !to )
1392 stroker->center = *to;
1399 arc[2] = stroker->center;
1401 while ( arc >= bez_stack )
1407 angle_in = angle_out = stroker->angle_in;
1412 if ( stroker->first_point )
1413 stroker->angle_in = angle_in;
1425 if ( stroker->first_point )
1429 stroker->angle_out = angle_in;
1438 stroker->center = arc[2];
1439 stroker->angle_out = angle_in;
1445 stroker->line_join = stroker->line_join_saved;
1462 phi = angle_in + theta;
1466 if ( stroker->handle_wide_strokes )
1467 alpha0 =
FT_Atan2( arc[0].
x - arc[2].
x, arc[0].
y - arc[2].
y );
1469 for (
border = stroker->borders, side = 0;
1485 if ( stroker->handle_wide_strokes )
1556 stroker->angle_in = angle_out;
1559 stroker->center = *to;
1581 if ( !stroker || !control1 || !control2 || !to )
1589 if (
FT_IS_SMALL( stroker->center.x - control1->x ) &&
1596 stroker->center = *to;
1604 arc[3] = stroker->center;
1606 while ( arc >= bez_stack )
1608 FT_Angle angle_in, angle_mid, angle_out;
1612 angle_in = angle_out = angle_mid = stroker->angle_in;
1616 &angle_mid, &angle_out ) )
1618 if ( stroker->first_point )
1619 stroker->angle_in = angle_in;
1631 if ( stroker->first_point )
1635 stroker->angle_out = angle_in;
1644 stroker->center = arc[3];
1645 stroker->angle_out = angle_in;
1651 stroker->line_join = stroker->line_join_saved;
1675 if ( stroker->handle_wide_strokes )
1676 alpha0 =
FT_Atan2( arc[0].
x - arc[3].
x, arc[0].
y - arc[3].
y );
1678 for (
border = stroker->borders, side = 0;
1686 ctrl1.
x += arc[2].
x;
1687 ctrl1.
y += arc[2].
y;
1690 ctrl2.
x += arc[1].
x;
1691 ctrl2.
y += arc[1].
y;
1698 if ( stroker->handle_wide_strokes )
1772 stroker->angle_in = angle_out;
1775 stroker->center = *to;
1789 if ( !stroker || !to )
1790 return FT_THROW( Invalid_Argument );
1796 stroker->first_point =
TRUE;
1797 stroker->center = *to;
1798 stroker->subpath_open =
open;
1805 stroker->handle_wide_strokes =
1807 ( stroker->subpath_open &&
1811 stroker->subpath_start = *to;
1813 stroker->angle_in = 0;
1832 if ( new_points > 0 )
1845 while ( src_point >=
left->points +
left->start )
1847 *dst_point = *src_point;
1848 *dst_tag = *src_tag;
1851 dst_tag[0] &= ~FT_STROKE_TAG_BEGIN_END;
1898 if ( stroker->subpath_open )
1916 stroker->center = stroker->subpath_start;
1933 if ( stroker->center.x != stroker->subpath_start.x ||
1934 stroker->center.y != stroker->subpath_start.y )
1942 stroker->angle_out = stroker->subpath_angle;
1944 stroker->angle_out );
1951 inside_side = ( turn < 0 );
1955 stroker->subpath_line_length );
1962 stroker->subpath_line_length );
1985 FT_UInt num_points = 0, num_contours = 0;
1989 if ( !stroker ||
border > 1 )
1996 &num_points, &num_contours );
1999 *anum_points = num_points;
2001 if ( anum_contours )
2002 *anum_contours = num_contours;
2015 FT_UInt count1, count2, num_points = 0;
2016 FT_UInt count3, count4, num_contours = 0;
2036 num_points = count1 + count3;
2037 num_contours = count2 + count4;
2041 *anum_points = num_points;
2043 if ( anum_contours )
2044 *anum_contours = num_contours;
2066 if ( sborder->
valid )
2110 return FT_THROW( Invalid_Outline );
2113 return FT_THROW( Invalid_Argument );
2137 v_control = v_start;
2145 goto Invalid_Outline;
2161 v_start.
x = ( v_start.
x + v_last.
x ) / 2;
2162 v_start.
y = ( v_start.
y + v_last.
y ) / 2;
2220 goto Invalid_Outline;
2222 v_middle.
x = ( v_control.
x +
vec.
x ) / 2;
2223 v_middle.
y = ( v_control.
y +
vec.
y ) / 2;
2243 goto Invalid_Outline;
2275 if ( !stroker->first_point )
2291 return FT_THROW( Invalid_Outline );
2327 FT_UInt num_points, num_contours;
2403 FT_UInt num_points, num_contours;
2420 &num_points, &num_contours );
_STLP_MOVE_TO_STD_NAMESPACE void rotate(_ForwardIter __first, _ForwardIter __middle, _ForwardIter __last)
void destroy(_Tp *__pointer)
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
FT_DivFix(FT_Long a, FT_Long b)
FT_MulDiv(FT_Long a, FT_Long b, FT_Long c)
FT_MulFix(FT_Long a, FT_Long b)
#define FT_CALLBACK_TABLE
#define FT_ASSERT(condition)
FT_Done_Glyph(FT_Glyph glyph)
FT_Glyph_Copy(FT_Glyph source, FT_Glyph *target)
struct FT_OutlineGlyphRec_ * FT_OutlineGlyph
typedefFT_BEGIN_HEADER struct FT_Glyph_Class_ FT_Glyph_Class
#define FT_CURVE_TAG_CUBIC
#define FT_CURVE_TAG_CONIC
#define FT_CURVE_TAG(flag)
FT_BEGIN_HEADER typedef signed long FT_Pos
#define FT_ARRAY_COPY(dest, source, count)
#define FT_RENEW_ARRAY(ptr, curcnt, newcnt)
FT_Outline_Check(FT_Outline *outline)
@ FT_ORIENTATION_TRUETYPE
FT_Outline_Get_Orientation(FT_Outline *outline)
enum FT_Orientation_ FT_Orientation
FT_Outline_New(FT_Library library, FT_UInt numPoints, FT_Int numContours, FT_Outline *anoutline)
FT_Outline_Done(FT_Library library, FT_Outline *outline)
FT_Stroker_Export(FT_Stroker stroker, FT_Outline *outline)
FT_Stroker_LineTo(FT_Stroker stroker, FT_Vector *to)
static void ft_conic_split(FT_Vector *base)
static void ft_stroke_border_reset(FT_StrokeBorder border)
FT_Stroker_Rewind(FT_Stroker stroker)
FT_Outline_GetInsideBorder(FT_Outline *outline)
#define FT_STROKE_TAG_BEGIN_END
static void ft_stroke_border_export(FT_StrokeBorder border, FT_Outline *outline)
static FT_Error ft_stroke_border_cubicto(FT_StrokeBorder border, FT_Vector *control1, FT_Vector *control2, FT_Vector *to)
FT_Stroker_GetBorderCounts(FT_Stroker stroker, FT_StrokerBorder border, FT_UInt *anum_points, FT_UInt *anum_contours)
#define FT_SIDE_TO_ROTATE(s)
static FT_Error ft_stroker_inside(FT_Stroker stroker, FT_Int side, FT_Fixed line_length)
FT_Stroker_GetCounts(FT_Stroker stroker, FT_UInt *anum_points, FT_UInt *anum_contours)
static FT_Bool ft_conic_is_small_enough(FT_Vector *base, FT_Angle *angle_in, FT_Angle *angle_out)
struct FT_StrokeBorderRec_ FT_StrokeBorderRec
static FT_Error ft_stroke_border_get_counts(FT_StrokeBorder border, FT_UInt *anum_points, FT_UInt *anum_contours)
FT_CALLBACK_TABLE const FT_Glyph_Class ft_outline_glyph_class
static FT_Error ft_stroker_arcto(FT_Stroker stroker, FT_Int side)
FT_Stroker_Done(FT_Stroker stroker)
static FT_Bool ft_cubic_is_small_enough(FT_Vector *base, FT_Angle *angle_in, FT_Angle *angle_mid, FT_Angle *angle_out)
static FT_Error ft_stroke_border_conicto(FT_StrokeBorder border, FT_Vector *control, FT_Vector *to)
static FT_Error ft_stroke_border_moveto(FT_StrokeBorder border, FT_Vector *to)
static void ft_cubic_split(FT_Vector *base)
static FT_Error ft_stroke_border_grow(FT_StrokeBorder border, FT_UInt new_points)
FT_Stroker_CubicTo(FT_Stroker stroker, FT_Vector *control1, FT_Vector *control2, FT_Vector *to)
FT_Outline_GetOutsideBorder(FT_Outline *outline)
static FT_Error ft_stroker_process_corner(FT_Stroker stroker, FT_Fixed line_length)
static FT_Angle ft_angle_mean(FT_Angle angle1, FT_Angle angle2)
FT_Stroker_New(FT_Library library, FT_Stroker *astroker)
FT_Stroker_BeginSubPath(FT_Stroker stroker, FT_Vector *to, FT_Bool open)
FT_Stroker_ConicTo(FT_Stroker stroker, FT_Vector *control, FT_Vector *to)
FT_Stroker_EndSubPath(FT_Stroker stroker)
static FT_Error ft_stroker_cap(FT_Stroker stroker, FT_Angle angle, FT_Int side)
FT_Glyph_Stroke(FT_Glyph *pglyph, FT_Stroker stroker, FT_Bool destroy)
static FT_Error ft_stroker_outside(FT_Stroker stroker, FT_Int side, FT_Fixed line_length)
FT_Stroker_ParseOutline(FT_Stroker stroker, FT_Outline *outline, FT_Bool opened)
static void ft_stroke_border_close(FT_StrokeBorder border, FT_Bool reverse)
static FT_Error ft_stroke_border_arcto(FT_StrokeBorder border, FT_Vector *center, FT_Fixed radius, FT_Angle angle_start, FT_Angle angle_diff)
#define FT_SMALL_CONIC_THRESHOLD
struct FT_StrokeBorderRec_ * FT_StrokeBorder
FT_Glyph_StrokeBorder(FT_Glyph *pglyph, FT_Stroker stroker, FT_Bool inside, FT_Bool destroy)
static FT_Error ft_stroke_border_lineto(FT_StrokeBorder border, FT_Vector *to, FT_Bool movable)
struct FT_StrokerRec_ FT_StrokerRec
static void ft_stroke_border_done(FT_StrokeBorder border)
#define FT_SMALL_CUBIC_THRESHOLD
enum FT_StrokeTags_ FT_StrokeTags
#define FT_ARC_CUBIC_ANGLE
static void ft_stroke_border_init(FT_StrokeBorder border, FT_Memory memory)
static FT_Error ft_stroker_add_reverse_left(FT_Stroker stroker, FT_Bool open)
static FT_Error ft_stroker_subpath_start(FT_Stroker stroker, FT_Angle start_angle, FT_Fixed line_length)
FT_Stroker_Set(FT_Stroker stroker, FT_Fixed radius, FT_Stroker_LineCap line_cap, FT_Stroker_LineJoin line_join, FT_Fixed miter_limit)
static FT_Pos ft_pos_abs(FT_Pos x)
FT_Stroker_ExportBorder(FT_Stroker stroker, FT_StrokerBorder border, FT_Outline *outline)
@ FT_STROKER_LINECAP_ROUND
@ FT_STROKER_LINECAP_BUTT
@ FT_STROKER_LINECAP_SQUARE
@ FT_STROKER_BORDER_RIGHT
enum FT_Stroker_LineCap_ FT_Stroker_LineCap
@ FT_STROKER_LINEJOIN_BEVEL
@ FT_STROKER_LINEJOIN_MITER_VARIABLE
@ FT_STROKER_LINEJOIN_ROUND
enum FT_StrokerBorder_ FT_StrokerBorder
typedefFT_BEGIN_HEADER struct FT_StrokerRec_ * FT_Stroker
enum FT_Stroker_LineJoin_ FT_Stroker_LineJoin
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
FT_Vector_From_Polar(FT_Vector *vec, FT_Fixed length, FT_Angle angle)
FT_BEGIN_HEADER typedef FT_Fixed FT_Angle
FT_Atan2(FT_Fixed x, FT_Fixed y)
FT_Vector_Length(FT_Vector *vec)
FT_Angle_Diff(FT_Angle angle1, FT_Angle angle2)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLint GLint GLsizei GLsizei GLsizei GLint border
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLint GLint GLint GLint GLint GLint y
GLboolean GLboolean GLboolean b
GLuint GLsizei GLsizei * length
GLboolean GLboolean GLboolean GLboolean a
static const struct update_accum a2
static CRYPT_DATA_BLOB b2[]
static char memory[1024 *256]
static unsigned __int64 next
const FT_Glyph_Class * clazz
FT_Bool handle_wide_strokes
FT_Stroker_LineCap line_cap
FT_Fixed subpath_line_length
FT_Stroker_LineJoin line_join
FT_StrokeBorderRec borders[2]
FT_Stroker_LineJoin line_join_saved
static void reverse(int *pidx, int cch)