52 #define FT_CONFIG_STANDARD_LIBRARY_H <stdlib.h> 63 #include FT_INTERNAL_CALC_H 159 #define RASTER_GRAY_LINES 2048 177 #define FT_COMPONENT trace_raster 183 #define FT_ERR_XCAT( x, y ) x ## y 184 #define FT_ERR_CAT( x, y ) FT_ERR_XCAT( x, y ) 190 #define FT_UNUSED( x ) (x) = (x) 195 #define FT_ERROR( x ) do { } while ( 0 ) 199 #define FT_TRACE( x ) do { } while ( 0 ) 200 #define FT_TRACE1( x ) do { } while ( 0 ) 201 #define FT_TRACE6( x ) do { } while ( 0 ) 205 #define FT_THROW( e ) FT_ERR_CAT( Raster_Err_, e ) 208 #define Raster_Err_None 0 209 #define Raster_Err_Not_Ini -1 210 #define Raster_Err_Overflow -2 211 #define Raster_Err_Neg_Height -3 212 #define Raster_Err_Invalid -4 213 #define Raster_Err_Unsupported -5 215 #define ft_memset memset 217 #define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, raster_new_, \ 218 raster_reset_, raster_set_mode_, \ 219 raster_render_, raster_done_ ) \ 220 const FT_Raster_Funcs class_ = \ 233 #include FT_INTERNAL_OBJECTS_H 234 #include FT_INTERNAL_DEBUG_H 238 #define Raster_Err_None FT_Err_Ok 239 #define Raster_Err_Not_Ini Raster_Err_Raster_Uninitialized 240 #define Raster_Err_Overflow Raster_Err_Raster_Overflow 241 #define Raster_Err_Neg_Height Raster_Err_Raster_Negative_Height 242 #define Raster_Err_Invalid Raster_Err_Invalid_Outline 243 #define Raster_Err_Unsupported Raster_Err_Cannot_Render_Glyph 250 #define FT_MEM_SET( d, s, c ) ft_memset( d, s, c ) 254 #define FT_MEM_ZERO( dest, count ) FT_MEM_SET( dest, 0, count ) 260 #define FMulDiv( a, b, c ) ( (a) * (b) / (c) ) 265 #define SMulDiv FT_MulDiv 266 #define SMulDiv_No_Round FT_MulDiv_No_Round 281 #define NULL (void*)0 319 typedef union Alignment_
328 typedef struct TPoint_
338 #define Overshoot_Top 0x10 339 #define Overshoot_Bottom 0x20 381 typedef struct black_TBand_
389 #define AlignProfileSize \ 390 ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( long ) ) 398 #ifdef FT_STATIC_RASTER 407 #define FT_UNUSED_RASTER do { } while ( 0 ) 413 #define RAS_ARGS black_PWorker worker, 414 #define RAS_ARG black_PWorker worker 416 #define RAS_VARS worker, 417 #define RAS_VAR worker 419 #define FT_UNUSED_RASTER FT_UNUSED( worker ) 450 #define FLOOR( x ) ( (x) & -ras.precision ) 451 #define CEILING( x ) ( ( (x) + ras.precision - 1 ) & -ras.precision ) 452 #define TRUNC( x ) ( (Long)(x) >> ras.precision_bits ) 453 #define FRAC( x ) ( (x) & ( ras.precision - 1 ) ) 454 #define SCALED( x ) ( ( (ULong)(x) << ras.scale_shift ) - ras.precision_half ) 456 #define IS_BOTTOM_OVERSHOOT( x ) ( CEILING( x ) - x >= ras.precision_half ) 457 #define IS_TOP_OVERSHOOT( x ) ( x - FLOOR( x ) >= ras.precision_half ) 463 struct black_TWorker_
470 Int precision_jitter;
539 #ifdef FT_RASTER_OPTION_ANTI_ALIASING 561 typedef struct black_TRaster_
572 #ifdef FT_STATIC_RASTER 579 #define ras (*worker) 584 #ifdef FT_RASTER_OPTION_ANTI_ALIASING 608 static const short count_table[256] =
610 0x0000, 0x0001, 0x0001, 0x0002, 0x0010, 0x0011, 0x0011, 0x0012,
611 0x0010, 0x0011, 0x0011, 0x0012, 0x0020, 0x0021, 0x0021, 0x0022,
612 0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112,
613 0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122,
614 0x0100, 0x0101, 0x0101, 0x0102, 0x0110, 0x0111, 0x0111, 0x0112,
615 0x0110, 0x0111, 0x0111, 0x0112, 0x0120, 0x0121, 0x0121, 0x0122,
616 0x0200, 0x0201, 0x0201, 0x0202, 0x0210, 0x0211, 0x0211, 0x0212,
617 0x0210, 0x0211, 0x0211, 0x0212, 0x0220, 0x0221, 0x0221, 0x0222,
618 0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012,
619 0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022,
620 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
621 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
622 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
623 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
624 0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212,
625 0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222,
626 0x1000, 0x1001, 0x1001, 0x1002, 0x1010, 0x1011, 0x1011, 0x1012,
627 0x1010, 0x1011, 0x1011, 0x1012, 0x1020, 0x1021, 0x1021, 0x1022,
628 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
629 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
630 0x1100, 0x1101, 0x1101, 0x1102, 0x1110, 0x1111, 0x1111, 0x1112,
631 0x1110, 0x1111, 0x1111, 0x1112, 0x1120, 0x1121, 0x1121, 0x1122,
632 0x1200, 0x1201, 0x1201, 0x1202, 0x1210, 0x1211, 0x1211, 0x1212,
633 0x1210, 0x1211, 0x1211, 0x1212, 0x1220, 0x1221, 0x1221, 0x1222,
634 0x2000, 0x2001, 0x2001, 0x2002, 0x2010, 0x2011, 0x2011, 0x2012,
635 0x2010, 0x2011, 0x2011, 0x2012, 0x2020, 0x2021, 0x2021, 0x2022,
636 0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112,
637 0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122,
638 0x2100, 0x2101, 0x2101, 0x2102, 0x2110, 0x2111, 0x2111, 0x2112,
639 0x2110, 0x2111, 0x2111, 0x2112, 0x2120, 0x2121, 0x2121, 0x2122,
640 0x2200, 0x2201, 0x2201, 0x2202, 0x2210, 0x2211, 0x2211, 0x2212,
641 0x2210, 0x2211, 0x2211, 0x2212, 0x2220, 0x2221, 0x2221, 0x2222
696 ras.precision_bits = 12;
697 ras.precision_step = 256;
698 ras.precision_jitter = 30;
702 ras.precision_bits = 6;
703 ras.precision_step = 32;
704 ras.precision_jitter = 2;
707 FT_TRACE6((
"Set_High_Precision(%s)\n", High ?
"true" :
"false" ));
709 ras.precision = 1 <<
ras.precision_bits;
710 ras.precision_half =
ras.precision / 2;
740 ras.fProfile =
ras.cProfile;
744 if (
ras.top >=
ras.maxBuff )
750 ras.cProfile->flags = 0;
751 ras.cProfile->start = 0;
752 ras.cProfile->height = 0;
753 ras.cProfile->offset =
ras.top;
756 ras.cProfile->flags =
ras.dropOutControl;
765 FT_TRACE6((
"New ascending profile = %p\n",
ras.cProfile ));
771 FT_TRACE6((
"New descending profile = %p\n",
ras.cProfile ));
775 FT_ERROR((
"New_Profile: invalid profile direction\n" ));
781 ras.gProfile =
ras.cProfile;
817 FT_ERROR((
"End_Profile: negative height encountered\n" ));
824 FT_TRACE6((
"Ending profile %p, start = %ld, height = %ld\n",
825 ras.cProfile,
ras.cProfile->start, h ));
827 ras.cProfile->height =
h;
836 oldProfile =
ras.cProfile;
841 ras.cProfile->height = 0;
842 ras.cProfile->offset =
ras.top;
844 oldProfile->next =
ras.cProfile;
848 if (
ras.top >=
ras.maxBuff )
850 FT_TRACE1((
"overflow in End_Profile\n" ));
883 n =
ras.numTurns - 1;
884 y_turns =
ras.sizeBuff -
ras.numTurns;
887 while ( n >= 0 && y < y_turns[n] )
891 if ( n >= 0 && y > y_turns[n] )
894 y2 = (
Int)y_turns[n];
903 if (
ras.maxBuff <=
ras.top )
909 ras.sizeBuff[-
ras.numTurns] =
y;
928 Finalize_Profile_Table(
RAS_ARG )
943 p->link = (
PProfile)( p->offset + p->height );
949 bottom = (
Int)p->start;
950 top = (
Int)( p->start + p->height - 1 );
954 bottom = (
Int)( p->start - p->height + 1 );
957 p->offset += p->height - 1;
960 if ( Insert_Y_Turn(
RAS_VARS bottom ) ||
992 Split_Conic(
TPoint* base )
997 base[4].x = base[2].x;
999 a = base[3].x = ( base[2].x +
b ) / 2;
1000 b = base[1].x = ( base[0].x +
b ) / 2;
1001 base[2].x = ( a +
b ) / 2;
1003 base[4].y = base[2].y;
1005 a = base[3].y = ( base[2].y +
b ) / 2;
1006 b = base[1].y = ( base[0].y +
b ) / 2;
1007 base[2].y = ( a +
b ) / 2;
1029 Split_Cubic(
TPoint* base )
1034 base[6].x = base[3].x;
1037 base[1].x = a = ( base[0].x + c + 1 ) >> 1;
1038 base[5].x = b = ( base[3].x + d + 1 ) >> 1;
1039 c = ( c + d + 1 ) >> 1;
1040 base[2].x = a = ( a + c + 1 ) >> 1;
1041 base[4].x = b = ( b + c + 1 ) >> 1;
1042 base[3].x = ( a + b + 1 ) >> 1;
1044 base[6].y = base[3].y;
1047 base[1].y = a = ( base[0].y + c + 1 ) >> 1;
1048 base[5].y = b = ( base[3].y + d + 1 ) >> 1;
1049 c = ( c + d + 1 ) >> 1;
1050 base[2].y = a = ( a + c + 1 ) >> 1;
1051 base[4].y = b = ( b + c + 1 ) >> 1;
1052 base[3].y = ( a + b + 1 ) >> 1;
1099 if ( Dy <= 0 || y2 < miny || y1 > maxy )
1106 x1 +=
SMulDiv( Dx, miny - y1, Dy );
1145 ras.joint = (char)( f2 == 0 );
1149 ras.cProfile->start = e1;
1154 if (
ras.top + size >=
ras.maxBuff )
1163 Rx = (
ras.precision * Dx ) % Dy;
1169 Rx = (
ras.precision * -Dx ) % Dy;
1233 result = Line_Up(
RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );
1235 if ( fresh && !
ras.fresh )
1236 ras.cProfile->start = -
ras.cProfile->start;
1273 Long y1, y2, e, e2, e0;
1287 if ( y2 < miny || y1 > maxy )
1313 *top++ = arc[degree].x;
1328 if ( ( top +
TRUNC( e2 - e ) + 1 ) >=
ras.maxBuff )
1337 while ( arc >= start_arc && e <= e2 )
1346 if ( y2 - y1 >=
ras.precision_step )
1353 *top++ = arc[degree].x +
FMulDiv( arc[0].
x - arc[degree].
x,
1410 arc[0].y = -arc[0].y;
1411 arc[1].y = -arc[1].y;
1412 arc[2].y = -arc[2].y;
1414 arc[3].y = -arc[3].y;
1418 result = Bezier_Up(
RAS_VARS degree, splitter, -maxy, -miny );
1420 if ( fresh && !
ras.fresh )
1421 ras.cProfile->start = -
ras.cProfile->start;
1423 arc[0].y = -arc[0].y;
1453 switch (
ras.state )
1456 if ( y >
ras.lastY )
1464 if ( y <
ras.lastY )
1472 if ( y <
ras.lastY )
1482 if ( y >
ras.lastY )
1497 switch (
ras.state )
1551 Long y1, y2, y3, x3, ymin, ymax;
1556 ras.arc[2].x =
ras.lastX;
1557 ras.arc[2].y =
ras.lastY;
1583 if ( y2 < ymin || y2 > ymax )
1586 Split_Conic(
ras.arc );
1589 else if ( y1 == y3 )
1599 if (
ras.state != state_bez )
1611 if ( New_Profile(
RAS_VARS state_bez, o ) )
1622 if ( Bezier_Down(
RAS_VARS 2, Split_Conic,
ras.minY,
ras.maxY ) )
1626 }
while (
ras.arc >=
ras.arcs );
1673 Long y1, y2, y3, y4, x4, ymin1, ymax1, ymin2, ymax2;
1678 ras.arc[3].x =
ras.lastX;
1679 ras.arc[3].y =
ras.lastY;
1719 if ( ymin2 < ymin1 || ymax2 > ymax1 )
1722 Split_Cubic(
ras.arc );
1725 else if ( y1 == y4 )
1735 if (
ras.state != state_bez )
1746 if ( New_Profile(
RAS_VARS state_bez, o ) )
1757 if ( Bezier_Down(
RAS_VARS 3, Split_Cubic,
ras.minY,
ras.maxY ) )
1761 }
while (
ras.arc >=
ras.arcs );
1774 #define SWAP_( x, y ) do \ 1822 points =
ras.outline.points;
1823 limit = points + last;
1825 v_start.
x =
SCALED( points[first].
x );
1826 v_start.
y =
SCALED( points[first].
y );
1827 v_last.
x =
SCALED( points[last].x );
1828 v_last.
y =
SCALED( points[last].y );
1832 SWAP_( v_start.
x, v_start.
y );
1836 v_control = v_start;
1838 point = points +
first;
1843 ras.dropOutControl = (
Byte)tags[0] >> 5;
1849 goto Invalid_Outline;
1866 v_start.
x = ( v_start.
x + v_last.
x ) / 2;
1867 v_start.
y = ( v_start.
y + v_last.
y ) / 2;
1875 ras.lastX = v_start.
x;
1876 ras.lastY = v_start.
y;
1878 while ( point < limit )
1903 v_control.
x =
SCALED( point[0].x );
1904 v_control.
y =
SCALED( point[0].y );
1907 SWAP_( v_control.
x, v_control.
y );
1910 if ( point < limit )
1920 x =
SCALED( point[0].x );
1921 y =
SCALED( point[0].y );
1928 if ( Conic_To(
RAS_VARS v_control.
x, v_control.
y, x, y ) )
1934 goto Invalid_Outline;
1936 v_middle.
x = ( v_control.
x +
x ) / 2;
1937 v_middle.
y = ( v_control.
y +
y ) / 2;
1939 if ( Conic_To(
RAS_VARS v_control.
x, v_control.
y,
1940 v_middle.
x, v_middle.
y ) )
1949 if ( Conic_To(
RAS_VARS v_control.
x, v_control.
y,
1950 v_start.
x, v_start.
y ) )
1957 Long x1, y1, x2, y2, x3, y3;
1960 if ( point + 1 > limit ||
1962 goto Invalid_Outline;
1967 x1 =
SCALED( point[-2].x );
1968 y1 =
SCALED( point[-2].y );
1969 x2 =
SCALED( point[-1].x );
1970 y2 =
SCALED( point[-1].y );
1978 if ( point <= limit )
1980 x3 =
SCALED( point[0].x );
1981 y3 =
SCALED( point[0].y );
1986 if ( Cubic_To(
RAS_VARS x1, y1, x2, y2, x3, y3 ) )
1991 if ( Cubic_To(
RAS_VARS x1, y1, x2, y2, v_start.
x, v_start.
y ) )
1999 if ( Line_To(
RAS_VARS v_start.
x, v_start.
y ) )
2030 Convert_Glyph(
RAS_ARGS int flipped )
2047 ras.cProfile->offset =
ras.top;
2052 for ( i = 0; i <
ras.outline.n_contours; i++ )
2060 if ( Decompose_Curve(
RAS_VARS (
unsigned short)start,
2061 ras.outline.contours[i],
2065 start =
ras.outline.contours[
i] + 1;
2068 if (
FRAC(
ras.lastY ) == 0 &&
2071 if (
ras.gProfile &&
2078 lastProfile =
ras.cProfile;
2088 lastProfile->next =
ras.gProfile;
2091 if ( Finalize_Profile_Table(
RAS_VAR ) )
2142 old = ¤t->link;
2146 profile->link = current;
2169 if ( current == profile )
2171 *old = current->link;
2175 old = ¤t->link;
2202 current->X = *current->offset;
2203 current->offset += current->flags &
Flow_Up ? 1 : -1;
2205 current = current->link;
2215 next = current->link;
2219 if ( current->X <= next->X )
2221 old = ¤t->link;
2230 current->link = next->link;
2231 next->link = current;
2237 next = current->link;
2255 Long pitch =
ras.target.pitch;
2261 ras.traceOfs = -*
min * pitch;
2263 ras.traceOfs += (
ras.target.rows - 1 ) * pitch;
2291 if ( x2 - x1 -
ras.precision <=
ras.precision_jitter )
2296 if ( e2 >= 0 && e1 <
ras.bWidth )
2300 if ( e2 >=
ras.bWidth )
2301 e2 =
ras.bWidth - 1;
2303 c1 = (
Short)( e1 >> 3 );
2304 c2 = (
Short)( e2 >> 3 );
2306 f1 = (
Byte) ( 0xFF >> ( e1 & 7 ) );
2307 f2 = (
Byte) ~( 0x7F >> ( e2 & 7 ) );
2309 if (
ras.gray_min_x > c1 )
2310 ras.gray_min_x = (short)c1;
2311 if (
ras.gray_max_x < c2 )
2312 ras.gray_max_x = (short)c2;
2314 target =
ras.bTarget +
ras.traceOfs + c1;
2333 *target |= ( f1 & f2 );
2378 Int dropOutControl =
left->flags & 7;
2381 if ( e1 == e2 +
ras.precision )
2383 switch ( dropOutControl )
2390 pxl =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2423 if (
left->next == right &&
2424 left->height <= 0 &&
2426 x2 - x1 >=
ras.precision_half ) )
2430 if ( right->next ==
left &&
2433 x2 - x1 >=
ras.precision_half ) )
2436 if ( dropOutControl == 1 )
2439 pxl =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2451 else if (
TRUNC( pxl ) >=
ras.bWidth )
2455 e1 = pxl == e1 ? e2 : e1;
2459 c1 = (
Short)( e1 >> 3 );
2460 f1 = (
Short)( e1 & 7 );
2462 if ( e1 >= 0 && e1 <
ras.bWidth &&
2463 ras.bTarget[
ras.traceOfs + c1] & ( 0x80 >> f1 ) )
2472 if ( e1 >= 0 && e1 <
ras.bWidth )
2474 c1 = (
Short)( e1 >> 3 );
2475 f1 = (
Short)( e1 & 7 );
2477 if (
ras.gray_min_x > c1 )
2478 ras.gray_min_x = c1;
2479 if (
ras.gray_max_x < c1 )
2480 ras.gray_max_x = c1;
2482 ras.bTarget[
ras.traceOfs + c1] |= (char)( 0x80 >> f1 );
2488 Vertical_Sweep_Step(
RAS_ARG )
2490 ras.traceOfs +=
ras.traceIncr;
2529 if ( x2 - x1 <
ras.precision )
2536 bits =
ras.bTarget + (
y >> 3 );
2537 f1 = (
Byte)( 0x80 >> (
y & 7 ) );
2541 if ( e1 >= 0 && e1 <
ras.target.rows )
2546 p = bits - e1 *
ras.target.pitch;
2547 if (
ras.target.pitch > 0 )
2548 p += (
ras.target.rows - 1 ) *
ras.target.pitch;
2587 Int dropOutControl =
left->flags & 7;
2590 if ( e1 == e2 +
ras.precision )
2592 switch ( dropOutControl )
2599 pxl =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2607 if (
left->next == right &&
2608 left->height <= 0 &&
2610 x2 - x1 >=
ras.precision_half ) )
2614 if ( right->next ==
left &&
2617 x2 - x1 >=
ras.precision_half ) )
2620 if ( dropOutControl == 1 )
2623 pxl =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2635 else if (
TRUNC( pxl ) >=
ras.target.rows )
2639 e1 = pxl == e1 ? e2 : e1;
2643 bits =
ras.bTarget + (
y >> 3 );
2644 f1 = (
Byte)( 0x80 >> (
y & 7 ) );
2646 bits -= e1 *
ras.target.pitch;
2647 if (
ras.target.pitch > 0 )
2648 bits += (
ras.target.rows - 1 ) *
ras.target.pitch;
2651 e1 <
ras.target.rows &&
2659 bits =
ras.bTarget + (
y >> 3 );
2660 f1 = (
Byte)( 0x80 >> (
y & 7 ) );
2664 if ( e1 >= 0 && e1 <
ras.target.rows )
2666 bits -= e1 *
ras.target.pitch;
2667 if (
ras.target.pitch > 0 )
2668 bits += (
ras.target.rows - 1 ) *
ras.target.pitch;
2676 Horizontal_Sweep_Step(
RAS_ARG )
2683 #ifdef FT_RASTER_OPTION_ANTI_ALIASING 2706 Long pitch, byte_len;
2710 *max = ( *max + 3 ) & -2;
2713 pitch =
ras.target.pitch;
2716 ras.traceG = ( *
min / 2 ) * byte_len;
2720 ras.traceG += (
ras.target.rows - 1 ) * pitch;
2721 byte_len = -byte_len;
2730 Vertical_Gray_Sweep_Step(
RAS_ARG )
2733 PByte pix, bit, bit2;
2734 short*
count = (
short*)count_table;
2738 ras.traceOfs +=
ras.gray_width;
2740 if (
ras.traceOfs >
ras.gray_width )
2742 pix =
ras.gTarget +
ras.traceG +
ras.gray_min_x * 4;
2745 if (
ras.gray_max_x >= 0 )
2747 Long last_pixel =
ras.target.width - 1;
2748 Int last_cell = last_pixel >> 2;
2749 Int last_bit = last_pixel & 3;
2753 if (
ras.gray_max_x >= last_cell && last_bit != 3 )
2755 ras.gray_max_x = last_cell - 1;
2759 if (
ras.gray_min_x < 0 )
2762 bit =
ras.bTarget +
ras.gray_min_x;
2763 bit2 = bit +
ras.gray_width;
2765 c1 =
ras.gray_max_x -
ras.gray_min_x;
2769 c2 = count[*bit] + count[*bit2];
2773 pix[0] = grays[(c2 >> 12) & 0x000F];
2774 pix[1] = grays[(c2 >> 8 ) & 0x000F];
2775 pix[2] = grays[(c2 >> 4 ) & 0x000F];
2776 pix[3] = grays[ c2 & 0x000F];
2790 c2 = count[*bit] + count[*bit2];
2796 pix[2] = grays[(c2 >> 4 ) & 0x000F];
2798 pix[1] = grays[(c2 >> 8 ) & 0x000F];
2800 pix[0] = grays[(c2 >> 12) & 0x000F];
2810 ras.traceG +=
ras.traceIncr;
2812 ras.gray_min_x = 32000;
2813 ras.gray_max_x = -32000;
2854 Int dropOutControl =
left->flags & 7;
2857 if ( e1 == e2 +
ras.precision )
2859 switch ( dropOutControl )
2866 e1 =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2874 if (
left->next == right &&
left->height <= 0 )
2878 if ( right->next ==
left &&
left->start ==
y )
2881 if ( dropOutControl == 1 )
2884 e1 =
FLOOR( ( x1 + x2 - 1 ) / 2 +
ras.precision_half );
2898 if ( x2 - x1 >=
ras.precision_half )
2899 color =
ras.grays[2];
2901 color =
ras.grays[1];
2903 e1 =
TRUNC( e1 ) / 2;
2904 if ( e1 <
ras.target.rows )
2906 pixel =
ras.gTarget - e1 *
ras.target.pitch +
y / 2;
2907 if (
ras.target.pitch > 0 )
2908 pixel += (
ras.target.rows - 1 ) *
ras.target.pitch;
2910 if ( pixel[0] ==
ras.grays[0] )
2929 Short y, y_change, y_height;
2935 Long x1, x2, xs, e1, e2;
2943 Init_Linked( &waiting );
2945 Init_Linked( &draw_left );
2946 Init_Linked( &draw_right );
2958 bottom = (
Short)P->start;
2959 top = (
Short)( P->start + P->height - 1 );
2961 if ( min_Y > bottom )
2967 InsNew( &waiting, P );
2973 if (
ras.numTurns == 0 )
2989 P->countL = (
UShort)( P->start - min_Y );
2998 if (
ras.numTurns > 0 &&
2999 ras.sizeBuff[-
ras.numTurns] == min_Y )
3002 while (
ras.numTurns > 0 )
3011 P->countL -= y_height;
3012 if ( P->countL == 0 )
3014 DelOld( &waiting, P );
3017 InsNew( &draw_left, P );
3019 InsNew( &draw_right, P );
3028 Sort( &draw_right );
3031 y_height = (
Short)( y_change -
y );
3033 while ( y < y_change )
3040 P_Right = draw_right;
3057 if ( x2 - x1 <=
ras.precision &&
3058 e1 != x1 && e2 != x2 )
3060 if ( e1 > e2 || e2 == e1 +
ras.precision )
3062 Int dropOutControl = P_Left->flags & 7;
3065 if ( dropOutControl != 2 )
3081 ras.Proc_Sweep_Span(
RAS_VARS y, x1, x2, P_Left, P_Right );
3085 P_Left = P_Left->link;
3086 P_Right = P_Right->link;
3104 Sort( &draw_right );
3114 if ( P->height == 0 )
3115 DelOld( &draw_left, P );
3123 if ( P->height == 0 )
3124 DelOld( &draw_right, P );
3130 while ( y <= max_Y )
3141 P_Right = draw_right;
3145 if ( P_Left->countL )
3158 P_Left = P_Left->link;
3159 P_Right = P_Right->link;
3186 while (
ras.band_top >= 0 )
3195 if ( Convert_Glyph(
RAS_VARS flipped ) )
3208 i =
ras.band_stack[
ras.band_top].y_min;
3209 j =
ras.band_stack[
ras.band_top].y_max;
3211 k = (
Short)( ( i + j ) / 2 );
3213 if (
ras.band_top >= 7 || k < i )
3221 ras.band_stack[
ras.band_top + 1].y_min = k;
3222 ras.band_stack[
ras.band_top + 1].y_max = j;
3224 ras.band_stack[
ras.band_top].y_max = (
Short)( k - 1 );
3260 ras.scale_shift =
ras.precision_shift;
3263 ras.dropOutControl = 2;
3267 ras.dropOutControl = 4;
3269 ras.dropOutControl = 0;
3272 ras.dropOutControl += 1;
3279 ras.Proc_Sweep_Init = Vertical_Sweep_Init;
3280 ras.Proc_Sweep_Span = Vertical_Sweep_Span;
3281 ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
3282 ras.Proc_Sweep_Step = Vertical_Sweep_Step;
3285 ras.band_stack[0].y_min = 0;
3286 ras.band_stack[0].y_max = (short)(
ras.target.rows - 1 );
3288 ras.bWidth = (
unsigned short)
ras.target.width;
3295 if (
ras.second_pass &&
ras.dropOutControl != 2 )
3297 ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
3298 ras.Proc_Sweep_Span = Horizontal_Sweep_Span;
3299 ras.Proc_Sweep_Drop = Horizontal_Sweep_Drop;
3300 ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
3303 ras.band_stack[0].y_min = 0;
3304 ras.band_stack[0].y_max = (short)(
ras.target.width - 1 );
3314 #ifdef FT_RASTER_OPTION_ANTI_ALIASING 3336 ras.scale_shift =
ras.precision_shift + 1;
3339 ras.dropOutControl = 2;
3343 ras.dropOutControl = 4;
3345 ras.dropOutControl = 0;
3348 ras.dropOutControl += 1;
3356 ras.band_stack[0].y_min = 0;
3357 ras.band_stack[0].y_max = 2 *
ras.target.rows - 1;
3359 ras.bWidth =
ras.gray_width;
3360 pixel_width = 2 * ( (
ras.target.width + 3 ) >> 2 );
3362 if (
ras.bWidth > pixel_width )
3363 ras.bWidth = pixel_width;
3365 ras.bWidth =
ras.bWidth * 8;
3369 ras.Proc_Sweep_Init = Vertical_Gray_Sweep_Init;
3370 ras.Proc_Sweep_Span = Vertical_Sweep_Span;
3371 ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
3372 ras.Proc_Sweep_Step = Vertical_Gray_Sweep_Step;
3374 error = Render_Single_Pass(
RAS_VARS 0 );
3379 if (
ras.second_pass &&
ras.dropOutControl != 2 )
3381 ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
3382 ras.Proc_Sweep_Span = Horizontal_Gray_Sweep_Span;
3383 ras.Proc_Sweep_Drop = Horizontal_Gray_Sweep_Drop;
3384 ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
3387 ras.band_stack[0].y_min = 0;
3388 ras.band_stack[0].y_max =
ras.target.width * 2 - 1;
3390 error = Render_Single_Pass(
RAS_VARS 1 );
3414 #ifdef FT_RASTER_OPTION_ANTI_ALIASING 3419 for ( n = 0; n < 5; n++ )
3420 raster->grays[n] = n * 255 / 4;
3437 ft_black_new(
void* memory,
3445 FT_MEM_ZERO( &the_raster,
sizeof ( the_raster ) );
3446 ft_black_init( &the_raster );
3474 raster->memory = memory;
3475 ft_black_init( raster );
3504 if ( pool_base && pool_size >= (
long)
sizeof (
black_TWorker ) + 2048 )
3509 raster->buffer = pool_base + ( (
sizeof ( *worker ) + 7 ) & ~7 );
3510 raster->buffer_size = pool_base + pool_size - (
char*)raster->buffer;
3511 raster->worker = worker;
3515 raster->buffer =
NULL;
3516 raster->buffer_size = 0;
3517 raster->worker =
NULL;
3528 #ifdef FT_RASTER_OPTION_ANTI_ALIASING 3533 raster->grays[0] = palette[0];
3534 raster->grays[1] = palette[1];
3535 raster->grays[2] = palette[2];
3536 raster->grays[3] = palette[3];
3537 raster->grays[4] = palette[4];
3559 if ( !raster || !raster->buffer || !raster->buffer_size )
3576 worker = raster->worker;
3586 if ( !target_map->width || !target_map->rows )
3589 if ( !target_map->buffer )
3592 ras.outline = *outline;
3593 ras.target = *target_map;
3595 worker->buff = (
PLong) raster->buffer;
3596 worker->sizeBuff = worker->buff +
3598 #ifdef FT_RASTER_OPTION_ANTI_ALIASING 3599 worker->grays = raster->grays;
3600 worker->gray_width = raster->gray_width;
3602 FT_MEM_ZERO( worker->gray_lines, worker->gray_width * 2 );
png_infop png_charpp int png_charpp profile
GLint GLint GLsizei GLsizei height
#define FT_OUTLINE_SINGLE_PASS
for(n=1;n< outline->n_points;n++)
#define FT_Raster_Done_Func
union Alignment_ * PAlignment
GLboolean GLboolean GLboolean GLboolean a
GLsizei const GLfloat * points
struct black_TWorker_ black_TWorker
struct FT_RasterRec_ * FT_Raster
#define FT_CURVE_TAG_CUBIC
GLint GLint GLint GLint GLint GLint y
#define FT_Raster_Set_Mode_Func
#define FT_Raster_New_Func
#define RASTER_GRAY_LINES
CONFIGURATION MACROS.
#define FT_OUTLINE_IGNORE_DROPOUTS
#define Raster_Err_Overflow
struct black_TBand_ black_TBand
GLfloat GLfloat GLfloat GLfloat h
return FT_THROW(Missing_Property)
void Function_Sweep_Init(RAS_ARGS Short *min, Short *max)
#define FT_RASTER_FLAG_AA
GLint GLint GLint GLint GLint x
typedef void(APIENTRY *GLDEBUGPROCARB)(GLenum source
struct TProfile_ TProfile
GLboolean GLboolean GLboolean b
#define IS_BOTTOM_OVERSHOOT(x)
struct black_TRaster_ black_TRaster
#define FT_TRACE1(varformat)
#define FT_CURVE_TAG_HAS_SCANMODE
#define FT_ERROR(varformat)
union Alignment_ Alignment
GLenum GLint GLint * precision
#define FT_Raster_Render_Func
#define FT_OUTLINE_HIGH_PRECISION
float min(float a, float b)
#define FT_MEM_ZERO(dest, count)
void(* TSplitter)(TPoint *base)
void Function_Sweep_Span(RAS_ARGS Short y, FT_F26Dot6 x1, FT_F26Dot6 x2, PProfile left, PProfile right)
void Function_Sweep_Step(RAS_ARG)
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
#define FT_OUTLINE_INCLUDE_STUBS
#define FT_RASTER_FLAG_DIRECT
if(!abbox) return FT_THROW(Invalid_Argument)
#define FT_Raster_Reset_Func
#define FT_TRACE6(varformat)
GLenum const GLfloat * params
#define IS_TOP_OVERSHOOT(x)
GLdouble GLdouble GLdouble GLdouble top
int Int
SIMPLE TYPE DECLARATIONS.
struct black_TRaster_ * black_PRaster
#define FT_DEFINE_RASTER_FUNCS( class_, glyph_format_, raster_new_, raster_reset_, raster_set_mode_, raster_render_, raster_done_)
png_infop png_bytep png_size_t buffer_size
#define FT_OUTLINE_SMART_DROPOUTS
GLuint GLuint GLsizei count
#define FT_MAKE_TAG(_x1, _x2, _x3, _x4)
#define FT_CURVE_TAG_CONIC
#define FT_CURVE_TAG(flag)
FT_Module_Constructor FT_GLYPH_FORMAT_OUTLINE
struct black_TWorker_ * black_PWorker
Render_Gray_Glyph(RAS_ARG)