/** * @dataProvider fromHSLProvider **/ public function testFromHSL($aHSL, $aExpectedColor, $aExpectedDescription) { $oColor = new CSSColor(); $oColor->fromHSL($aHSL); $this->assertEquals($oColor->getColor(), $aExpectedColor); $this->assertEquals($oColor->getColorDescription(), $aExpectedDescription); }
function &create(&$root, &$pipeline) { $box = new ListItemBox($root, $pipeline); $box->readCSS($pipeline->getCurrentCSSState()); /** * Create text box containing item number */ $css_state =& $pipeline->getCurrentCSSState(); $css_state->pushState(); $css_state->setProperty(CSS_COLOR, CSSColor::parse('transparent')); $list_style = $css_state->getProperty(CSS_LIST_STYLE); $box->str_number_box = TextBox::create(CSSListStyleType::format_number($list_style->type, $css_state->getProperty(CSS_HTML2PS_LIST_COUNTER)) . ". ", 'iso-8859-1', $pipeline); $box->str_number_box->baseline = $box->str_number_box->default_baseline; $css_state->popState(); /** * Create nested items */ $box->create_content($root, $pipeline); return $box; }
function show(&$driver) { // If debugging mode is on, draw the box outline global $g_config; if ($g_config['debugbox']) { // Copy the border object of current box $driver->setlinewidth(0.1); $driver->setrgbcolor(0, 0, 0); $driver->rect($this->get_left(), $this->get_top(), $this->get_width(), -$this->get_height()); $driver->stroke(); } // Set current text color // Note that text color is used not only for text drawing (for example, list item markers // are drawn with text color) $color = $this->getCSSProperty(CSS_COLOR); # kornev, apply default color here if (!$color) { $color = CSSColor::default_value(); } $color->apply($driver); }
private function parseIdentifier($bAllowFunctions = false, $bAllowColors = false) { $sResult = $this->parseCharacter(true); if ($sResult === null) { throw new Exception("Identifier expected, got {$this->peek(5)}"); } $sCharacter; while (($sCharacter = $this->parseCharacter(true)) !== null) { $sResult .= $sCharacter; } if ($bAllowColors) { // is it a color name ? if ($aColor = CSSColorUtils::namedColor2rgb($sResult)) { $oColor = new CSSColor(); return $oColor->fromRGB($aColor); } } if ($bAllowFunctions && $this->comes('(')) { $this->consume('('); $sResult = new CSSFunction($sResult, $this->parseValue(array('=', ','))); $this->consume(')'); } return $sResult; }