ইমেজেটস্টাইল() পিএইচপি-তে একটি অন্তর্নির্মিত ফাংশন যা লাইন অঙ্কনের জন্য স্টাইল সেট করতে ব্যবহৃত হয়। এটি ইমেজপলিগন এর মতো সমস্ত লাইন অঙ্কন ফাংশন দ্বারা ব্যবহার করা যেতে পারে অথবা চিত্ররেখা .
সিনট্যাক্স
bool imagesetstyle(resource $image, array $style)
পরামিতি
ইমেজেটস্টাইল() দুটি প্যারামিটার লাগে:$image এবং $style .
-
$ছবি - কাজ করার জন্য ইমেজ রিসোর্স নির্দিষ্ট করে।
-
$style − পিক্সেল রঙের অ্যারে নির্দিষ্ট করে।
রিটার্ন মান
ইমেজেটস্টাইল() সাফল্যের উপর সত্য বা ব্যর্থতার উপর মিথ্যা ফেরত দেয়।
উদাহরণ 1
<?php
header("Content-type: image/jpeg");
$img = imagecreatetruecolor(700, 300);
$w = imagecolorallocate($img, 122, 122, 122);
$red = imagecolorallocate($img, 255, 0, 0);
/* Draw a dashed line, 5 red pixels, 5 white pixels */
$style = array($red, $red, $red, $red, $red, $w, $w, $w, $w, $w);
imagesetstyle($img, $style);
imageline($img, 0, 0, 200, 200, IMG_COLOR_STYLED);
/* Draw a line of happy faces using imagesetbrush() with imagesetstyle */
$style = array($w, $w, $w, $w, $w, $w, $w, $w, $w, $w, $w, $w, $red);
imagesetstyle($img, $style);
$brush = imagecreatefrompng('C:\xampp\htdocs\Images\img34.png');
$w2 = imagecolorallocate($brush, 255, 255, 255);
imagecolortransparent($brush, $w2);
imagesetbrush($img, $brush);
imageline($img, 200, 0, 0, 200, IMG_COLOR_STYLEDBRUSHED);
imagejpeg($img);
imagedestroy($img);
?> ইনপুট ছবি

আউটপুট চিত্র

উদাহরণ 2
<?php
// Load the png image using imagecreatefrompng() function.
$img = imagecreatefrompng('C:\xampp\htdocs\Images\img34.png');
// Allocated the blue and green colors
$blue = imagecolorallocate($img, 0, 0, 255);
$green = imagecolorallocate($img, 0, 255, 0);
// Draw a dashed line, 5 blue pixels, 5 white pixels
$style = array($blue, $blue, $blue, $blue, $blue, $green, $green, $green, $green, $green);
imagesetstyle($img, $style);
imageline($img, 0, 100, 800, 100, IMG_COLOR_STYLED);
// Output image to the browser
header('Content-type: image/png');
imagepng($img);
?> আউটপুট
