#NEWLINE# def AffineRotate( theta , new_size , center = None , interpolate = BILINEAR ) : #NEWLINE# #INDENT# '\n    Create a rotation about the origin.\n    \n    @param theta: the angle to rotate the image in radians.\n    @param new_size: new size for the image.\n    @param interpolate: PIL interpolate to use.\n    ' #NEWLINE# matrix = array ( [ [ math . cos ( theta ) , ( - math . sin ( theta ) ) , 0 ] , [ math . sin ( theta ) , math . cos ( theta ) , 0 ] , [ 0 , 0 , 1 ] ] , 'd' ) #NEWLINE# rotate = AffineTransform ( matrix , new_size , interpolate ) #NEWLINE# if ( center == None ) : #NEWLINE# #INDENT# return rotate #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( ( AffineTranslate ( center . X ( ) , center . Y ( ) , new_size ) * rotate ) * AffineTranslate ( ( - center . X ( ) ) , ( - center . Y ( ) ) , new_size ) )