//============================================================================================================ // public function //============================================================================================================ public Tex2DCanvas(Texture2D tex) { _tex = tex; _texRawData = _tex.GetRawTextureData(); _pixelByteCount = CanvasUtil.GetTextureFormatByteCount(_tex.format); _cells = new CanvasCell[_tex.width * _tex.height]; for (int x = 0; x < _tex.width; x++) { for (int y = 0; y < _tex.height; y++) { CanvasCell cell = CanvasCell.Create(this, x, y); _cells[y * _tex.width + x] = cell; cell.Init(); // test cell.SetDefaultData(); } } // test Flush(); }
public CanvasCell GetNeighborCell(CanvasCell centerCell, uint neighborID) { CanvasCell neighborCell = GetCellByPos(centerCell.position + CanvasUtil.GetDirByNeighborID(neighborID)); if (neighborCell == null) { return(CanvasCell.Universal); } return(neighborCell); }
public static byte Mirror(byte data) { byte result = data; for (int i = 0; i < 7; i++) { int start = i; int end = 7 - 1 - i; byte startBit = CanvasUtil.GetBitAtRightPosition(data, start); result = CanvasUtil.SetBitAtRightPosition(result, end, startBit); } return(result); }
private CanvasCell GetRelativeNeighborCell(uint cornerID, uint neighborID) { return(GetNeighborCell(CanvasUtil.GetRelativeNeighborID(cornerID, neighborID))); }
public static byte Rotate(byte data, uint cornerID) { return(CanvasUtil.ShiftRepeat(data, (int)cornerID * 2)); }