라이브러리
[PHP] ImagickDraw::setStrokeColor - 객체 윤곽선을 획을 그리는 데 사용되는 색상을 설정합니다.
ImagickDraw::setStrokeColor란?
ImagickDraw::setStrokeColor는 PHP의 ImagickDraw 클래스의 메소드로, StrokeColor를 설정하는 메소드입니다. StrokeColor는 이미지에 선을 그릴 때 사용하는 색상을 의미합니다.
ImagickDraw::setStrokeColor 사용 예제
#hostingforum.kr
php
<?php
// ImagickDraw 객체 생성
$draw = new ImagickDraw();
// StrokeColor를 설정합니다.
$draw->setStrokeColor('red');
// 이미지에 선을 그립니다.
$draw->setStrokeWidth(5);
$draw->line(10, 10, 100, 100);
// Imagick 객체 생성
$image = new Imagick();
// 이미지에 Draw 객체를 적용합니다.
$image->newImage(200, 200, 'white');
$image->annotateImage($draw, 10, 10, 0, '선이 그려집니다.');
$image->setImageFormat('png');
$image->writeImage('stroke_color_example.png');
?>
이 예제에서는 ImagickDraw 객체를 생성하고, StrokeColor를 'red'로 설정합니다. 그 후, 이미지에 선을 그립니다. 선의 너비는 5픽셀입니다. 마지막으로, Imagick 객체를 생성하고, Draw 객체를 적용하여 이미지에 선을 그립니다.
ImagickDraw::setStrokeColor의 옵션
ImagickDraw::setStrokeColor 메소드는 여러 옵션을 지원합니다.
* `Imagick::COLOR_RGB` : RGB 색상으로 StrokeColor를 설정합니다.
* `Imagick::COLOR_GRAY` : 그레이 색상으로 StrokeColor를 설정합니다.
* `Imagick::COLOR_TRANSPARENT` : 투명한 StrokeColor를 설정합니다.
예를 들어, RGB 색상으로 StrokeColor를 설정하는 예제는 다음과 같습니다.
#hostingforum.kr
php
$draw->setStrokeColor(new ImagickPixel('rgb(255, 0, 0)'));
이 예제에서는 RGB 색상으로 StrokeColor를 설정합니다. RGB 색상은 `(R, G, B)` 형식으로 입력됩니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.