CImage.php
private function getBackgroundColor($img = null)
    {
        $img = isset($img) ? $img : $this->image;

        if ($this->bgColorDefault) {

            $red   = $this->bgColorDefault['red'];
            $green = $this->bgColorDefault['green'];
            $blue  = $this->bgColorDefault['blue'];
            $alpha = $this->bgColorDefault['alpha'];

            if ($alpha) {
                $color = imagecolorallocatealpha($img, $red, $green, $blue, $alpha);
            } else {
                $color = imagecolorallocate($img, $red, $green, $blue);
            }

            return $color;

        } else {
            return 0;
        }
    }
private function getBackgroundColor($img = null)
    {
        $img = isset($img) ? $img : $this->image;

        if ($this->bgColorDefault) {

            $red   = $this->bgColorDefault['red'];
            $green = $this->bgColorDefault['green'];
            $blue  = $this->bgColorDefault['blue'];
            $alpha = $this->bgColorDefault['alpha'];

            if ($alpha) {
                $color = imagecolorallocatealpha($img, $red, $green, $blue, $alpha);
            } else {
                $color = imagecolorallocate($img, $red, $green, $blue);
            }

            return $color;

        } else {
            return 0;
        }
    }
private function getBackgroundColor ( $ img = null ) { $ img = isset ( $ img ) ? $ img : $ this -> image ; if ( $ this -> bgColorDefault ) { $ red = $ this -> bgColorDefault [ 'red' ] ; $ green = $ this -> bgColorDefault [ 'green' ] ; $ blue = $ this -> bgColorDefault [ 'blue' ] ; $ alpha = $ this -> bgColorDefault [ 'alpha' ] ; if ( $ alpha ) { $ color = imagecolorallocatealpha ( $ img , $ red , $ green , $ blue , $ alpha ) ; } else { $ color = imagecolorallocate ( $ img , $ red , $ green , $ blue ) ; } return $ color ; } else { return 0 ; } }
Get the background color.

@param resource $img the image to work with or null if using $this->image.

@return color value or null if no background color is set.
Get the background color .