라이브러리
[PHP] ImagickDraw::getStrokeOpacity - 선이 그려진 객체 윤곽선의 불투명도를 반환합니다.
ImagickDraw::getStrokeOpacity
ImagickDraw 클래스의 getStrokeOpacity 메소드는 이미지의 선(opacity) 투명도를 반환합니다.
사용 방법
ImagickDraw 클래스의 getStrokeOpacity 메소드는 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$draw = new ImagickDraw();
$draw->setStrokeOpacity(0.5); // 선 투명도 0.5 설정
$strokeOpacity = $draw->getStrokeOpacity(); // 선 투명도 0.5 반환
예제
다음 예제는 ImagickDraw 클래스의 getStrokeOpacity 메소드를 사용하여 이미지의 선 투명도를 설정하고 반환하는 방법을 보여줍니다.
#hostingforum.kr
php
// 이미지 생성
$image = new Imagick();
$image->newImage(800, 600, 'white');
$image->setImageFormat('png');
// 드로잉 객체 생성
$draw = new ImagickDraw();
// 선 투명도 설정
$draw->setStrokeOpacity(0.5);
// 선 색상 설정
$draw->setStrokeColor('red');
// 선 두께 설정
$draw->setStrokeWidth(5);
// 선 그리기
$draw->line(100, 100, 700, 500);
$image->drawImage($draw);
// 이미지 저장
$image->writeImage('stroke_opacity.png');
// 이미지 표시
header('Content-Type: image/png');
echo $image;
이 예제에서는 ImagickDraw 클래스의 getStrokeOpacity 메소드를 사용하여 이미지의 선 투명도를 0.5로 설정하고, 선 색상과 두께를 설정한 후 선을 그립니다. 그린 선의 투명도는 0.5로 설정되어 있습니다.
-
- 나우호스팅 @pcs8404
-
호스팅포럼 화이팅!
댓글목록
등록된 댓글이 없습니다.