/** * Create a new awimage */ function create() { if ($this->resource === NULL) { // Create image $this->resource = imagecreatetruecolor($this->width, $this->height); if (!$this->resource) { trigger_error("Unable to create a graph", E_USER_ERROR); } imagealphablending($this->resource, TRUE); if ($this->antiAliasing and function_exists('imageantialias')) { imageantialias($this->resource, TRUE); } $this->drawer = new awDrawer($this->resource); $this->drawer->setImageSize($this->width, $this->height); // Original color $this->drawer->filledRectangle(new awWhite(), new awLine(new awPoint(0, 0), new awPoint($this->width, $this->height))); $shadow = $this->shadow->getSpace(); $p1 = new awPoint($shadow->left, $shadow->top); $p2 = new awPoint($this->width - $shadow->right - 1, $this->height - $shadow->bottom - 1); // Draw image background $this->drawer->filledRectangle($this->background, new awLine($p1, $p2)); $this->background->free(); // Draw image border $this->border->rectangle($this->drawer, $p1, $p2); } }
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) ); } } }
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))); }
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)); } }