21#include FT_TRIGONOMETRY_H
23#include FT_INTERNAL_MEMORY_H
24#include FT_INTERNAL_DEBUG_H
25#include FT_INTERNAL_OBJECTS_H
33#ifndef FT_CONFIG_OPTION_PIC
72#define FT_SMALL_CONIC_THRESHOLD ( FT_ANGLE_PI / 6 )
73#define FT_SMALL_CUBIC_THRESHOLD ( FT_ANGLE_PI / 8 )
77#define FT_IS_SMALL( x ) ( (x) > -FT_EPSILON && (x) < FT_EPSILON )
83 return x >= 0 ?
x : -
x;
103 base[2].y = (
a +
b ) / 2;
172 base[3].x = (
a +
b ) / 2;
182 base[3].y = (
a +
b ) / 2;
205 FT_Int close1, close2, close3;
310#define FT_STROKE_TAG_BEGIN_END ( FT_STROKE_TAG_BEGIN | FT_STROKE_TAG_END )
335 if ( new_max > old_max )
341 while ( cur_max < new_max )
342 cur_max += ( cur_max >> 1 ) + 16;
348 border->max_points = cur_max;
384 for ( ; vec1 < vec2; vec1++, vec2-- )
401 for ( ; tag1 < tag2; tag1++, tag2-- )
440 if (
border->num_points > 0 &&
459 border->movable = movable;
531#define FT_ARC_CUBIC_ANGLE ( FT_ANGLE_PI / 2 )
579 ( 0x10000L +
FT_Cos( theta ) ) * 3 );
678 if ( in_contour != 0 )
683 else if ( in_contour == 0 )
693 if ( in_contour != 0 )
699 *anum_points = num_points;
700 *anum_contours = num_contours;
770#define FT_SIDE_TO_ROTATE( s ) ( FT_ANGLE_PI2 - (s) * FT_ANGLE_PI )
809 return FT_THROW( Invalid_Library_Handle );
812 return FT_THROW( Invalid_Argument );
842 stroker->radius = radius;
843 stroker->line_cap = line_cap;
844 stroker->line_join = line_join;
845 stroker->miter_limit = miter_limit;
848 if ( stroker->miter_limit < 0x10000L )
849 stroker->miter_limit = 0x10000L;
853 stroker->line_join_saved = line_join;
885 stroker->library =
NULL;
911 stroker->angle_in +
rotate,
930 stroker->angle_in =
angle;
947 delta.
x += stroker->center.x + delta2.
x;
948 delta.
y += stroker->center.y + delta2.
y;
957 delta.
x += delta2.
x + stroker->center.x;
958 delta.
y += delta2.
y + stroker->center.y;
973 delta.
x += stroker->center.x;
974 delta.
y += stroker->center.y;
982 delta.
x += stroker->center.x;
983 delta.
y += stroker->center.y;
1009 theta =
FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2;
1014 if ( !
border->movable || line_length == 0 ||
1015 theta > 0x59C000 || theta < -0x59C000 )
1024 intersect =
FT_BOOL( min_length &&
1025 stroker->line_length >= min_length &&
1026 line_length >= min_length );
1032 stroker->angle_out +
rotate );
1033 delta.
x += stroker->center.x;
1034 delta.
y += stroker->center.y;
1041 phi = stroker->angle_in + theta;
1048 delta.
x += stroker->center.x;
1049 delta.
y += stroker->center.y;
1074 FT_Fixed sigma = 0, radius = stroker->radius;
1090 theta =
FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
1095 phi = stroker->angle_in;
1100 phi = stroker->angle_in + theta +
rotate;
1104 sigma =
FT_MulFix( stroker->miter_limit, thcos );
1107 if ( sigma < 0x10000L )
1111 if ( fixed_bevel ||
ft_pos_abs( theta ) > 57 )
1127 stroker->angle_out +
rotate );
1128 delta.
x += stroker->center.x;
1129 delta.
y += stroker->center.y;
1143 FT_MulFix( radius, stroker->miter_limit ),
1145 middle.
x += stroker->center.x;
1146 middle.
y += stroker->center.y;
1153 delta.
x += middle.
x;
1154 delta.
y += middle.
y;
1162 delta.
x += middle.
x;
1163 delta.
y += middle.
y;
1171 if ( line_length == 0 )
1175 stroker->angle_out +
rotate );
1177 delta.
x += stroker->center.x;
1178 delta.
y += stroker->center.y;
1193 delta.
x += stroker->center.x;
1194 delta.
y += stroker->center.y;
1202 if ( line_length == 0 )
1206 stroker->angle_out +
rotate );
1207 delta.
x += stroker->center.x;
1208 delta.
y += stroker->center.y;
1229 turn =
FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
1237 inside_side = ( turn < 0 );
1268 point.
x = stroker->center.x + delta.
x;
1269 point.
y = stroker->center.y + delta.
y;
1271 border = stroker->borders;
1276 point.
x = stroker->center.x - delta.
x;
1277 point.
y = stroker->center.y - delta.
y;
1284 stroker->subpath_angle = start_angle;
1285 stroker->first_point =
FALSE;
1286 stroker->subpath_line_length = line_length;
1307 if ( !stroker || !to )
1308 return FT_THROW( Invalid_Argument );
1310 delta.
x = to->x - stroker->center.x;
1311 delta.
y = to->y - stroker->center.y;
1314 if ( delta.
x == 0 && delta.
y == 0 )
1324 if ( stroker->first_point )
1336 stroker->angle_out =
angle;
1343 for (
border = stroker->borders, side = 1; side >= 0; side--,
border++ )
1360 stroker->angle_in =
angle;
1361 stroker->center = *to;
1362 stroker->line_length = line_length;
1383 if ( !stroker || !
control || !to )
1396 stroker->center = *to;
1403 arc[2] = stroker->center;
1405 while ( arc >= bez_stack )
1411 angle_in = angle_out = stroker->angle_in;
1416 if ( stroker->first_point )
1417 stroker->angle_in = angle_in;
1429 if ( stroker->first_point )
1433 stroker->angle_out = angle_in;
1442 stroker->center = arc[2];
1443 stroker->angle_out = angle_in;
1449 stroker->line_join = stroker->line_join_saved;
1466 phi = angle_in + theta;
1470 if ( stroker->handle_wide_strokes )
1471 alpha0 =
FT_Atan2( arc[0].
x - arc[2].
x, arc[0].
y - arc[2].
y );
1473 for (
border = stroker->borders, side = 0;
1489 if ( stroker->handle_wide_strokes )
1560 stroker->angle_in = angle_out;
1563 stroker->center = *to;
1585 if ( !stroker || !control1 || !control2 || !to )
1593 if (
FT_IS_SMALL( stroker->center.x - control1->x ) &&
1600 stroker->center = *to;
1608 arc[3] = stroker->center;
1610 while ( arc >= bez_stack )
1612 FT_Angle angle_in, angle_mid, angle_out;
1616 angle_in = angle_out = angle_mid = stroker->angle_in;
1620 &angle_mid, &angle_out ) )
1622 if ( stroker->first_point )
1623 stroker->angle_in = angle_in;
1635 if ( stroker->first_point )
1639 stroker->angle_out = angle_in;
1648 stroker->center = arc[3];
1649 stroker->angle_out = angle_in;
1655 stroker->line_join = stroker->line_join_saved;
1679 if ( stroker->handle_wide_strokes )
1680 alpha0 =
FT_Atan2( arc[0].
x - arc[3].
x, arc[0].
y - arc[3].
y );
1682 for (
border = stroker->borders, side = 0;
1690 ctrl1.
x += arc[2].
x;
1691 ctrl1.
y += arc[2].
y;
1694 ctrl2.
x += arc[1].
x;
1695 ctrl2.
y += arc[1].
y;
1702 if ( stroker->handle_wide_strokes )
1776 stroker->angle_in = angle_out;
1779 stroker->center = *to;
1793 if ( !stroker || !to )
1794 return FT_THROW( Invalid_Argument );
1800 stroker->first_point =
TRUE;
1801 stroker->center = *to;
1802 stroker->subpath_open =
open;
1809 stroker->handle_wide_strokes =
1811 ( stroker->subpath_open &&
1815 stroker->subpath_start = *to;
1817 stroker->angle_in = 0;
1836 if ( new_points > 0 )
1849 while ( src_point >=
left->points +
left->start )
1851 *dst_point = *src_point;
1852 *dst_tag = *src_tag;
1855 dst_tag[0] &= ~FT_STROKE_TAG_BEGIN_END;
1902 if ( stroker->subpath_open )
1920 stroker->center = stroker->subpath_start;
1937 if ( stroker->center.x != stroker->subpath_start.x ||
1938 stroker->center.y != stroker->subpath_start.y )
1946 stroker->angle_out = stroker->subpath_angle;
1948 stroker->angle_out );
1955 inside_side = ( turn < 0 );
1959 stroker->subpath_line_length );
1966 stroker->subpath_line_length );
1989 FT_UInt num_points = 0, num_contours = 0;
1993 if ( !stroker ||
border > 1 )
2000 &num_points, &num_contours );
2003 *anum_points = num_points;
2005 if ( anum_contours )
2006 *anum_contours = num_contours;
2019 FT_UInt count1, count2, num_points = 0;
2020 FT_UInt count3, count4, num_contours = 0;
2040 num_points = count1 + count3;
2041 num_contours = count2 + count4;
2045 *anum_points = num_points;
2047 if ( anum_contours )
2048 *anum_contours = num_contours;
2070 if ( sborder->
valid )
2114 return FT_THROW( Invalid_Outline );
2117 return FT_THROW( Invalid_Argument );
2141 v_control = v_start;
2149 goto Invalid_Outline;
2165 v_start.
x = ( v_start.
x + v_last.
x ) / 2;
2166 v_start.
y = ( v_start.
y + v_last.
y ) / 2;
2224 goto Invalid_Outline;
2226 v_middle.
x = ( v_control.
x +
vec.
x ) / 2;
2227 v_middle.
y = ( v_control.
y +
vec.
y ) / 2;
2247 goto Invalid_Outline;
2279 if ( !stroker->first_point )
2295 return FT_THROW( Invalid_Outline );
2336 FT_UInt num_points, num_contours;
2417 FT_UInt num_points, num_contours;
2434 &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)
#define FT_OUTLINE_GLYPH_CLASS_GET
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
GLint GLint GLint GLint GLint GLint y
GLuint GLuint GLsizei count
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)