예제 #1
0
	/**
	 * Draw a polygon
	 *
	 * @param $color Polygon color
	 * @param Polygon A polygon
	 */
	 function polygon($color, &$polygon) {
		
		switch($polygon->getStyle()) {
		
			case POLYGON_SOLID :
				$thickness = $line->getThickness();
				$this->startThickness($thickness);
				$points = $this->getPolygonPoints($polygon);
				$rgb = $color->getColor($this->resource);
				imagepolygon($this->resource, $points, $polygon->count(), $rgb);
				$this->stopThickness($thickness);
				break;
				
			default :
			
				if($polygon->count() > 1) {
				
					$prev = $polygon->get(0);
					
					$line = new awLine;
					$line->setStyle($polygon->getStyle());
					$line->setThickness($polygon->getThickness());
					
					for($i = 1; $i < $polygon->count(); $i++) {
						$current = $polygon->get($i);
						$line->setLocation($prev, $current);
						$this->line($color, $line);
						$prev = $current;
					}
					
				}
		
		}
		
	}
예제 #2
0
 /**
  * Draw border as a rectangle
  *
  * @param $driver
  * @param $p1 Top-left corner
  * @param $p2 Bottom-right corner
  */
 function rectangle($driver, $p1, $p2)
 {
     // Border is hidden
     if ($this->hide) {
         return;
     }
     $line = new awLine();
     $line->setStyle($this->style);
     $line->setLocation($p1, $p2);
     $driver->rectangle($this->color, $line);
 }
예제 #3
0
파일: ming.class.php 프로젝트: rhertzog/lcs
 /**
  * Draw a polygon
  *
  * @param $color Polygon color
  * @param Polygon A polygon
  */
 function polygon($color, &$polygon)
 {
     $points = $polygon->all();
     $count = count($points);
     if ($count > 1) {
         $side = new awLine();
         $side->setStyle($polygon->getStyle());
         $side->setThickness($polygon->getThickness());
         $prev = $points[0];
         for ($i = 1; $i < $count; $i++) {
             $current = $points[$i];
             $side->setLocation($prev, $current);
             $this->line($color, $side);
             $prev = $current;
         }
         // Close the polygon
         $side->setLocation($prev, $points[0]);
         $this->line($color, $side);
     }
 }
예제 #4
0
 /**
  * Draw border as a rectangle
  *
  * @param awDrawer $drawer
  * @param awPoint $p1 Top-left corner
  * @param awPoint $p2 Bottom-right corner
  */
 public function rectangle(awDrawer $drawer, awPoint $p1, awPoint $p2)
 {
     // Border is hidden
     if ($this->hide) {
         return;
     }
     $line = new awLine();
     $line->setStyle($this->style);
     $line->setLocation($p1, $p2);
     $drawer->rectangle($this->color, $line);
 }