Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> PHP

PHP में imagearc() फंक्शन

imagearc() फंक्शन का उपयोग आर्क (चाप) ड्रॉ करने के लिए किया जाता है।

सिंटैक्स

imagearc( $img, $cx, $cy, $width, $height, $start, $end, $color )

पैरामीटर्स

  • $img: imagecreatetruecolor() के साथ इमेज बनाता है।

  • $cx: केंद्र का x-निर्देशांक।

  • $cy: केंद्र का y-निर्देशांक।

  • $width: आर्क की चौड़ाई।

  • $height: आर्क की ऊंचाई।

  • $start: आर्क प्रारंभ कोण, डिग्री में।

  • $end: आर्क अंत कोण डिग्री में।

  • $color: यह इमेज का रंग सेट करता है।

रिटर्न

imagearc() फंक्शन सफलता पर TRUE या विफलता पर FALSE लौटाता है।

उदाहरण

निम्नलिखित एक उदाहरण है:

<?php 
    $img = imagecreatetruecolor(200, 200); 
    $one = imagecolorallocate($img, 100, 50, 255); 
    $two = imagecolorallocate($img, 30, 255, 150); 
    imagearc($img, 100, 100, 200, 200, 0, 360, $one); 
    imagearc($img, 130, 50, 100, 150, 25, 155, $two); 
    header("Content-type: image/png"); 
    imagepng($img); 
    imagedestroy($img); 
?>

आउटपुट

निम्नलिखित आउटपुट है:

PHP में imagearc() फंक्शन

उदाहरण

आइए एक और उदाहरण देखें जहां आर्क के लिए अलग निर्देशांक और कोण हैं:

<?php $img = imagecreatetruecolor(250, 250); $one = imagecolorallocate($img, 100, 90, 255); $two = imagecolorallocate($img, 100, 255, 190); 
    imagearc($img, 130, 100, 200, 200, 0, 360, $one); 
    imagearc($img, 140, 50, 140, 150, 95, 155, $two); 
    header("Content-type: image/png"); 
    imagepng($img); 
    imagedestroy($img); 
?>

आउटपुट

निम्नलिखित आउटपुट है:

PHP में imagearc() फंक्शन

  1. PHP में imagefill() फंक्शन PHP में imagefill() फंक्शन

    PHP में imagefill() फंक्शन छवि में निर्दिष्ट प्रारंभिक बिंदु से फ्लड फिल (flood fill) ऑपरेशन करता है - अर्थात्, यह मिलते-जुलते रंग वाले सभी जुड़े हुए क्षेत्र को निर्दिष्ट रंग से भर देता है। सिंटैक्स (Syntax) imagefill(GdImage $image, int $x, int $y, int $color): bool पैरामीटर्स (Parameters) $ima

  1. PHP में imagefilledrectangle() फंक्शन PHP में imagefilledrectangle() फंक्शन

    PHP में imagefilledrectangle() फंक्शन छवि पर एक भरा हुआ आयत (filled rectangle) खींचता है। यह निर्दिष्ट दो कोनों के बीच के पूरे आयताकार क्षेत्र को रंग से भर देता है। सिंटैक्स (Syntax) imagefilledrectangle(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): bool पैरामीटर्स (Parameters)

  1. PHP में imagefilledellipse() फंक्शन PHP में imagefilledellipse() फंक्शन

    PHP में imagefilledellipse() फंक्शन छवि पर एक भरा हुआ अंडाकार (filled ellipse) खींचता है। केंद्र निर्देशांक, चौड़ाई और ऊंचाई निर्दिष्ट करके अंडाकार बनाया जाता है। सिंटैक्स (Syntax) imagefilledellipse(GdImage $image, int $cx, int $cy, int $width, int $height, int $color): bool पैरामीटर्स (Paramete