コード例 #1
0
            /// <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;
            }
コード例 #2
0
            /// <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;
            }
コード例 #3
0
 /// <summary>
 /// Gets the hash code for this FrameLayer.
 /// The hash code is computed from the underlying layer bitmap
 /// </summary>
 /// <returns>The hash code for this FrameLayer</returns>
 public override int GetHashCode()
 {
     return((LayerBitmap?.GetHashCode() ?? 0) ^ (Index * 367));
 }