setGrid method
Sets the grid from a flat Uint8List and column count.
If grid is empty, the artifact is cleared.
Implementation
void setGrid(final Uint8List grid, final int cols) {
if (grid.isEmpty) {
clear();
return;
}
this.cols = cols;
// Create a deep copy of the grid
_matrix = Uint8List.fromList(grid);
}