public override void CopyFrom(IImageFloat sourceImage, RectangleInt sourceImageRect, int destXOffset, int destYOffset) { RectangleInt destRect = sourceImageRect; destRect.Offset(destXOffset, destYOffset); RectangleInt clippedSourceRect = new RectangleInt(); if (clippedSourceRect.IntersectRectangles(destRect, m_ClippingRect)) { // move it back relative to the source clippedSourceRect.Offset(-destXOffset, -destYOffset); base.CopyFrom(sourceImage, clippedSourceRect, destXOffset, destYOffset); } }
public void CopyFrom(IImageByte sourceImage, RectangleInt sourceImageRect, int destXOffset, int destYOffset) { RectangleInt sourceImageBounds = sourceImage.GetBounds(); RectangleInt clippedSourceImageRect = new RectangleInt(); if (clippedSourceImageRect.IntersectRectangles(sourceImageRect, sourceImageBounds)) { RectangleInt destImageRect = clippedSourceImageRect; destImageRect.Offset(destXOffset, destYOffset); RectangleInt destImageBounds = GetBounds(); RectangleInt clippedDestImageRect = new RectangleInt(); if (clippedDestImageRect.IntersectRectangles(destImageRect, destImageBounds)) { // we need to make sure the source is also clipped to the dest. So, we'll copy this back to source and offset it. clippedSourceImageRect = clippedDestImageRect; clippedSourceImageRect.Offset(-destXOffset, -destYOffset); CopyFromNoClipping(sourceImage, clippedSourceImageRect, destXOffset, destYOffset); } } }