createMask

Generate a mask from a region of tiles based on a condition.

For each tile in the grid, sets the corresponding element of mask to the result of fn(tile). If a coordinate is out of bounds (e.g. if you are generating a mask from a slice that extends over the map border) the mask value is the init value of the mask's element type.

void
createMask
(
alias fn
T
U
)
if (
__traits(compiles, )
)

Parameters

fn

function that generates a mask entry from a tile

grid
Type: T

grid to generate mask from

offset
Type: RowCol

map coord from which to start the top-left corner of the mask

mask
Type: U

rectangular array to populate with generated mask values. must match the size of the grid

Meta