(self, args)
PUT: Put a sprite on the screen.
PUT: Put a sprite on the screen.
PUT : Put a sprite on the screen .
def put_(self, args):
        """PUT: Put a sprite on the screen."""
        if self._mode.is_text_mode:
            raise error.BASICError(error.IFC)
        x0, y0 = (values.to_single(_arg).to_value() for _arg in islice(args, 2))
        array_name, operation_token = args
        array_name = self._memory.complete_name(array_name)
        operation_token = operation_token or tk.XOR
        if array_name not in self._memory.arrays:
            raise error.BASICError(error.IFC)
        elif array_name[-1:] == values.STR:
            raise error.BASICError(error.TYPE_MISMATCH)
        x0, y0 = self._get_window_physical(x0, y0)
        self._last_point = x0, y0
        packed_sprite = self._memory.arrays.view_full_buffer(array_name)
        sprite = self._mode.sprite_builder.unpack(packed_sprite)
        x1, y1 = x0 + sprite.width - 1, y0 + sprite.height - 1
        # the whole sprite must fit or it's IFC
        error.throw_if(not self.graph_view.contains(x0, y0))
        error.throw_if(not self.graph_view.contains(x1, y1))
        # apply the sprite to the screen
        if operation_token == tk.PSET:
            rect = sprite
        elif operation_token == tk.PRESET:
            rect = sprite ^ (2**self._mode.bitsperpixel - 1)
        elif operation_token == tk.AND:
            # we use in-place operations as we'll assign back anyway
            rect = operator.iand(self.graph_view[y0:y1+1, x0:x1+1], sprite)
        elif operation_token == tk.OR:
            rect = operator.ior(self.graph_view[y0:y1+1, x0:x1+1], sprite)
        elif operation_token == tk.XOR:
            rect = operator.ixor(self.graph_view[y0:y1+1, x0:x1+1], sprite)
        self.graph_view[y0:y1+1, x0:x1+1] = rect
def put_ ( self , args ) : if self . _mode . is_text_mode : raise error . BASICError ( error . IFC ) x0 , y0 = ( values . to_single ( _arg ) . to_value ( ) for _arg in islice ( args , 2 ) ) array_name , operation_token = args array_name = self . _memory . complete_name ( array_name ) operation_token = operation_token or tk . XOR if array_name not in self . _memory . arrays : raise error . BASICError ( error . IFC ) elif array_name [ - 1 : ] == values . STR : raise error . BASICError ( error . TYPE_MISMATCH ) x0 , y0 = self . _get_window_physical ( x0 , y0 ) self . _last_point = x0 , y0 packed_sprite = self . _memory . arrays . view_full_buffer ( array_name ) sprite = self . _mode . sprite_builder . unpack ( packed_sprite ) x1 , y1 = x0 + sprite . width - 1 , y0 + sprite . height - 1 # the whole sprite must fit or it's IFC error . throw_if ( not self . graph_view . contains ( x0 , y0 ) ) error . throw_if ( not self . graph_view . contains ( x1 , y1 ) ) # apply the sprite to the screen if operation_token == tk . PSET : rect = sprite elif operation_token == tk . PRESET : rect = sprite ^ ( 2 ** self . _mode . bitsperpixel - 1 ) elif operation_token == tk . AND : # we use in-place operations as we'll assign back anyway rect = operator . iand ( self . graph_view [ y0 : y1 + 1 , x0 : x1 + 1 ] , sprite ) elif operation_token == tk . OR : rect = operator . ior ( self . graph_view [ y0 : y1 + 1 , x0 : x1 + 1 ] , sprite ) elif operation_token == tk . XOR : rect = operator . ixor ( self . graph_view [ y0 : y1 + 1 , x0 : x1 + 1 ] , sprite ) self . graph_view [ y0 : y1 + 1 , x0 : x1 + 1 ] = rect