You are here

function pDraw::drawRectangle in Visitors 7.2

Same name and namespace in other branches
  1. 7 pChart/class/pDraw.class.php \pDraw::drawRectangle()
7 calls to pDraw::drawRectangle()
pDraw::drawBarChart in pChart/class/pDraw.class.php
pDraw::drawDerivative in pChart/class/pDraw.class.php
pDraw::drawFilledRectangle in pChart/class/pDraw.class.php
pDraw::drawProgress in pChart/class/pDraw.class.php
pDraw::drawRoundedRectangle in pChart/class/pDraw.class.php

... See full list

File

pChart/class/pDraw.class.php, line 435

Class

pDraw

Code

function drawRectangle($X1, $Y1, $X2, $Y2, $Format = "") {
  $R = isset($Format["R"]) ? $Format["R"] : 0;
  $G = isset($Format["G"]) ? $Format["G"] : 0;
  $B = isset($Format["B"]) ? $Format["B"] : 0;
  $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
  $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : NULL;
  $NoAngle = isset($Format["NoAngle"]) ? $Format["NoAngle"] : FALSE;
  if ($X1 > $X2) {
    list($X1, $X2) = array(
      $X2,
      $X1,
    );
  }
  if ($Y1 > $Y2) {
    list($Y1, $Y2) = array(
      $Y2,
      $Y1,
    );
  }
  if ($this->Antialias) {
    if ($NoAngle) {
      $this
        ->drawLine($X1 + 1, $Y1, $X2 - 1, $Y1, array(
        "R" => $R,
        "G" => $G,
        "B" => $B,
        "Alpha" => $Alpha,
        "Ticks" => $Ticks,
      ));
      $this
        ->drawLine($X2, $Y1 + 1, $X2, $Y2 - 1, array(
        "R" => $R,
        "G" => $G,
        "B" => $B,
        "Alpha" => $Alpha,
        "Ticks" => $Ticks,
      ));
      $this
        ->drawLine($X2 - 1, $Y2, $X1 + 1, $Y2, array(
        "R" => $R,
        "G" => $G,
        "B" => $B,
        "Alpha" => $Alpha,
        "Ticks" => $Ticks,
      ));
      $this
        ->drawLine($X1, $Y1 + 1, $X1, $Y2 - 1, array(
        "R" => $R,
        "G" => $G,
        "B" => $B,
        "Alpha" => $Alpha,
        "Ticks" => $Ticks,
      ));
    }
    else {
      $this
        ->drawLine($X1 + 1, $Y1, $X2 - 1, $Y1, array(
        "R" => $R,
        "G" => $G,
        "B" => $B,
        "Alpha" => $Alpha,
        "Ticks" => $Ticks,
      ));
      $this
        ->drawLine($X2, $Y1, $X2, $Y2, array(
        "R" => $R,
        "G" => $G,
        "B" => $B,
        "Alpha" => $Alpha,
        "Ticks" => $Ticks,
      ));
      $this
        ->drawLine($X2 - 1, $Y2, $X1 + 1, $Y2, array(
        "R" => $R,
        "G" => $G,
        "B" => $B,
        "Alpha" => $Alpha,
        "Ticks" => $Ticks,
      ));
      $this
        ->drawLine($X1, $Y1, $X1, $Y2, array(
        "R" => $R,
        "G" => $G,
        "B" => $B,
        "Alpha" => $Alpha,
        "Ticks" => $Ticks,
      ));
    }
  }
  else {
    $Color = $this
      ->allocateColor($this->Picture, $R, $G, $B, $Alpha);
    imagerectangle($this->Picture, $X1, $Y1, $X2, $Y2, $Color);
  }
}