Beispiel #1
0
UINT32 GBlend::Blend( double pRatio, PPOINT DPoints, PBYTE DTypes, INT32 DLength )
{
	Ratio		= (INT32) (pRatio*0x10000000) ;
	OPoints		= DPoints ;
	OTypes		= DTypes ;
	OLength		= DLength ;
	IPoints0	= S0Points ;
	ITypes0		= S0Types ;
	ILength0	= S0Length ;
	IPoints1	= S1Points ;
	ITypes1		= S1Types ;
	ILength1	= S1Length ;
	LPtr0		= LengthPtr0 ;
	LPtr1		= LengthPtr1 ;
	P00 = *IPoints0++ ; Type0 = *ITypes0++ ; ILength0-- ;
	P10 = *IPoints1++ ; Type1 = *ITypes1++ ; ILength1-- ;
	if ( !BlendPoint( PT_MOVETO, P00, P10 ) )
		return FALSE ;
	Length0 = 0 ; ReadPathStart0() ;
	Length1 = 0 ; ReadPathStart1() ;
	if ( Is1to1 )
	{
		if ( !BlendNtoN() )
			return 0 ;
	}
	else
	{
		if ( !BlendMtoN() )
			return 0 ;
	}
	return OTypes-DTypes ;
}
Beispiel #2
0
BOOL GBlend::Blend1to1()
{
    if ( IsCurve(Type0) || IsCurve(Type1) )
    {
        if ( IsntCurve(Type0) )
        {
            P01.x = (2*P00.x+P03.x)/3 ;
            P02.x = (P00.x+2*P03.x)/3 ;
            P01.y = (2*P00.y+P03.y)/3 ;
            P02.y = (P00.y+2*P03.y)/3 ;
        }
        if ( IsntCurve(Type1) )
        {
            P11.x = (2*P10.x+P13.x)/3 ;
            P12.x = (P10.x+2*P13.x)/3 ;
            P11.y = (2*P10.y+P13.y)/3 ;
            P12.y = (P10.y+2*P13.y)/3 ;
        }
        if ( !BlendCurve( P01,P02,P03, P11,P12,P13 ) )
            return FALSE ;
    }
    else if ( !BlendPoint( PT_LINETO, P03, P13 ) )
        return FALSE ;
    P00 = P03 ;
    ReadPath0() ;
    P10 = P13 ;
    ReadPath1() ;
    return TRUE ;
}
Beispiel #3
0
BOOL GBlend::BlendCurve( POINT P01,POINT P02,POINT P03, POINT P11,POINT P12,POINT P13 )
{
	return BlendPoint( PT_BEZIERTO, P01, P11 ) &&
		   BlendPoint( PT_BEZIERTO, P02, P12 ) &&
		   BlendPoint( PT_BEZIERTO, P03, P13 ) ;
}
Beispiel #4
0
BOOL GBlend::BlendMtoN()
{
	UINT32 t ;
	while ( IsntEnd(Type0) || IsntEnd(Type1) )
	{
		if ( LPtr1==EndLengthPtr1-1 )
			MatchLast( LPtr0, EndLengthPtr0, *LPtr1+Length1-Length0, Match0, Total0 ) ;
		else
			Match    ( LPtr0, EndLengthPtr0, *LPtr1+Length1-Length0, Match0, Total0 ) ;
		if ( LPtr0==EndLengthPtr0-1 )
			MatchLast( LPtr1, EndLengthPtr1, *LPtr0+Length0-Length1, Match1, Total1 ) ;
		else
			Match    ( LPtr1, EndLengthPtr1, *LPtr0+Length0-Length1, Match1, Total1 ) ;
		if ( abs(Match0)<abs(Match1) )
		{
			if ( Total0!=1 )
			{
				Match0 += *LPtr1+Length1-Length0 ;
				if ( IsntCurve(Type1) )
				{
					P11.x = (2*P10.x+P13.x)/3 ; P12.x = (P10.x+2*P13.x)/3 ;
					P11.y = (2*P10.y+P13.y)/3 ; P12.y = (P10.y+2*P13.y)/3 ;
				}
				for ( t=2 ; t<=Total0 ; t++ )
				{
					if ( IsCurve(Type0) || IsCurve(Type1) )
					{
						if ( IsntCurve(Type0) )
						{
							P01.x = (2*P00.x+P03.x)/3 ; P02.x = (P00.x+2*P03.x)/3 ;
							P01.y = (2*P00.y+P03.y)/3 ; P02.y = (P00.y+2*P03.y)/3 ;
						}
						Split( P10,P11,P12,P13, *LPtr0,Match0 ) ;
						if ( !BlendCurve( P01,P02,P03, L1,L2,M ) )
							return FALSE ;
						P10 = M ;
						P11 = R1 ;
						P12 = R2 ;
					}
					else
					{
						P10.x += MulDiv(P13.x-P10.x,*LPtr0,Match0) ;
						P10.y += MulDiv(P13.y-P10.y,*LPtr0,Match0) ;
						if ( !BlendPoint( PT_LINETO, P03, P10 ) )
							return FALSE ;
					}
					P00 = P03 ;
					Match0 -= *LPtr0 ;
					ReadPath0() ;
				}
			}
		}
		else
		{
			if ( Total1!=1 )
			{
				Match1 += *LPtr0+Length0-Length1 ;
				if ( IsntCurve(Type0) )
				{
					P01.x = (2*P00.x+P03.x)/3 ; P02.x = (P00.x+2*P03.x)/3 ;
					P01.y = (2*P00.y+P03.y)/3 ; P02.y = (P00.y+2*P03.y)/3 ;
				}
				for ( t=2 ; t<=Total1 ; t++ )
				{
					if ( IsCurve(Type0) || IsCurve(Type1) )
					{
						if ( IsntCurve(Type1) )
						{
							P11.x = (2*P10.x+P13.x)/3 ; P12.x = (P10.x+2*P13.x)/3 ;
							P11.y = (2*P10.y+P13.y)/3 ; P12.y = (P10.y+2*P13.y)/3 ;
						}
						Split( P00,P01,P02,P03, *LPtr1,Match1 ) ;
						if ( !BlendCurve( L1,L2,M, P11,P12,P13 ) )
							return FALSE ;
						P00 = M ;
						P01 = R1 ;
						P02 = R2 ;
					}
					else
					{
						P00.x += MulDiv(P03.x-P00.x,*LPtr1,Match1) ;
						P00.y += MulDiv(P03.y-P00.y,*LPtr1,Match1) ;
						if ( !BlendPoint( PT_LINETO, P00, P13 ) )
							return FALSE ;
					}
					P10 = P13 ;
					Match1 -= *LPtr1 ;
					ReadPath1()	;
				}
			}
		}
		if ( !Blend1to1() )
			return FALSE ;
	} /* while */
	return TRUE ;
}