Win32 API with 나우캠퍼스

Win32 API 11강. 유용한 함수(2) 그래픽 관련 함수

코다람쥐 2022. 8. 20. 14:30

2. 그래픽 관련 함수

CreateCompatibleBitmap()


▩ 역할

- 임의의 크기인 비트맵 생성

 

▩ 함수 원형

HBITMAP CreateCompatibleBitmap(
  [in] HDC hdc,
  [in] int cx,
  [in] int cy
);

hdc : 사용할 DC

cx : 가로길이

cy : 세로길이

 

▩ 클라이언트 영역이 200, 200 비트맵 크기 200, 200 메모리 DC는 흰색(PatBlt()) 메모리 DC에 사각형 출력

 

SetROP2()


▩ 역할

- 현재 출력 화면 + 펜 + 브러쉬, 더 자세한 내용은 MSDN문서 참조

https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-setrop2

 

SetROP2 function (wingdi.h) - Win32 apps

The SetROP2 function sets the current foreground mix mode.

docs.microsoft.com

 

▩ 활용

- 배경이 있는 화면에서 도형 및 선 출력할 때

 

▩ 함수 원형

int SetROP2(
  [in] HDC hdc,
  [in] int rop2
);

hdc : 적용할 dc

rop2 : 드로우모드(msdn문서참조)