#NEWLINE# def _fill_cropping( self , image_size , view_size ) : #NEWLINE# #INDENT# '\n        Return a (left, top, right, bottom) 4-tuple containing the cropping\n        values required to display an image of *image_size* in *view_size*\n        when stretched proportionately. Each value is a percentage expressed\n        as a fraction of 1.0, e.g. 0.425 represents 42.5%. *image_size* and\n        *view_size* are each (width, height) pairs.\n        ' #NEWLINE# def aspect_ratio( width , height ) : #NEWLINE# #INDENT# return ( width / height ) #NEWLINE# #UNINDENT# ar_view = aspect_ratio ( * view_size ) #NEWLINE# ar_image = aspect_ratio ( * image_size ) #NEWLINE# if ( ar_view < ar_image ) : #NEWLINE# #INDENT# crop = ( ( 1.0 - ( crop / ar_image ) ) / 2.0 ) #NEWLINE# return ( crop , 0.0 , crop , 0.0 ) #NEWLINE# #UNINDENT# if ( ar_view > ar_image ) : #NEWLINE# #INDENT# crop = ( ( 1.0 - ( ar_image / ar_view ) ) / 2.0 ) #NEWLINE# return ( 0.0 , crop , 0.0 , crop ) #NEWLINE# #UNINDENT# return ( 0.0 , 0.0 , 0.0 , 0.0 )