pub fn draw_self_masked(x: i16, y: i16, bitmap: *const u8, frame: u8)
Expand description

Draw a sprite using only the bits set to 1.

Parameters

  • x,y The coordinates of the top left pixel location.
  • bitmap A pointer to the array containing the image frames.
  • frame The frame number of the image to draw.

Bits set to 1 in the frame will be used to draw the sprite by setting the corresponding pixel in the buffer to 1. Bits set to 0 in the frame will remain unchanged in the buffer.

 image  before  after  (# = 1, - = 0)

 -----  -----   -----
 --#--  -----   --#--
 ##-##  -----   ##-##
 --#--  -----   --#--
 -----  -----   -----

 image  before  after

 -----  #####   #####  (no change because all pixels were
 --#--  #####   #####  already white)
 ##-##  #####   #####
 --#--  #####   #####
 -----  #####   #####