/// <summary> /// Releases unmanaged and - optionally - managed resources /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> private void Dispose(Boolean disposing) { if (_disposed) { return; } LayerBitmap?.Dispose(); _disposed = true; }
/// <summary> /// Resizes this Layer so it matches the given dimensions, scaling with the given scaling method, and interpolating with the given interpolation mode. /// This method disposes of the current layer texture /// </summary> /// <param name="newWidth">The new width for this layer</param> /// <param name="newHeight">The new height for this layer</param> /// <param name="scalingMethod">The scaling method to use to match this layer to the new size</param> /// <param name="interpolationMode">The interpolation mode to use when drawing the new layer</param> public void Resize(int newWidth, int newHeight, PerFrameScalingMethod scalingMethod, InterpolationMode interpolationMode) { if (Width == newWidth && Height == newHeight) { return; } Bitmap newTexture = (Bitmap)ImageUtilities.Resize(LayerBitmap, newWidth, newHeight, scalingMethod, interpolationMode); // Texture replacement LayerBitmap.Dispose(); LayerBitmap = newTexture; }