protected override unsafe void ProcessFilter( UnmanagedImage sourceData, UnmanagedImage destinationData )
{
// get destination image size
int newWidth = destinationData.Width;
int newHeight = destinationData.Height;
int srcStride = sourceData.Stride;
int dstStride = destinationData.Stride;
int copySize = newWidth;
// do the job
byte* src = (byte*) sourceData.ImageData.ToPointer( );
byte* dst = (byte*) destinationData.ImageData.ToPointer( );
src += ( minY * srcStride );
if ( destinationData.PixelFormat == PixelFormat.Format8bppIndexed )
{
src += minX;
}
else
{
src += minX * 3;
copySize *= 3;
}
// copy image
for ( int y = 0; y < newHeight; y++ )
{
AForge.SystemTools.CopyUnmanagedMemory( dst, src, copySize );
dst += dstStride;
src += srcStride;
}
}
}