# Function arduboy_rust::sprites::draw_plus_mask

source ·

    pub fn draw_plus_mask(x: i16, y: i16, bitmap: *const u8, frame: u8)

Expand description

Draw a sprite using an array containing both image and mask values.

Parameters

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

An array containing combined image and mask data is used to draw a sprite. Bytes are given in pairs with the first byte representing the image pixels and the second byte specifying the corresponding mask. The width given in the array still specifies the image width, so each row of image and mask bytes will be twice the width value.

Bits set to 1 in the mask indicate that the pixel will be set to the value of the corresponding image bit. Bits set to 0 in the mask will be left unchanged.

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

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

     image  mask   before  after

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