#NEWLINE# def decode( self , file , filename ) : #NEWLINE# #INDENT# dataref = self . _get_data_ref ( file , filename ) #NEWLINE# importer = ComponentInstance ( ) #NEWLINE# quicktime . GetGraphicsImporterForDataRef ( dataref , PointerDataHandlerSubType , byref ( importer ) ) #NEWLINE# if ( not importer ) : #NEWLINE# #INDENT# raise ImageDecodeException ( ( filename or file ) ) #NEWLINE# #UNINDENT# rect = Rect ( ) #NEWLINE# quicktime . GraphicsImportGetNaturalBounds ( importer , byref ( rect ) ) #NEWLINE# width = rect . right #NEWLINE# height = rect . bottom #NEWLINE# ( format , qtformat ) = self . _get_formats ( ) #NEWLINE# buffer = ( c_byte * ( ( width * height ) * len ( format ) ) ) ( ) #NEWLINE# world = GWorldPtr ( ) #NEWLINE# quicktime . QTNewGWorldFromPtr ( byref ( world ) , qtformat , byref ( rect ) , c_void_p ( ) , c_void_p ( ) , 0 , buffer , ( len ( format ) * width ) ) #NEWLINE# flags = ( kGraphicsImporterDontUseColorMatching | kGraphicsImporterDontDoGammaCorrection ) #NEWLINE# quicktime . GraphicsImportSetFlags ( importer , flags ) #NEWLINE# quicktime . GraphicsImportSetGWorld ( importer , world , c_void_p ( ) ) #NEWLINE# result = quicktime . GraphicsImportDraw ( importer ) #NEWLINE# quicktime . DisposeGWorld ( world ) #NEWLINE# quicktime . CloseComponent ( importer ) #NEWLINE# if ( result != 0 ) : #NEWLINE# #INDENT# raise ImageDecodeException ( ( filename or file ) ) #NEWLINE# #UNINDENT# pitch = ( len ( format ) * width ) #NEWLINE# return ImageData ( width , height , format , buffer , ( - pitch ) )