comments back

This commit is contained in:
Ryan Oldenburg 2021-12-11 18:06:11 -06:00
parent 18a81b3d0e
commit 2c2e35bff5

View file

@ -45,9 +45,17 @@ template unsafe*(src: Mask): UnsafeMask =
UnsafeMask(mask: src)
template `[]`*(view: UnsafeMask, x, y: int): uint8 =
## Gets a value from (x, y) coordinates.
## * No bounds checking *
## Make sure that x, y are in bounds.
## Failure in the assumptions will case unsafe memory reads.
view.mask.data[view.mask.dataIndex(x, y)]
template `[]=`*(view: UnsafeMask, x, y: int, color: uint8) =
## Sets a value from (x, y) coordinates.
## * No bounds checking *
## Make sure that x, y are in bounds.
## Failure in the assumptions will case unsafe memory writes.
view.mask.data[view.mask.dataIndex(x, y)] = color
proc `[]`*(mask: Mask, x, y: int): uint8 {.inline, raises: [].} =