Blog
Tag
Keylog
Guest Book
English
그레이스케일 아이콘 만들기
:: 2006/03/10 18:40
/
코드/win32
코드 프로젝트 받은 소스 분석하다 잼써서 올려봅니당...
// This function creates a grayscale icon starting from a given icon. // The resulting icon will have the same size of the original one. // // Parameters: // [IN] hIcon // Handle to the original icon. // // Return value: // If the function succeeds, the return value is the handle // to the newly created grayscale icon. // If the function fails, the return value is NULL. // // Updates: // 26/Nov/2002 Restored 1 BitBlt operation // 03/May/2002 Removed dependancy from m_hWnd // Removed 1 BitBlt operation // HICON CButtonST::CreateGrayscaleIcon(HICON hIcon) { HICON hGrayIcon = NULL; HDC hMainDC = NULL, hMemDC1 = NULL, hMemDC2 = NULL; BITMAP bmp; HBITMAP hOldBmp1 = NULL, hOldBmp2 = NULL; ICONINFO csII, csGrayII; BOOL bRetValue = FALSE; bRetValue = ::GetIconInfo(hIcon, &csII); if (bRetValue == FALSE) return NULL; hMainDC = ::GetDC(NULL); hMemDC1 = ::CreateCompatibleDC(hMainDC); hMemDC2 = ::CreateCompatibleDC(hMainDC); if (hMainDC == NULL || hMemDC1 == NULL || hMemDC2 == NULL) return NULL; if (::GetObject(csII.hbmColor, sizeof(BITMAP), &bmp)) { DWORD dwWidth = csII.xHotspot*2; DWORD dwHeight = csII.yHotspot*2; csGrayII.hbmColor = ::CreateBitmap(dwWidth , dwHeight , bmp.bmPlanes , bmp.bmBitsPixel , NULL); if (csGrayII.hbmColor) { hOldBmp1 = (HBITMAP)::SelectObject(hMemDC1, csII.hbmColor); hOldBmp2 = (HBITMAP)::SelectObject(hMemDC2, csGrayII.hbmColor); DWORD dwLoopY = 0, dwLoopX = 0; COLORREF crPixel = 0; BYTE byNewPixel = 0; for (dwLoopY = 0; dwLoopY < dwHeight; dwLoopY++) { for (dwLoopX = 0; dwLoopX < dwWidth; dwLoopX++) { crPixel = ::GetPixel(hMemDC1, dwLoopX, dwLoopY); byNewPixel = (BYTE)((GetRValue(crPixel) * 0.299) + (GetGValue(crPixel) * 0.587) + (GetBValue(crPixel) * 0.114)); if (crPixel) ::SetPixel(hMemDC2 , dwLoopX , dwLoopY , RGB(byNewPixel, byNewPixel, byNewPixel)); else ::SetPixel(hMemDC2, dwLoopX, dwLoopY, crPixel); } // for } // for ::SelectObject(hMemDC1, hOldBmp1); ::SelectObject(hMemDC2, hOldBmp2); csGrayII.hbmMask = csII.hbmMask; csGrayII.fIcon = TRUE; hGrayIcon = ::CreateIconIndirect(&csGrayII); } // if ::DeleteObject(csGrayII.hbmColor); //::DeleteObject(csGrayII.hbmMask); } // if ::DeleteObject(csII.hbmColor); ::DeleteObject(csII.hbmMask); ::DeleteDC(hMemDC1); ::DeleteDC(hMemDC2); ::ReleaseDC(NULL, hMainDC); return hGrayIcon; } // End of CreateGrayscaleIcon
(
0
)
(
0
)
스폰서
글타래
관련 글
Draw3dRect의 정체
(1025)
최근 글
와우와 아이온의 차이...
(53)
타이머 루틴의 예외는 왜
(82)
체스 기보 뷰어 가젯
(198)
2주간 인기 글
Scintilla, Notepad2, Note
(439)
VS 2008 설치 시 주의할 점
(427)
총 맞은 것처럼
(317)
gdi
,
그레이스케일
,
아이콘
756
명이 보았고,
댓글이 없습니다.
받은 트랙백이 없고, ...
Trackback Address ::
http://www.jiniya.net/tt/trackback/22
Name
Password
: Gravatar e-Mail.(
Sign up!
)
Homepage
Secret
< PREV
|
1
|
...
476
|
477
|
478
|
479
|
480
|
481
|
482
|
483
|
484
|
...
571
|
NEXT >
Informed
CodeWiz Profile
마이크로소프트웨어
테크박스
Cool Stuff
질문과 답변들
베스트 커멘터
Category
전체
(571)
종이
(250)
양피지
(76)
코드
(124)
win32
(41)
C/C++
(12)
레포트
(18)
기타
(3)
마이크로소프트웨어
(30)
패치
(15)
비스타
(2)
체스
(16)
키보드
(75)
스피커
(18)
책갈피
(48)
팝콘
(39)
Photo Log
Tags
사고
웹 2.0 시대의 기회 시맨틱 웹
OutputDebugString
삶
그림 퍼즐
마소플러스
평가
YAG
html
색깔 추출기
휠
OpenGL
플라이트 뮤지엄
상대 평가
DDK
죽으면서 태어나라
도서
chkdsk
앙코르
그룹명
Recent Entries
와우와 아이온의 차이...
타이머 루틴의 예외는 왜 전..
(2)
체스 기보 뷰어 가젯
VS 2008 설치 시 주의할 점...
(14)
총 맞은 것처럼
(2)
Recent Comments
제가 어렵게 적어서 그런가바용...
18:30 - codewiz
뭔가... 굉장히 어렵군요... 쿨럭
17:33 - bluenlive
아래 페이지에 킹의 행마법을 참..
12/03 - codewiz
오 형도 당했군요... ㅋㅋㅋ~..
12/03 - codewiz
저도 보통 풀로만 설치하는데 괜..
12/03 - codewiz
Recent Trackbacks
notepad2 컴파일 삽질기 2 : IME..
BLUE'nLIVE's diary++
흐르는 강물처럼
기차니즘 초절정 고수 일탈을 꿈..
메모장2 (3.0.20)
Sleepy Tiger
오랜만에..
zoops 이야기
영문 블로그 팀 "Rainbow Cats"..
Rainbow King Challenger
Calendar
«
2008/12
»
일
월
화
수
목
금
토
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Archive
2008/12
2008/11
2008/10
2008/09
2008/08
2008/07
2008/06
2008/05
2008/02
2008/01
2007/12
2007/11
2007/10
2007/09
2007/08
2007/07
2007/06
2007/05
2007/04
2007/03
Link Site
KAISTIZEN
Mirjini
SNAIPER의 조그마한 블로그
VC 뉴스그룹
Welcome to conv2.blog - Conv..
Wiziple Blog
zoops 이야기
[크리™]'s big book of..
…─━ INSIDE ━─…, 미래가..
내 성격 100% 활용하기 -上-
유유자적을 꿈꾸며...
정성태님 홈페이지
질럿님
Total : 482564
Today :
681
Yesterday : 655