Horde_Image_Base::brush PHP Method

brush() public method

Useful for scatter diagrams, debug points, etc. Draws squares, circles, diamonds, and triangles.
public brush ( integer $x, integer $y, string $color = 'black', string $shape = 'square' )
$x integer The x coordinate of the point to brush.
$y integer The y coordinate of the point to brush.
$color string The color to brush the point with.
$shape string What brush to use? Defaults to a square.
    public function brush($x, $y, $color = 'black', $shape = 'square')
    {
        switch ($shape) {
            case 'triangle':
                $verts[0] = array('x' => $x + 3, 'y' => $y + 3);
                $verts[1] = array('x' => $x, 'y' => $y - 3);
                $verts[2] = array('x' => $x - 3, 'y' => $y + 3);
                $this->polygon($verts, $color, $color);
                break;
            case 'circle':
                $this->circle($x, $y, 3, $color, $color);
                break;
            case 'diamond':
                $verts[0] = array('x' => $x - 3, 'y' => $y);
                $verts[1] = array('x' => $x, 'y' => $y + 3);
                $verts[2] = array('x' => $x + 3, 'y' => $y);
                $verts[3] = array('x' => $x, 'y' => $y - 3);
                $this->polygon($verts, $color, $color);
                break;
            case 'square':
            default:
                $this->rectangle($x - 2, $y - 2, 4, 4, $color, $color);
                break;
        }
    }