public function Stroke($aFileName = '') { // Find out the necessary size for the container image $w = 0; $h = 0; for ($i = 0; $i < $this->iCnt; ++$i) { $maxw = $this->iGraphs[$i][1] + $this->iGraphs[$i][5]; $maxh = $this->iGraphs[$i][2] + $this->iGraphs[$i][6]; $w = max($w, $maxw); $h = max($h, $maxh); } $w += $this->lm + $this->rm; $h += $this->tm + $this->bm; // User specified width,height overrides if ($this->iWidth !== null && $this->iWidth !== 0) { $w = $this->iWidth; } if ($this->iHeight !== null && $this->iHeight !== 0) { $h = $this->iHeight; } if ($this->doshadow) { $w += $this->shadow_width; $h += $this->shadow_width; } $image = new Image\Image($w, $h); $image->SetImgFormat($this->image_format, $this->image_quality); if ($this->doshadow) { $image->SetColor($this->iFrameColor); $image->ShadowRectangle(0, 0, $w - 1, $h - 1, $this->iFillColor, $this->shadow_width, $this->shadow_color); $w -= $this->shadow_width; $h -= $this->shadow_width; } else { $image->SetColor($this->iFillColor); $image->FilledRectangle(0, 0, $w - 1, $h - 1); } $image->SetExpired($this->expired); $this->img = $image->img; $this->_strokeBackgroundImage(); if ($this->iDoFrame && !$this->doshadow) { $image->SetColor($this->iFrameColor); $image->SetLineWeight($this->iFrameWeight); $image->Rectangle(0, 0, $w - 1, $h - 1); } // Copy all sub graphs to the container for ($i = 0; $i < $this->iCnt; ++$i) { $image->CopyMerge($this->iGraphs[$i][0], $this->iGraphs[$i][1] + $this->lm, $this->iGraphs[$i][2] + $this->tm, $this->iGraphs[$i][3], $this->iGraphs[$i][4], $this->iGraphs[$i][5], $this->iGraphs[$i][6], -1, -1, $this->iGraphs[$i][7]); } $this->StrokeTitle($image, $w, $h); $this->footer->Stroke($image); // Output image if ($aFileName == _IMG_HANDLER) { return $image->img; } else { //Finally stream the generated picture $this->cache = new Image\ImgStreamCache(); $this->cache->PutAndStream($image, $this->cache_name, $this->inline, $aFileName); } }