void ChangeColor( Random rand, Shape shape, TaskState task )
{
shape.PreviousState = shape.Clone() as Shape;
int delta = rand.NextByte( 1, (int)( MaxColorDelta + 1 ) ) * ( rand.Next( 2 ) == 0 ? 1 : -1 );
switch( rand.Next( 4 ) ) {
case 0:
shape.Color =
Color.FromArgb(
Math.Max( task.ProjectOptions.MinAlpha, Math.Min( 255, shape.Color.A + delta ) ),
shape.Color.R, shape.Color.G, shape.Color.B );
break;
case 1:
shape.Color = Color.FromArgb( shape.Color.A, Math.Max( 0, Math.Min( 255, shape.Color.R + delta ) ),
shape.Color.G, shape.Color.B );
break;
case 2:
shape.Color = Color.FromArgb( shape.Color.A, shape.Color.R,
Math.Max( 0, Math.Min( 255, shape.Color.G + delta ) ), shape.Color.B );
break;
case 3:
shape.Color = Color.FromArgb( shape.Color.A, shape.Color.R, shape.Color.G,
Math.Max( 0, Math.Min( 255, shape.Color.B + delta ) ) );
break;
}
}