#NEWLINE# def parse( reader_parse_result ) : #NEWLINE# #INDENT# layer_and_mask_data = reader_parse_result . layer_and_mask_data #NEWLINE# new_layers = decode_layers ( layer_and_mask_data . layers ) #NEWLINE# new_global_mask_info = decode_global_mask_info ( layer_and_mask_data . global_mask_info ) #NEWLINE# new_tagged_blocks = tagged_blocks . decode ( layer_and_mask_data . tagged_blocks ) #NEWLINE# if ( new_layers . layer_count == 0 ) : #NEWLINE# #INDENT# blocks_dict = dict ( new_tagged_blocks ) #NEWLINE# if ( reader_parse_result . header . depth == 16 ) : #NEWLINE# #INDENT# new_layers = blocks_dict . get ( TaggedBlock . LAYER_16 , new_layers ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( reader_parse_result . header . depth == 32 ) : #NEWLINE# #INDENT# new_layers = blocks_dict . get ( TaggedBlock . LAYER_32 , new_layers ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# new_layer_and_mask_data = layer_and_mask_data . _replace ( layers = new_layers , global_mask_info = new_global_mask_info , tagged_blocks = new_tagged_blocks ) #NEWLINE# reader_parse_result = reader_parse_result . _replace ( image_resource_blocks = image_resources . decode ( reader_parse_result . image_resource_blocks ) , layer_and_mask_data = new_layer_and_mask_data ) #NEWLINE# return reader_parse_result