imagefilledarc
Description
The imagefilledarc of Image for PHP draw a partial arc and fill it.
Syntax
imagefilledarc( GdImage $image, int $center_x, int $center_y, int $width, int $height, int $start_angle, int $end_angle, int $color, int $style ): bool
Parameters
image
A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().
center_x
x-coordinate of the center.
center_y
y-coordinate of the center.
width
The arc width.
height
The arc height.
start_angle
The arc start angle, in degrees.
end_angle
The arc end angle, in degrees. 0° is located at the three-o'clock position, and the arc is drawn clockwise.
color
A color identifier created with imagecolorallocate().
style
A bitwise OR of the following possibilities: IMG_ARC_PIE, IMG_ARC_CHORD, IMG_ARC_NOFILL, and IMG_ARC_EDGED.
IMG_ARC_PIE produces a rounded edge. IMG_ARC_CHORD connects the starting and ending angles with a straight line. IMG_ARC_NOFILL indicates that the arc or chord should be outlined, not filled. IMG_ARC_EDGED, used together with IMG_ARC_NOFILL, indicates that the beginning and ending angles should be connected to the center - this is a good way to outline a 'pie slice'.
Return
Returns true on success or false on failure.
Examples
1 · return
<? $width = 100; $height = 100; $image = imagecreate($width, $height); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $center_x = 50; $center_y = 50; $start_angle = 90; $end_angle = 360; $style = IMG_ARC_PIE; $return = imagefilledarc($image, $center_x, $center_y, $width, $height, $start_angle, $end_angle, $color, $style); var_export($return); ?>
true
2 · base64 · style · IMG_ARC_PIE
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $center_x = 50; $center_y = 50; $start_angle = 90; $end_angle = 360; $style = IMG_ARC_PIE; imagefilledarc($image, $center_x, $center_y, $width, $height, $start_angle, $end_angle, $color, $style); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>'; ?>
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACDElEQVR4nO3dwXaCMBRFUeL//zMOngsRQ5ILITySc+ZVu72hdtAyTS6b5/nulxAp3Pjch0VCuOdlt37W6pNpCdfomRocqwZqlz9B46vPpWRXPfTtV+gr1Oo/4u1M6+qS1XwsV0zrapFVw3IrZVXxqoPlXMo673X26x/BtO4M2Smsx0lZh70OftlDmdYdIDuC1YGUpXrJWN1IWZKXhtWZlFXuJWB1KWUVepVidSxllXgVYXUvZWW9Xm1eRx/llzXIrKz0uDJYQ0lZCS+OoVBqWQPOytob1y7WsFJW1CuONbiU9e/FNUsosixmtbQZF8sS2i6LWW1aj4tlCYEl9HMMOYPRlpPIsoS+y2JWiWxcLEsILKHPMeQMZgshsCwhsITAEgoTF6ziWJYQWEJgCYElBJYQWEJgCYElFNx+Ir3rLzATvRy+JrdxDIXAEgJLCCwhsITAEgJLCCyh1+Tys7LPWJYQWEJgCX2wuGyVxLKEwBL6YnESs7EsoR8sxpWOZQmBJbTF4iQmYllCESzGtRfLEopjMa5ou8vC67/UMcRrE9csoQwW41qXXxZeSxxDoSIsxmWVLguvSTqGeGnXrMG95Av8yF5HfhoO6+X3v3Y7fEtOfc5y+P1cmt87DTh8J+p8gnf4jV1RtV93RvDye98dh/p+7+g0ENbS4+7Ll8jvXejGxVoqVwPrpzScQ6w39Hl12oQonU4AAAAASUVORK5CYII="> </body> </html>
3 · base64 · style · IMG_ARC_CHORD
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $center_x = 50; $center_y = 50; $start_angle = 90; $end_angle = 360; $style = IMG_ARC_CHORD; imagefilledarc($image, $center_x, $center_y, $width, $height, $start_angle, $end_angle, $color, $style); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>'; ?>
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABLklEQVR4nO3SW47CMBQE0fLsf8/MBxJCEIJJ4se9rlpB66jBzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzKxFZfSA7W632+gJG/2NHhApsWorpYhVVSkFn1XTXQqxvvaQQqz9nqUQa6cXKcT61LsUYm22KYVY732SQqyXdqQQ67l9KcR69FUKse7VSCEW1VKIVS/F4lg/SbEy1q9SLIt1QIo1sY5JsSDWYSlWwzojxVJYJ6VYB+u8FItgXSLFClhXSZEe60IpcmNdK0VirMulyIrVQoqUWI2kyIfVTopkWE2lyITVWoo0WB2kyIHVR4oEWN2kiI7VU4rQWJ2liIvVX4qgWEOkiIg1SopwWAOliIU1VopAWMOliII1gxQhsCaRYn6seaSYHGsqKeAfl9kD8fi2tCUAAAAASUVORK5CYII="> </body> </html>
4 · base64 · style · IMG_ARC_NOFILL
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $center_x = 50; $center_y = 50; $start_angle = 90; $end_angle = 360; $style = IMG_ARC_NOFILL; imagefilledarc($image, $center_x, $center_y, $width, $height, $start_angle, $end_angle, $color, $style); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>'; ?>
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABuElEQVR4nO3dW5LCIBQA0Tj73zPzQZVFmYc0hmf6LCCB9hL9Mts2pBBC7yUceHW8d3GR16vPslvfNQ1UvOdbLlKg0Z3e27t9b/Wu3EEIoc0DqMGNan0avT7wqve9/4ojnIsR1vBFsxOXb8AlbduwyxpwYWOt5sgQKxzuczvXeamzZEp1WPNEA7XXdPFTl4oabWH2TCm6l7+qVx9frR0tcPr2qmxqvUypzN1lHcO1S0W37dFYba8yg193+pxS0fV+2U8HnXraWEUlu35mqehs78fH8MmlIlDAWLkFLBXtO/htCHzGcqxSX2oYK/VRw2NYyrHaS5s4WUUcqzPvMk4WYCzOM3gt9nGyAGMBxoJ8YOUIIThZgLEAYwHGAowFGAswFmAs4M9fpIy9MnkMAWMBxgKMBRgLMBZgLMBYnL9LczhZgLEAYxXxsfWVkwUYq5Qn8ZqT9QOH64KTBRzEcrgAY53xGP7M4Tp0Oln2AozF2IuxV8pvw1s5XIy9otxjaC/AWMyS//lXkb0YYzHOF2MvzF6MI4bZi3HEmOV7rfnenUpWe6PT3FY6m9O/ha6lKd9v2Mu4b84cMOU/y5tkM6Z53CQAAAAASUVORK5CYII="> </body> </html>
5 · base64 · style · IMG_ARC_EDGED
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $center_x = 50; $center_y = 50; $start_angle = 90; $end_angle = 360; $style = IMG_ARC_EDGED | IMG_ARC_NOFILL; imagefilledarc($image, $center_x, $center_y, $width, $height, $start_angle, $end_angle, $color, $style); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>'; ?>
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACF0lEQVR4nO2dwY7DIAxE6ar//8vsAW2EErJlXLAHMu9eGD/sBPXQpkRJzjk6QoNX4N5mI69XTGzvXWtB5pqHLGLAaaejvOG1zVs5gJyzzwPIYaNZpxF14FP3Hb8iw1wwZPiA28T1QxgpJdpYhMG40rSgSEh3bvcER11FU01A5oUa6opr+KVNFZxKWF1TDVrLz9TV+ZlV0QbTd2VKUftpqumsrmsM9zZVGFajZPmusgLfVvocU4X/68WuDuKWp7VVwVL1M00V7mpvj+GTTRUAA5LVa0CmClcPehsCnGWprWo+2JCsmpMNjaEVtdWV2ok6y4Ta6o7DjDoLQLJwNIP/U/yoswAkC0CyQPTA6iHnrM4CkCwAyQKQLADJApAsAMkCkCyAN+eNlDNVSpTJCCMljSGEZAFIFoBkAUgWgGQBSBaAZOGwXQLZ8hTUWQCSBSBZJqgeE1RhDtRZAJJlhaf5eZLUqLO+gORISWKcUGcBNGRxnioDZ1m8P2VGgMbwa8InMTxAk9vO4owbS1uWnlwwgc21ZF9HheaUpbfhUEIOmbOzuvCPzimrdww50zvTJUs3CRjP3/zjbGTgbVj6i7MMH7Crg+YRxmEeOfvXcinVPFqY52vPk5g0knvKKgyvbWdZaXSLccoa9q3DE57674FrnXzpUtZL/sP88bF51sCmjFPWyDFsstNsTpdVOBzVLbOcON5/ziRU+Qt/8o48eESzWAAAAABJRU5ErkJggg=="> </body> </html>
Links
Image
- gd_info
- getimagesize
- getimagesizefromstring
- image_type_to_extension
- image_type_to_mime_type
- imageaffine
- imageaffinematrixconcat
- imageaffinematrixget
- imagealphablending
- imageantialias
- imagearc
- imageavif
- imagebmp
- imagechar
- imagecharup
- imagecolorallocate
- imagecolorallocatealpha
- imagecolorat
- imagecolorclosest
- imagecolorclosestalpha
- imagecolorclosesthwb
- imagecolordeallocate
- imagecolorexact
- imagecolorexactalpha
- imagecolormatch
- imagecolorresolve
- imagecolorresolvealpha
- imagecolorset
- imagecolorsforindex
- imagecolorstotal
- imagecolortransparent
- imageconvolution
- imagecopy
- imagecopymerge
- imagecopymergegray
- imagecopyresampled
- imagecopyresized
- imagecreate
- imagecreatefromavif
- imagecreatefrombmp
- imagecreatefromgif
- imagecreatefromjpeg
- imagecreatefrompng
- imagecreatefromstring
- imagecreatefromtga
- imagecreatefromwbmp
- imagecreatefromwebp
- imagecreatefromxbm
- imagecreatefromxpm
- imagecreatetruecolor
- imagecrop
- imagecropauto
- imagedashedline
- imagedestroy
- imageellipse
- imagefill
- imagefilledellipse
- imagefilledpolygon
- imagefilledrectangle
- imagefilltoborder
- imagefilter
- imageflip
- imagefontheight
- imagefontwidth
- imageftbbox
- imagefttext
- imagegammacorrect
- imagegetclip
- imagegetinterpolation
- imagegif
- imageinterlace
- imageistruecolor
- imagejpeg
- imagelayereffect
- imageline
- imageloadfont
- imageopenpolygon
- imagepalettecopy
- imagepalettetotruecolor
- imagepng
- imagepolygon
- imagerectangle
- imageresolution
- imagerotate
- imagesavealpha
- imagescale
- imagesetbrush
- imagesetclip
- imagesetinterpolation
- imagesetpixel
- imagesetstyle
- imagesetthickness
- imagesettile
- imagestring
- imagestringup
- imagesx
- imagesy
- imagetruecolortopalette
- imagettfbbox
- imagettftext
- imagetypes
- imagewbmp
- imagewebp
- imagexbm
- iptcembed
- iptcparse