Example #1
0
static void FillHorisont( wal::GC& gc, crect rect, unsigned a, unsigned b )
{
	if ( rect.IsEmpty() ) { return; }

	unsigned ar = a & 0xFF,    ag = ( a >> 8 ) & 0xFF, ab = ( a >> 16 ) & 0xFF,
	         br = b & 0xFF, bg = ( b >> 8 ) & 0xFF, bb = ( b >> 16 ) & 0xFF;

	int h = rect.Height();
	int x1 = rect.left, x2 = rect.right;

	if ( h <= 0 || x1 >= x2 ) { return; }

	for ( int i = 0; i < h; i++ )
	{
		unsigned color = ( MidAB( ar, br, i, h ) & 0xFF ) + ( ( MidAB( ag, bg, i, h ) & 0xFF ) << 8 ) + ( ( MidAB( ab, bb, i, h ) & 0xFF ) << 16 );
		gc.SetLine( color );
		gc.MoveTo( x1, rect.top + i );
		gc.LineTo( x2, rect.top + i );
	}

}