private void Update(Rect rect) { if (_bitmap == null || _tileSetRenderer == null) { return; } _bitmap.Lock(); Int32Rect sourceArea = new Int32Rect((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height); _bitmap.WritePixels(sourceArea, _tileSetRenderer.GetRectangle(sourceArea), sourceArea.Width * 4, sourceArea.X, sourceArea.Y); _bitmap.AddDirtyRect(sourceArea); _bitmap.Unlock(); }
private void UpdateTileBlock() { _tileBlockBitmap.Lock(); Int32Rect sourceRect = new Int32Rect((int)(BlockSelector.SelectedBlockValue % 16) * 16, (int)(BlockSelector.SelectedBlockValue / 16) * 16, 16, 16); Int32Rect destRect = new Int32Rect(0, 0, 16, 16); _tileBlockBitmap.WritePixels(destRect, _tileSetRenderer.GetRectangle(sourceRect), sourceRect.Width * 4, 0, 0); _tileBlockBitmap.AddDirtyRect(destRect); _tileBlockBitmap.Unlock(); }