public function mergeAlpha(
        Image $srcImage,
        $dstX,
        $dstY,
        $alpha = 127
    ) {
        if (!is_resource($this->image) || !is_resource($srcImage->image)) {
            throw new \RuntimeException(
                'Attempt to merge image data using an invalid image resource.'
            );
        }

        $percent = 100 - min(max(round(($alpha / 127 * 100)), 1), 100);

        // copy images around
        @imagecopymerge(
            $this->image,
            $srcImage->image,
            (int)$dstX,
            (int)$dstY,
            0,
            0,
            $srcImage->width,
            $srcImage->height,
            $percent
        );

        return $this;
    }
public function mergeAlpha(
        Image $srcImage,
        $dstX,
        $dstY,
        $alpha = 127
    ) {
        if (!is_resource($this->image) || !is_resource($srcImage->image)) {
            throw new \RuntimeException(
                'Attempt to merge image data using an invalid image resource.'
            );
        }

        $percent = 100 - min(max(round(($alpha / 127 * 100)), 1), 100);

        // copy images around
        @imagecopymerge(
            $this->image,
            $srcImage->image,
            (int)$dstX,
            (int)$dstY,
            0,
            0,
            $srcImage->width,
            $srcImage->height,
            $percent
        );

        return $this;
    }
public function mergeAlpha ( Image $ srcImage , $ dstX , $ dstY , $ alpha = 127 ) { if ( ! is_resource ( $ this -> image ) || ! is_resource ( $ srcImage -> image ) ) { throw new \ RuntimeException ( 'Attempt to merge image data using an invalid image resource.' ) ; } $ percent = 100 - min ( max ( round ( ( $ alpha / 127 * 100 ) ) , 1 ) , 100 ) ; // copy images around @ imagecopymerge ( $ this -> image , $ srcImage -> image , ( int ) $ dstX , ( int ) $ dstY , 0 , 0 , $ srcImage -> width , $ srcImage -> height , $ percent ) ; return $ this ; }
Copies the given Image image stream into the image stream of the active
instance while applying the given alpha transparency.

This method does not support scaling.

@param Image $srcImage The source image.
@param int   $dstX     x-coordinate of destination point.
@param int   $dstY     y-coordinate of destination point.
@param int   $alpha    Alpha value (0-127)

@return $this

@throws \RuntimeException Thrown if $this->image or $srcImage->image is
not a valid image resource.
Copies the given Image image stream into the image stream of the active instance while applying the given alpha transparency .