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); } }
/** * Draw border as a polygon * * @param awDriver $driver A Driver object * @param awPolygon $polygon A Polygon object */ public function polygon(awDriver $driver, awPolygon $polygon) { // Border is hidden if ($this->hide) { return; } $polygon->setStyle($this->style); $driver->polygon($this->color, $polygon); // In case of Line::SOLID, Driver::polygon() uses imagepolygon() // which automatically closes the shape. In any other case, // we have to do it manually here. if ($this->style !== Line::SOLID) { $this->closePolygon($driver, $polygon); } }