
imagefilledpolygon 함수를 사용하여 사각형을 채우는 경우, 사각형의 색상을 제대로 적용하려면 imagefilledpolygon 함수의 마지막 인자로 color_index를 사용해야 합니다.
imagefilledpolygon 함수의 마지막 인자는 color_index를 사용해야 하며, color_index는 imagecolorallocate 함수를 통해 얻을 수 있습니다.
#hostingforum.kr
php
$color = imagecolorallocate($image, 255, 0, 0); // 빨간색
imagefilledpolygon($image, $points, 4, -1); // -1은 color_index를 의미합니다.
또는
#hostingforum.kr
php
imagefilledpolygon($image, $points, 4, $color);
imagecolortransparent($image, $color); // color_index를 사용하여 색상을 제거합니다.
이러한 방법으로 imagefilledpolygon 함수를 사용하여 사각형의 색상을 제대로 적용할 수 있습니다.
2025-05-13 21:50