public function setFromValue($rgb, $hasalpha = true)
    {
        $r = ($rgb >> 16) & 0xFF;
        $g = ($rgb >> 8) & 0xFF;
        $b = ($rgb >> 0) & 0xFF;
        if ($hasalpha) {
            $a = ($rgb >> 24) & 0xff;

            return $this->setRed($r)
                            ->setGreen($g)
                            ->setBlue($b)
                            ->setAlpha($a);
        }

        return $this->setRed($r)
                        ->setGreen($g)
                        ->setBlue($b);
    }