imagepng
imagepsbbox
GD and Image 함수 목록
PHP Manual

# imagepolygon

(PHP 4, PHP 5)

imagepolygon — Draws a polygon

### 설명

bool imagepolygon ( resource `$image` , array `$points` , int `$num_points` , int `$color` )

imagepolygon() creates a polygon in the given `image` .

### 인수

`image`

  imagecreatetruecolor() 등의 이미지 생성 함수에서 반환한 이미지 자원.

`points`

  An array containing the polygon's vertices, e.g.:

  points[0] | = x0
  points[1] | = y0
  points[2] | = x1
  points[3] | = y1

`num_points`

  Total number of points (vertices).

`color`

  A color identifier created with imagecolorallocate().

### 반환값

성공할 경우 `TRUE`를, 실패할 경우 `FALSE`를 반환합니다.

### 예제

Example #1 imagepolygon() example

`<?php
// Create a blank image
$image = imagecreatetruecolor(400, 300);
// Allocate a color for the polygon
$col_poly = imagecolorallocate($image, 255, 255, 255);
// Draw the polygon
imagepolygon($image, array(
0, 0,
100, 200,
300, 200
),
3,
$col_poly);
// Output the picture to the browser
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>`

위 예제의 출력 예시:

### 참고

- imagecreate() - Create a new palette based image
- imagecreatetruecolor() - Create a new true color image

imagepng
imagepsbbox
GD and Image 함수 목록
PHP Manual