_TwoShorts _GiveStartEndVerColumn(short __diffX, bool __verRight, _TwoShorts __startX_EndX) { _TwoShorts __startEndVerColumns; if (__verRight) { __startEndVerColumns.short_1 = (short)(__startX_EndX.short_2 - __diffX + 1); // start ; +1 because of inclusive in condition __startEndVerColumns.short_2 = (short)(__startX_EndX.short_2 + 1); // end ; +1 because of exlusive in condition } else { __startEndVerColumns.short_1 = __startX_EndX.short_1; __startEndVerColumns.short_2 = (short)(__startX_EndX.short_1 + __diffX); // Over here is not need of +1 } return(__startEndVerColumns); }
/// <summary> /// First we deleting whole colums and then whole rows, or partly. /// </summary> /// <param name="__diffY"></param> /// <param name="__diffX"></param> /// <param name="__verRight">Adding on the right ?</param> /// <param name="__horDown">Adding at the bottom ?</param> void _DeleteOldTiles_V2(short __diffY, short __diffX, bool __verRight, bool __horDown) { _FourShorts __last_StartXY_EndXY = new _FourShorts(_lastStartX, _lastStartY, _lastEndX, _lastEndY); _TwoShorts __startEndVerColumns = new _TwoShorts(0, 0); if (__diffX != 0) { __startEndVerColumns = _GiveStartEndVerColumn(__diffX, __verRight, new _TwoShorts(__last_StartXY_EndXY.short_1, __last_StartXY_EndXY.short_3)); _DeleteTiles(__startEndVerColumns.short_1, __startEndVerColumns.short_2, _lastStartY, (short)(_lastEndY + 1)); } if (__diffY != 0) { _FourShorts __startEndHorColumns_And_StartEndHorRows = _GiveStartEndHorColumns_And_StartEndHorRows(__diffY, __diffX, __verRight, __horDown, __startEndVerColumns, __last_StartXY_EndXY); _DeleteTiles(__startEndHorColumns_And_StartEndHorRows.short_1, __startEndHorColumns_And_StartEndHorRows.short_2, __startEndHorColumns_And_StartEndHorRows.short_3, __startEndHorColumns_And_StartEndHorRows.short_4); } }
_FourShorts _GiveStartEndHorColumns_And_StartEndHorRows(short __diffY, short __diffX, bool __verRight, bool __horDown, _TwoShorts __startEndVerColumns, _FourShorts __startXY_EndXY) { _FourShorts __startEndHorColumns_And_StartEndHorRows = new _FourShorts(0, 0, 0, 0); if (__horDown) { if (__diffX != 0) { if (__verRight) { __startEndHorColumns_And_StartEndHorRows = new _FourShorts(__startXY_EndXY.short_1, __startEndVerColumns.short_1, // start, End Horizontal COLUMNS (short)(__startXY_EndXY.short_4 - __diffY + 1), (short)(__startXY_EndXY.short_4 + 1)); // start, End Horizontal ROWS } else { __startEndHorColumns_And_StartEndHorRows = new _FourShorts( (short)(__startEndVerColumns.short_2), (short)(__startXY_EndXY.short_3 + 1), (short)(__startXY_EndXY.short_4 - __diffY + 1), (short)(__startXY_EndXY.short_4 + 1)); } } else { __startEndHorColumns_And_StartEndHorRows = new _FourShorts( __startXY_EndXY.short_1, (short)(__startXY_EndXY.short_3 + 1), (short)(__startXY_EndXY.short_4 - __diffY + 1), (short)(__startXY_EndXY.short_4 + 1)); } } else { if (__diffX != 0) { if (__verRight) { __startEndHorColumns_And_StartEndHorRows = new _FourShorts(__startXY_EndXY.short_1, __startEndVerColumns.short_1, __startXY_EndXY.short_2, (short)(__startXY_EndXY.short_2 + __diffY)); } else { __startEndHorColumns_And_StartEndHorRows = new _FourShorts(__startEndVerColumns.short_2, (short)(__startXY_EndXY.short_3 + 1), __startXY_EndXY.short_2, (short)(__startXY_EndXY.short_2 + __diffY)); } } else { __startEndHorColumns_And_StartEndHorRows = new _FourShorts(__startXY_EndXY.short_1, (short)(__startXY_EndXY.short_3 + 1), __startXY_EndXY.short_2, (short)(__startXY_EndXY.short_2 + __diffY)); } } return(__startEndHorColumns_And_StartEndHorRows); }