public override void CopyFrom(IBitmapSrc sourceImage, Q1Rect sourceImageRect, int destXOffset, int destYOffset) { Q1Rect destRect = sourceImageRect.CreateNewFromOffset(destXOffset, destYOffset); if (Q1Rect.IntersectRectangles(destRect, _clippingRect, out Q1Rect clippedSourceRect)) { // move it back relative to the source base.CopyFrom(sourceImage, clippedSourceRect.CreateNewFromOffset(-destXOffset, -destYOffset), destXOffset, destYOffset); } }
public void CopyFrom(IBitmapSrc srcimg, Q1Rect srcImgRect, int destXOffset, int destYOffset) { if (Q1Rect.IntersectRectangles(srcimg.GetBounds(), srcImgRect, out Q1Rect clipped_srcRect)) { Q1Rect dstImgRect = clipped_srcRect.CreateNewFromOffset(destXOffset, destYOffset); if (Q1Rect.IntersectRectangles(dstImgRect, GetBounds(), out Q1Rect clipped_dstRect)) { // we need to make sure the source is also clipped to the dest. So, we'll copy this back to source and offset it. clipped_srcRect = clipped_dstRect.CreateNewFromOffset(-destXOffset, -destYOffset); CopyFromNoClipping(srcimg, clipped_srcRect, destXOffset, destYOffset); } } }
public override void CopyFrom(IBitmapSrc sourceImage, Q1Rect sourceImageRect, int destXOffset, int destYOffset) { Q1Rect destRect = sourceImageRect; destRect.Offset(destXOffset, destYOffset); Q1Rect clippedSourceRect = new Q1Rect(); if (clippedSourceRect.IntersectRectangles(destRect, _clippingRect)) { // move it back relative to the source clippedSourceRect.Offset(-destXOffset, -destYOffset); base.CopyFrom(sourceImage, clippedSourceRect, destXOffset, destYOffset); } }
public void CopyFrom(IBitmapSrc sourceImage, Q1Rect sourceImageRect, int destXOffset, int destYOffset) { Q1Rect sourceImageBounds = sourceImage.GetBounds(); Q1Rect clippedSourceImageRect = new Q1Rect(); if (clippedSourceImageRect.IntersectRectangles(sourceImageRect, sourceImageBounds)) { Q1Rect destImageRect = clippedSourceImageRect; destImageRect.Offset(destXOffset, destYOffset); Q1Rect destImageBounds = GetBounds(); Q1Rect clippedDestImageRect = new Q1Rect(); 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); } } }