#NEWLINE# def get_data( width , height , rgb_func ) : #NEWLINE# #INDENT# fw = float ( width ) #NEWLINE# fh = float ( height ) #NEWLINE# compressor = zlib . compressobj ( ) #NEWLINE# data = array . array ( 'B' ) #NEWLINE# for y in range ( height ) : #NEWLINE# #INDENT# data . append ( 0 ) #NEWLINE# fy = float ( y ) #NEWLINE# for x in range ( width ) : #NEWLINE# #INDENT# fx = float ( x ) #NEWLINE# data . extend ( [ min ( 255 , max ( 0 , int ( ( v * 255 ) ) ) ) for v in rgb_func ( ( fx / fw ) , ( fy / fh ) ) ] ) #NEWLINE# #UNINDENT# #UNINDENT# compressed = compressor . compress ( data . tostring ( ) ) #NEWLINE# flushed = compressor . flush ( ) #NEWLINE# return ( compressed + flushed )