kenzzii / mtchart

Automatically exported from code.google.com/p/mtchart
GNU General Public License v3.0
0 stars 0 forks source link

another addBorder version #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This won't extend the image. Should be used in the ende before drawing /
writing the image. Instead of creating a new image and merging it with the
drawn image, this one draws a rectangle (multiple rectangles if border size
is different than 3) on the final chart image.

    public function addBorder($Size = 3, $R = 0, $G = 0, $B = 0) {
        $color = $this->AllocateColor($this->Picture, $R, $G, $B);

        for ($i=0; $i<$Size; $i++) {
            imagerectangle($this->Picture, $i, $i, $this->XSize-($i+1),
$this->YSize-($i+1), $color);
        }
    }

I think this is a little bit faster than the first version.

Original issue reported on code.google.com by repthe...@gmail.com on 1 Oct 2009 at 8:10