Calculate the offset of the first image over the second, and then check each pixel underneath the first image to see if the pixel below it is solid or not. If any pixels are over transparent pixels in image 2, or any pixels are over areas not overed by image 2 at all, then image 1 is not completely inside image 2.
; Calculate offset of Image 1 over Image 2: Xoff = I2x - I1x YOff = I2y - I1y ;Now, for each pixel in image 1, add that offset to its ;location to determine its location in image 2. LockBuffer ImageBuffer(Image1) LockBuffer ImageBuffer(Image2) Inside = True For Y = 0 to ImageHeight(Image1)-1 For X = 0 to ImageWidth(Image1)-1 ; Calculate the pixel in image 2 this pixel in image 1 is above: X2 = X + XOff Y2 = Y + YOff ; If the pixel lies within image 2: If (X2 >= 0) AND (X2 < ImageWidth(Image2)) AND (Y2 >= 0) AND (Y2 < ImageHeight(Image2)) ; Is this pixel of image1 opaque? If ReadPixelFast(Image1, X, Y) <> 0 ; Is this pixel of image2 transparent? If ReadPixelFast(Image2, X2, Y2) = 0 ; Pixel1 is outside Image2. Exit both loops! Inside = False Y = ImageHeight(Image1) X = InageWidth(Image1) else ; There are pixels from both images at this location, and both are opaque. endif else ; This pixel of image 1 is transparent, so it doesn't matter what is beneath it. endif Else ; Pixel is outside Image2. Exit both loops! Inside = False Y = ImageHeight(Image1) X = InageWidth(Image1) Endif next next UnlockBuffer ImageBuffer(Image1) UnlockBuffer ImageBuffer(Image2)