setX() public method

Position X
public setX ( float $x )
$x float
Example #1
0
 /**
  * Most point to the bottom/left
  *
  * @return Point
  */
 protected function bottomLeft(Point $near)
 {
     $imagick = $this->getImagick();
     $side = 200;
     $first = new Point($near->getX() - 100, $near->getY() - 200);
     $last = new Point($near->getX() + 200, $near->getY() + 100);
     $point = new Point($last->getX(), $first->getY());
     //Add draw debug
     $this->draw->setStrokeOpacity(1);
     $this->draw->setFillOpacity(0);
     $this->draw->setStrokeWidth(2);
     $this->draw->setStrokeColor("#00CC00");
     $this->draw->rectangle($first->getX(), $first->getY(), $last->getX(), $last->getY());
     for ($y = $first->getY(); $y != $last->getY(); $y++) {
         for ($x = $first->getX(); $x != $last->getX(); $x++) {
             $color = $imagick->getImagePixelColor($x, $y)->getColor();
             if ($color['r'] <= 5 && $color['g'] <= 5 && $color['b'] <= 5) {
                 if ($x <= $point->getX()) {
                     $point->setX($x);
                 }
                 if ($y >= $point->getY()) {
                     $point->setY($y);
                 }
             }
         }
     }
     //Debug draw
     $this->draw->setFillColor("#00CC00");
     $this->draw->point($point->getX(), $point->getY());
     return $point;
 }