Share via


음영 처리된 사각형 그리기

음영 처리된 사각형을 그리려면 두 개의 요소와 단일 GRADIENT_RECT 구조체를 사용하여 TRIVERTEX 배열을 정의합니다. 다음 코드 예제에서는 GRADIENT_FILL_RECT 모드가 정의된 GradientFill 함수를 사용하여 음영 처리된 사각형을 그리는 방법을 보여줍니다.

// Create an array of TRIVERTEX structures that describe 
// positional and color values for each vertex. For a rectangle, 
// only two vertices need to be defined: upper-left and lower-right. 
TRIVERTEX vertex[2] ;
vertex[0].x     = 0;
vertex[0].y     = 0;
vertex[0].Red   = 0x0000;
vertex[0].Green = 0x8000;
vertex[0].Blue  = 0x8000;
vertex[0].Alpha = 0x0000;

vertex[1].x     = 300;
vertex[1].y     = 80; 
vertex[1].Red   = 0x0000;
vertex[1].Green = 0xd000;
vertex[1].Blue  = 0xd000;
vertex[1].Alpha = 0x0000;

// Create a GRADIENT_RECT structure that 
// references the TRIVERTEX vertices. 
GRADIENT_RECT gRect;
gRect.UpperLeft  = 0;
gRect.LowerRight = 1;

// Draw a shaded rectangle. 
GradientFill(hdc, vertex, 2, &gRect, 1, GRADIENT_FILL_RECT_H);

다음 이미지는 이전 코드 예제의 그리기 출력을 보여줍니다.

왼쪽의 어둡게에서 오른쪽 조명으로 그라데이션 채우기가 있는 사각형을 보여 주는 그림

비트맵 개요

비트맵 함수

음영 처리된 삼각형 그리기

EMRGRADIENTFILL

GRADIENT_RECT

GradientFill

TRIVERTEX