public function test_fromAttributes() { $style = new Style(); $attributes = array("color" => "blue", "fill" => "#fff", "stroke" => "none"); $style->fromAttributes($attributes); $this->assertEquals(array(0, 0, 255), $style->color); $this->assertEquals(array(255, 255, 255), $style->fill); $this->assertEquals("none", $style->stroke); }
protected function before($attribs) { $surface = $this->document->getSurface(); $surface->save(); $style = new Style(); $style->inherit($this); $style->fromAttributes($attribs); $this->setStyle($style); $surface->setStyle($style); $this->applyTransform($attribs); }
/** * Make a style object from the tag and its attributes * * @param array $attributes * * @return Style */ protected function makeStyle($attributes) { $style = new Style(); $style->inherit($this); $style->fromStyleSheets($this, $attributes); $style->fromAttributes($attributes); return $style; }