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)
				);
				
			}
		
		}
	}
 /**
  * Build a new awtext
  *
  * @param string $text Your text
  */
 public function __construct($text, $font = NULL, $color = NULL, $angle = 0)
 {
     if (is_null($font)) {
         $font = new awFont2();
     }
     $this->setText($text);
     $this->setFont($font);
     // Set default color to black
     if ($color === NULL) {
         $color = new awColor(0, 0, 0);
     }
     $this->setColor($color);
     $this->setAngle($angle);
     $this->border = new awBorder();
     $this->border->hide();
 }
 /**
  * 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);
 }
 /**
  * SideBorder constructor.
  * @param Display $display
  * @param string $char
  */
 public function __construct(Display $display, $char)
 {
     if (!is_string($char) || 1 !== strlen($char)) {
         throw new \InvalidArgumentException();
     }
     parent::__construct($display);
     $this->borderChar = $char;
 }
 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)));
 }
Exemple #7
0
 /**
  * @param string|void $color Border A RGB color code
  * @param string|void $width Border width @see BorderPart::allowedWidths
  * @param string|void $style Border style @see BorderPart::allowedStyles
  * @return BorderBuilder
  */
 public function setBorderLeft($color = Color::BLACK, $width = Border::WIDTH_MEDIUM, $style = Border::STYLE_SOLID)
 {
     $this->border->addPart(new BorderPart(Border::LEFT, $color, $width, $style));
     return $this;
 }
Exemple #8
0
 function drawImage($point)
 {
     if (is_a($this->image, 'awImage')) {
         $width = $this->image->width;
         $height = $this->image->height;
         list($x, $y) = $point->getLocation();
         $x1 = (int) ($x - $width / 2);
         $x2 = $x1 + $width;
         $y1 = (int) ($y - $width / 2);
         $y2 = $y1 + $height;
         $this->border->rectangle($this->driver, new awPoint($x1 - 1, $y1 - 1), new awPoint($x2 + 1, $y2 + 1));
         $this->driver->copyImage($this->image, new awPoint($x1, $y1), new awPoint($x2, $y2));
     }
 }
Exemple #9
0
 /**
  * Create a new Borders
  *
  * @param    boolean    $isSupervisor    Flag indicating if this is a supervisor or not
  *                                    Leave this value at default unless you understand exactly what
  *                                        its ramifications are
  * @param    boolean    $isConditional    Flag indicating if this is a conditional style or not
  *                                    Leave this value at default unless you understand exactly what
  *                                        its ramifications are
  */
 public function __construct($isSupervisor = false, $isConditional = false)
 {
     // Supervisor?
     parent::__construct($isSupervisor);
     // Initialise values
     $this->left = new Border($isSupervisor, $isConditional);
     $this->right = new Border($isSupervisor, $isConditional);
     $this->top = new Border($isSupervisor, $isConditional);
     $this->bottom = new Border($isSupervisor, $isConditional);
     $this->diagonal = new Border($isSupervisor, $isConditional);
     $this->diagonalDirection = self::DIAGONAL_NONE;
     // Specially for supervisor
     if ($isSupervisor) {
         // Initialize pseudo-borders
         $this->allBorders = new Border(true);
         $this->outline = new Border(true);
         $this->inside = new Border(true);
         $this->vertical = new Border(true);
         $this->horizontal = new Border(true);
         // bind parent if we are a supervisor
         $this->left->bindParent($this, 'left');
         $this->right->bindParent($this, 'right');
         $this->top->bindParent($this, 'top');
         $this->bottom->bindParent($this, 'bottom');
         $this->diagonal->bindParent($this, 'diagonal');
         $this->allBorders->bindParent($this, 'allBorders');
         $this->outline->bindParent($this, 'outline');
         $this->inside->bindParent($this, 'inside');
         $this->vertical->bindParent($this, 'vertical');
         $this->horizontal->bindParent($this, 'horizontal');
     }
 }
 /**
  * SideBorder constructor.
  * @param Display $display
  */
 public function __construct(Display $display)
 {
     parent::__construct($display);
 }
Exemple #11
0
 /**
  * Set the border of this window.
  *
  * @param Blink\Border $border The border object used to set the window's border.
  *
  * @return void
  */
 public function setBorder(Border $border)
 {
     $this->border = $border;
     ncurses_wborder($this->window, $border->getLeft(), $border->getRight(), $border->getTop(), $border->getBottom(), $border->getTopLeft(), $border->getTopRight(), $border->getBottomLeft(), $border->getBottomRight());
     $this->refresh();
 }