circle — Draw a circle

Description

public Intervention\Image\Image circle(string $color, integer $x, integer $y, [integer $radius, [boolean $filled]])

Draw a colored circle at given x, y, coordinates with given radius. You can define whether the circle should be filled or not.

Parameters

color

The color of the circle. Pass a color in one of the different color formats.

pos_x

x-coordinate of the center.

pos_y

y-coordinate of the center.

radius (optional)

radius of the circle. Default: 10

filled (optional)

Whether to fill the circle or not. Default: true

Return Values

Instance of Intervention\Image\Image

Examples

  1. // create empty canvas with background color
  2. $img = Image::canvas(100, 100, '#ddd');
  3. // draw a filled blue circle
  4. $img->circle('#0000ff', 50, 50, 25);
  5. // draw a non-filled red circle
  6. $img->circle('#ff0000', 50, 50, 75, false);

See also