AForge.Imaging.Filters.BaseUsingCopyPartialFilter.Apply C# (CSharp) Метод

Apply() публичный Метод

Apply filter to an image in unmanaged memory.

The method keeps the source image unchanged and puts result of image processing into destination image.

The destination image must have the same width and height as source image. Also destination image must have pixel format, which is expected by particular filter (see FormatTranslations property for information about pixel format conversions).

Unsupported pixel format of the source image. Incorrect destination pixel format. Destination image has wrong width and/or height.
public Apply ( UnmanagedImage sourceImage, UnmanagedImage destinationImage ) : void
sourceImage UnmanagedImage Source image in unmanaged memory to apply filter to.
destinationImage UnmanagedImage Destination image in unmanaged memory to put result into.
Результат void
        public void Apply( UnmanagedImage sourceImage, UnmanagedImage destinationImage )
        {
            // check pixel format of the source and destination images
            CheckSourceFormat( sourceImage.PixelFormat );

            // ensure destination image has correct format
            if ( destinationImage.PixelFormat != FormatTranslations[sourceImage.PixelFormat] )
            {
                throw new InvalidImagePropertiesException( "Destination pixel format is specified incorrectly." );
            }

            // ensure destination image has correct size
            if ( ( destinationImage.Width != sourceImage.Width ) || ( destinationImage.Height != sourceImage.Height ) )
            {
                throw new InvalidImagePropertiesException( "Destination image must have the same width and height as source image." );
            }

            // process the filter
            ProcessFilter( sourceImage, destinationImage, new Rectangle( 0, 0, sourceImage.Width, sourceImage.Height ) );
        }

Same methods

BaseUsingCopyPartialFilter::Apply ( Bitmap image ) : Bitmap
BaseUsingCopyPartialFilter::Apply ( BitmapData imageData ) : Bitmap
BaseUsingCopyPartialFilter::Apply ( UnmanagedImage image ) : UnmanagedImage