/// <inheritdoc/>
        public override Surface2D CreateSurface(Rectangle region)
        {
            Contract.EnsureNotDisposed(this, Disposed);

            if (region.Left < 0 || region.Top < 0 || region.Right > Width || region.Bottom > Height || region.Width <= 0 || region.Height <= 0)
            {
                throw new ArgumentOutOfRangeException("region");
            }

            var copysurf = new SDL2PlatformNativeSurface(region.Width, region.Height);

            var srcrect = new SDL_Rect()
            {
                x = region.X, y = region.Y, w = region.Width, h = region.Height
            };
            var dstrect = new SDL_Rect()
            {
                x = 0, y = 0, w = region.Width, h = region.Height
            };

            if (SDL_BlitSurface(nativesurf.NativePtr, &srcrect, copysurf.NativePtr, &dstrect) < 0)
            {
                throw new SDL2Exception();
            }

            var options = SrgbEncoded ? SurfaceOptions.SrgbColor : SurfaceOptions.LinearColor;
            var result  = new SDL2Surface2D(Ultraviolet, copysurf, options);

            return(result);
        }
        /// <summary>
        /// Processes the specified data structure into a game asset.
        /// </summary>
        /// <param name="manager">The content manager with which the asset is being processed.</param>
        /// <param name="metadata">The asset's metadata.</param>
        /// <param name="input">The input data structure to process.</param>
        /// <returns>The game asset that was created.</returns>
        public override Surface2D Process(ContentManager manager, IContentProcessorMetadata metadata, PlatformNativeSurface input)
        {
            var mdat        = metadata.As <SDL2Surface2DProcessorMetadata>();
            var srgbEncoded = mdat.SrgbEncoded ?? manager.Ultraviolet.Properties.SrgbDefaultForSurface2D;
            var surfOptions = srgbEncoded ? SurfaceOptions.SrgbColor : SurfaceOptions.LinearColor;

            var copy   = input.CreateCopy();
            var result = new SDL2Surface2D(manager.Ultraviolet, copy, surfOptions);

            return(result);
        }