'\'In-place\' analog of Image.alpha_composite. Composites an image
onto this image.
:param im: image to composite over this one
:param dest: Optional 2 tuple (left, top) specifying the upper
left corner in this (destination) image.
:param source: Optional 2 (left, top) tuple for the upper left
corner in the overlay source image, or 4 tuple (left, top, right,
bottom) for the bounds of the source rectangle
Performance Note: Not currently implemented in-place in the core layer.'

def alpha_composite(self, im, dest=(0, 0), source=(0, 0)):

    if (not isinstance(source, tuple)):
        raise ValueError('Source    must    be    a    tuple')
    if (not isinstance(dest, tuple)):
        raise ValueError('Destination    must    be    a    tuple')
    if (not (len(source) in (2, 4))):
        raise ValueError('Source    must    be    a    2    or    4-tuple')
    if (not (len(dest) == 2)):
        raise ValueError('Destination    must    be    a    2-tuple')
    if (min(source) < 0):
        raise ValueError('Source    must    be    non-negative')
    if (min(dest) < 0):
        raise ValueError('Destination    must    be    non-negative')
    if (len(source) == 2):
        source = (source + im.size)
    if (source == ((0, 0) + im.size)):
        overlay = im
    else:
        overlay = im.crop(source)
    box = (dest + ((dest[0] + overlay.width), (dest[1] + overlay.height)))
    if (dest == ((0, 0) + self.size)):
        background = self
    else:
        background = self.crop(box)
    result = alpha_composite(background, overlay)
    self.paste(result, box)
