public static function over($fore, $back) 
    {
        $foreA = ($fore & 0xff);
        $backA = ($back & 0xff);

        if ($foreA < 1) {
            return $back;
        } elseif ($foreA > 254 || $backA < 1) {
            return $fore;
        }

        // Source: 
        // https://en.wikipedia.org/wiki/Alpha_compositing#Description
        $forePA = $foreA * 255;
        $backPA = $backA * (255 - $foreA);
        $pa = ($forePA + $backPA);

        $b = (
            ($forePA * (($fore >> 8) & 0xff) + $backPA * (($back >> 8) & 0xff)) /
            $pa);

        $g = (
            ($forePA * (($fore >> 16) & 0xff) + $backPA * (($back >> 16) & 0xff)) /
            $pa);

        $r = (
            ($forePA * (($fore >> 24) & 0xff) + $backPA * (($back >> 24) & 0xff)) /
            $pa);

        $a = ($pa / 255);

        return ($r << 24) | ($g << 16) | ($b << 8) | $a;
    }
public static function over($fore, $back) 
    {
        $foreA = ($fore & 0xff);
        $backA = ($back & 0xff);

        if ($foreA < 1) {
            return $back;
        } elseif ($foreA > 254 || $backA < 1) {
            return $fore;
        }

        // Source: 
        // https://en.wikipedia.org/wiki/Alpha_compositing#Description
        $forePA = $foreA * 255;
        $backPA = $backA * (255 - $foreA);
        $pa = ($forePA + $backPA);

        $b = (
            ($forePA * (($fore >> 8) & 0xff) + $backPA * (($back >> 8) & 0xff)) /
            $pa);

        $g = (
            ($forePA * (($fore >> 16) & 0xff) + $backPA * (($back >> 16) & 0xff)) /
            $pa);

        $r = (
            ($forePA * (($fore >> 24) & 0xff) + $backPA * (($back >> 24) & 0xff)) /
            $pa);

        $a = ($pa / 255);

        return ($r << 24) | ($g << 16) | ($b << 8) | $a;
    }
public static function over ( $ fore , $ back ) { $ foreA = ( $ fore & 0xff ) ; $ backA = ( $ back & 0xff ) ; if ( $ foreA < 1 ) { return $ back ; } elseif ( $ foreA > 254 || $ backA < 1 ) { return $ fore ; } // Source:  // https://en.wikipedia.org/wiki/Alpha_compositing#Description $ forePA = $ foreA * 255 ; $ backPA = $ backA * ( 255 - $ foreA ) ; $ pa = ( $ forePA + $ backPA ) ; $ b = ( ( $ forePA * ( ( $ fore >> 8 ) & 0xff ) + $ backPA * ( ( $ back >> 8 ) & 0xff ) ) / $ pa ) ; $ g = ( ( $ forePA * ( ( $ fore >> 16 ) & 0xff ) + $ backPA * ( ( $ back >> 16 ) & 0xff ) ) / $ pa ) ; $ r = ( ( $ forePA * ( ( $ fore >> 24 ) & 0xff ) + $ backPA * ( ( $ back >> 24 ) & 0xff ) ) / $ pa ) ; $ a = ( $ pa / 255 ) ; return ( $ r << 24 ) | ( $ g << 16 ) | ( $ b << 8 ) | $ a ; }
Blends this color with another color using the over blending operation.

@param integer $fore  The foreground color.
@param integer $back  The background color.
@return integer
Blends this color with another color using the over blending operation .