Raptors agree to trade Andrea Bargnani to Knicks