protected function drawArea(awDriver $driver, awPolygon $polygon) { $starts = array(); foreach ($this->areas as $area) { list($start) = $area; $starts[$start] = TRUE; } // Draw filled areas foreach ($this->areas as $area) { list($start, $stop, $background) = $area; $polygonArea = new awPolygon(); $p = $this->xAxisPoint($start); $polygonArea->append($p); for ($i = $start; $i <= $stop; $i++) { $p = clone $polygon->get($i); if ($i === $stop and array_key_exists($stop, $starts)) { $p = $p->move(-1, 0); } $polygonArea->append($p); } $p = $this->xAxisPoint($stop); if (array_key_exists($stop, $starts)) { $p = $p->move(-1, 0); } $polygonArea->append($p); // Draw area $driver->filledPolygon($background, $polygonArea); } }
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); } }