66#define FT_SMALL_CONIC_THRESHOLD ( FT_ANGLE_PI / 6 )
67#define FT_SMALL_CUBIC_THRESHOLD ( FT_ANGLE_PI / 8 )
71#define FT_IS_SMALL( x ) ( (x) > -FT_EPSILON && (x) < FT_EPSILON )
77 return x >= 0 ?
x : -
x;
91 base[2].x = (
a +
b ) >> 2;
98 base[2].y = (
a +
b ) >> 2;
170 base[3].x = (
a +
c ) >> 3;
182 base[3].y = (
a +
c ) >> 3;
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;
385 for ( ; vec1 < vec2; vec1++, vec2-- )
402 for ( ; tag1 < tag2; tag1++, tag2-- )
460 border->movable = movable;
532#define FT_ARC_CUBIC_ANGLE ( FT_ANGLE_PI / 2 )
554 coef =
FT_Tan( angle_diff / ( 4 * arcs ) );
567 for (
i = 1;
i <= arcs;
i++ )
571 angle_start +
i * angle_diff / arcs );
668 if ( in_contour != 0 )
673 else if ( in_contour == 0 )
683 if ( in_contour != 0 )
689 *anum_points = num_points;
690 *anum_contours = num_contours;
760#define FT_SIDE_TO_ROTATE( s ) ( FT_ANGLE_PI2 - (s) * FT_ANGLE_PI )
799 return FT_THROW( Invalid_Library_Handle );
802 return FT_THROW( Invalid_Argument );
832 stroker->radius = radius;
833 stroker->line_cap = line_cap;
834 stroker->line_join = line_join;
835 stroker->miter_limit = miter_limit;
838 if ( stroker->miter_limit < 0x10000L )
839 stroker->miter_limit = 0x10000L;
843 stroker->line_join_saved = line_join;
875 stroker->library =
NULL;
901 stroker->angle_in +
rotate,
920 stroker->angle_in =
angle;
935 delta.
x = side ? middle.
y : -middle.
y;
936 delta.
y = side ? -middle.
x : middle.
x;
940 middle.
x += stroker->center.x;
941 middle.
y += stroker->center.y;
945 middle.
x = stroker->center.x;
946 middle.
y = stroker->center.y;
957 delta.
x = middle.
x - delta.
x + middle.
x;
958 delta.
y = middle.
y - delta.
y + middle.
y;
984 theta =
FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2;
989 if ( !
border->movable || line_length == 0 ||
990 theta > 0x59C000 || theta < -0x59C000 )
1002 intersect =
FT_BOOL( min_length &&
1003 stroker->line_length >= min_length &&
1004 line_length >= min_length );
1010 stroker->angle_out +
rotate );
1011 delta.
x += stroker->center.x;
1012 delta.
y += stroker->center.y;
1019 phi = stroker->angle_in + theta +
rotate;
1024 delta.
x += stroker->center.x;
1025 delta.
y += stroker->center.y;
1067 theta =
FT_Angle_Diff( stroker->angle_in, stroker->angle_out ) / 2;
1072 phi = stroker->angle_in + theta +
rotate;
1077 if ( sigma.
x < 0x10000L )
1081 if ( fixed_bevel ||
ft_pos_abs( theta ) > 57 )
1097 stroker->angle_out +
rotate );
1098 delta.
x += stroker->center.x;
1099 delta.
y += stroker->center.y;
1113 FT_MulFix( radius, stroker->miter_limit ),
1120 middle.
x += stroker->center.x;
1121 middle.
y += stroker->center.y;
1122 delta.
x += middle.
x;
1123 delta.
y += middle.
y;
1130 delta.
x = middle.
x - delta.
x + middle.
x;
1131 delta.
y = middle.
y - delta.
y + middle.
y;
1139 if ( line_length == 0 )
1143 stroker->angle_out +
rotate );
1145 delta.
x += stroker->center.x;
1146 delta.
y += stroker->center.y;
1161 delta.
x += stroker->center.x;
1162 delta.
y += stroker->center.y;
1170 if ( line_length == 0 )
1174 stroker->angle_out +
rotate );
1175 delta.
x += stroker->center.x;
1176 delta.
y += stroker->center.y;
1197 turn =
FT_Angle_Diff( stroker->angle_in, stroker->angle_out );
1205 inside_side = ( turn < 0 );
1236 point.
x = stroker->center.x + delta.
x;
1237 point.
y = stroker->center.y + delta.
y;
1239 border = stroker->borders;
1244 point.
x = stroker->center.x - delta.
x;
1245 point.
y = stroker->center.y - delta.
y;
1252 stroker->subpath_angle = start_angle;
1253 stroker->first_point =
FALSE;
1254 stroker->subpath_line_length = line_length;
1275 if ( !stroker || !to )
1276 return FT_THROW( Invalid_Argument );
1278 delta.
x = to->x - stroker->center.x;
1279 delta.
y = to->y - stroker->center.y;
1282 if ( delta.
x == 0 && delta.
y == 0 )
1292 if ( stroker->first_point )
1304 stroker->angle_out =
angle;
1311 for (
border = stroker->borders, side = 1; side >= 0; side--,
border++ )
1328 stroker->angle_in =
angle;
1329 stroker->center = *to;
1330 stroker->line_length = line_length;
1351 if ( !stroker || !
control || !to )
1364 stroker->center = *to;
1371 arc[2] = stroker->center;
1373 while ( arc >= bez_stack )
1379 angle_in = angle_out = stroker->angle_in;
1384 if ( stroker->first_point )
1385 stroker->angle_in = angle_in;
1397 if ( stroker->first_point )
1401 stroker->angle_out = angle_in;
1410 stroker->center = arc[2];
1411 stroker->angle_out = angle_in;
1417 stroker->line_join = stroker->line_join_saved;
1434 phi = angle_in + theta;
1438 if ( stroker->handle_wide_strokes )
1439 alpha0 =
FT_Atan2( arc[0].
x - arc[2].
x, arc[0].
y - arc[2].
y );
1441 for (
border = stroker->borders, side = 0;
1457 if ( stroker->handle_wide_strokes )
1528 stroker->angle_in = angle_out;
1531 stroker->center = *to;
1553 if ( !stroker || !control1 || !control2 || !to )
1561 if (
FT_IS_SMALL( stroker->center.x - control1->x ) &&
1568 stroker->center = *to;
1576 arc[3] = stroker->center;
1578 while ( arc >= bez_stack )
1580 FT_Angle angle_in, angle_mid, angle_out;
1584 angle_in = angle_out = angle_mid = stroker->angle_in;
1588 &angle_mid, &angle_out ) )
1590 if ( stroker->first_point )
1591 stroker->angle_in = angle_in;
1603 if ( stroker->first_point )
1607 stroker->angle_out = angle_in;
1616 stroker->center = arc[3];
1617 stroker->angle_out = angle_in;
1623 stroker->line_join = stroker->line_join_saved;
1647 if ( stroker->handle_wide_strokes )
1648 alpha0 =
FT_Atan2( arc[0].
x - arc[3].
x, arc[0].
y - arc[3].
y );
1650 for (
border = stroker->borders, side = 0;
1658 ctrl1.
x += arc[2].
x;
1659 ctrl1.
y += arc[2].
y;
1662 ctrl2.
x += arc[1].
x;
1663 ctrl2.
y += arc[1].
y;
1670 if ( stroker->handle_wide_strokes )
1744 stroker->angle_in = angle_out;
1747 stroker->center = *to;
1761 if ( !stroker || !to )
1762 return FT_THROW( Invalid_Argument );
1768 stroker->first_point =
TRUE;
1769 stroker->center = *to;
1770 stroker->subpath_open =
open;
1777 stroker->handle_wide_strokes =
1779 ( stroker->subpath_open &&
1783 stroker->subpath_start = *to;
1785 stroker->angle_in = 0;
1804 if ( new_points > 0 )
1817 while ( src_point >=
left->points +
left->start )
1819 *dst_point = *src_point;
1820 *dst_tag = *src_tag;
1823 dst_tag[0] &= ~FT_STROKE_TAG_BEGIN_END;
1870 if ( stroker->subpath_open )
1888 stroker->center = stroker->subpath_start;
1905 if ( stroker->center.x != stroker->subpath_start.x ||
1906 stroker->center.y != stroker->subpath_start.y )
1914 stroker->angle_out = stroker->subpath_angle;
1916 stroker->angle_out );
1923 inside_side = ( turn < 0 );
1927 stroker->subpath_line_length );
1934 stroker->subpath_line_length );
1957 FT_UInt num_points = 0, num_contours = 0;
1961 if ( !stroker ||
border > 1 )
1968 &num_points, &num_contours );
1971 *anum_points = num_points;
1973 if ( anum_contours )
1974 *anum_contours = num_contours;
1987 FT_UInt count1, count2, num_points = 0;
1988 FT_UInt count3, count4, num_contours = 0;
2008 num_points = count1 + count3;
2009 num_contours = count2 + count4;
2013 *anum_points = num_points;
2015 if ( anum_contours )
2016 *anum_contours = num_contours;
2038 if ( sborder->
valid )
2082 return FT_THROW( Invalid_Outline );
2085 return FT_THROW( Invalid_Argument );
2109 v_control = v_start;
2117 goto Invalid_Outline;
2133 v_start.
x = ( v_start.
x + v_last.
x ) / 2;
2134 v_start.
y = ( v_start.
y + v_last.
y ) / 2;
2192 goto Invalid_Outline;
2194 v_middle.
x = ( v_control.
x +
vec.
x ) / 2;
2195 v_middle.
y = ( v_control.
y +
vec.
y ) / 2;
2215 goto Invalid_Outline;
2247 if ( !stroker->first_point )
2263 return FT_THROW( Invalid_Outline );
2299 FT_UInt num_points, num_contours;
2375 FT_UInt num_points, num_contours;
2392 &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_CALLBACK_TABLE
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_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_Vector_Unit(FT_Vector *vec, FT_Angle angle)
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
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
static const struct update_accum a1
static const struct update_accum a2
static const struct update_accum a3
static char memory[1024 *256]
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)