function drawBar($drawer, $p1, $p2) { // Draw shadow $this->barShadow->draw( $drawer, $p1, $p2, SHADOW_OUT ); if(abs($p2->y - $p1->y) > 1) { $this->barBorder->rectangle( $drawer, $p1, $p2 ); if($this->barBackground !== NULL) { $size = $this->barBorder->visible() ? 1 : 0; $b1 = $p1->move($size, $size); $b2 = $p2->move(-1 * $size, -1 * $size); // Draw background $drawer->filledRectangle( $this->barBackground, new awLine($b1, $b2) ); } } }
/** * Draw a component on the image * * @var &$component A component */ function drawComponent(&$component) { $shadow = $this->shadow->getSpace(); // Image shadow $border = $this->border->visible() ? 1 : 0; // Image border size $drawer = $this->drawer; $drawer->setImageSize($this->width - $shadow->left - $shadow->right - $border * 2, $this->height - $shadow->top - $shadow->bottom - $border * 2); // No absolute size specified if ($component->w === NULL and $component->h === NULL) { list($width, $height) = $drawer->setSize($component->width, $component->height); // Set component size in pixels $component->setAbsSize($width, $height); } else { $drawer->setAbsSize($component->w, $component->h); } if ($component->top !== NULL and $component->left !== NULL) { $drawer->setAbsPosition($border + $shadow->left + $component->left, $border + $shadow->top + $component->top); } else { $drawer->setPosition($component->x, $component->y); } $drawer->movePosition($border + $shadow->left, $border + $shadow->top); list($x1, $y1, $x2, $y2) = $component->getPosition(); $component->init($drawer); $component->drawComponent($drawer, $x1, $y1, $x2, $y2, $this->antiAliasing); $component->drawEnvelope($drawer, $x1, $y1, $x2, $y2); $component->finalize($drawer); }
protected function drawBar(awDrawer $drawer, awPoint $p1, awPoint $p2, $key) { // Draw shadow $this->barShadow->draw($drawer, $p1, $p2, awShadow::OUT); if (abs($p2->y - $p1->y) > 1) { $this->barBorder->rectangle($drawer, $p1, $p2); if ($this->barBackground !== NULL) { $size = $this->barBorder->visible() ? 1 : 0; $b1 = $p1->move($size, $size); $b2 = $p2->move(-1 * $size, -1 * $size); // Draw background $drawer->filledRectangle($this->arrayBarBackground[$key], new awLine($b1, $b2)); } } }
private function drawBase(awDriver $driver, awPoint $p, $width, $height) { $this->border->rectangle($driver, $p, $p->move($width, $height)); $size = $this->border->visible() ? 1 : 0; $driver->filledRectangle($this->background, new awLine($p->move($size, $size), $p->move($width - $size, $height - $size))); }
function drawRhombus($point) { list($x, $y) = $point->getLocation(); $rhombus = new awPolygon(); // Set default style and thickness $rhombus->setStyle(POLYGON_SOLID); $rhombus->setThickness(1); // Top of the rhombus $rhombus->append(new awPoint($x, $y - $this->size / 2)); // Right of the rhombus $rhombus->append(new awPoint($x + $this->size / 2, $y)); // Bottom of the rhombus $rhombus->append(new awPoint($x, $y + $this->size / 2)); // Left of the rhombus $rhombus->append(new awPoint($x - $this->size / 2, $y)); $this->driver->filledPolygon($this->fill, $rhombus); if ($this->border->visible()) { $this->border->polygon($this->driver, $rhombus); } }
protected function drawSquare(awPoint $point) { list($x, $y) = $point->getLocation(); $x1 = (int) ($x - $this->size / 2); $x2 = $x1 + $this->size; $y1 = (int) ($y - $this->size / 2); $y2 = $y1 + $this->size; $this->border->rectangle($this->drawer, new awPoint($x1, $y1), new awPoint($x2, $y2)); $size = $this->border->visible() ? 1 : 0; $this->drawer->filledRectangle($this->fill, new awLine(new awPoint($x1 + $size, $y1 + $size), new awPoint($x2 - $size, $y2 - $size))); }