Function arduboy_rust::arduboy2_library::sprites::draw_external_mask
source · pub fn draw_external_mask(
x: i16,
y: i16,
bitmap: *const u8,
mask: *const u8,
frame: u8,
mask_frame: u8
)
Expand description
Draw a sprite using a separate image and mask array.
Parameters
- x,y The coordinates of the top left pixel location.
- bitmap A pointer to the array containing the image frames.
- mask A pointer to the array containing the mask frames.
- frame The frame number of the image to draw.
- mask_frame The frame number for the mask to use (can be different from the image frame number).
An array containing the image frames, and another array containing corresponding mask frames, are used to draw a sprite.
For the mask array, the width and height are not included but must contain data of the same dimensions as the corresponding image array.
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
----- -###- ##### #---#
--#-- ##### ##### --#--
##-## ##### ##### ##-##
--#-- ##### ##### --#--
----- -###- ##### #---#