Click here to Skip to main content
15,919,028 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: SaferGetLevelInformation Fails!!! Pin
Aabid2-Jul-08 5:31
Aabid2-Jul-08 5:31 
QuestionRe: SaferGetLevelInformation Fails!!! Pin
David Crow2-Jul-08 5:47
David Crow2-Jul-08 5:47 
GeneralRe: SaferGetLevelInformation Fails!!! Pin
krmed2-Jul-08 6:59
krmed2-Jul-08 6:59 
AnswerRe: SaferGetLevelInformation Fails!!! Pin
krmed2-Jul-08 5:22
krmed2-Jul-08 5:22 
QuestionDrawing a grayscale Icon Pin
__DanC__2-Jul-08 3:13
__DanC__2-Jul-08 3:13 
AnswerRe: Drawing a grayscale Icon Pin
KarstenK2-Jul-08 3:39
mveKarstenK2-Jul-08 3:39 
GeneralRe: Drawing a grayscale Icon Pin
__DanC__2-Jul-08 3:44
__DanC__2-Jul-08 3:44 
AnswerRe: Drawing a grayscale Icon Pin
Mark Salsbery2-Jul-08 6:53
Mark Salsbery2-Jul-08 6:53 
You need to convert RGB values to grayscale values.

The typically formula used is

BYTE 8bitGrayscaleValue = (0.30 * RedByte) + (0.59 * GreenByte) + (0.11 * BlueByte)

or the integer (no floating point) version:

BYTE 8bitGrayscaleValue = (BYTE)((((int)RedByte * 30) + ((int)GreenByte * 59) + ((int)BlueByte * 11)) / 100);


You could create a 24bpp DIB section the dimensions of the icon, select it
into a memory DC, and draw the icon on the memory DC. Then using the pointer
to the DIBSection's pixel bits, iterate through the RGB pixel values, converting
each to grayscale.

That's the easiest way I can think of to access the pixel data of an icon.


Mark

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

AnswerRe: Drawing a grayscale Icon Pin
Mark Salsbery2-Jul-08 6:59
Mark Salsbery2-Jul-08 6:59 
Questiontypedef enum & typecasting [modified] Pin
testcrap2-Jul-08 2:49
testcrap2-Jul-08 2:49 
AnswerRe: typedef enum & typecasting Pin
_AnsHUMAN_ 2-Jul-08 2:54
_AnsHUMAN_ 2-Jul-08 2:54 
GeneralRe: typedef enum & typecasting Pin
David Crow2-Jul-08 4:53
David Crow2-Jul-08 4:53 
AnswerRe: typedef enum & typecasting Pin
KarstenK2-Jul-08 3:09
mveKarstenK2-Jul-08 3:09 
GeneralRe: typedef enum & typecasting Pin
testcrap2-Jul-08 3:17
testcrap2-Jul-08 3:17 
GeneralRe: typedef enum & typecasting Pin
KarstenK2-Jul-08 3:39
mveKarstenK2-Jul-08 3:39 
GeneralRe: typedef enum & typecasting Pin
testcrap2-Jul-08 3:41
testcrap2-Jul-08 3:41 
QuestionRe: typedef enum & typecasting Pin
David Crow2-Jul-08 4:59
David Crow2-Jul-08 4:59 
AnswerRe: typedef enum & typecasting Pin
testcrap2-Jul-08 5:55
testcrap2-Jul-08 5:55 
Questionoccupied port Pin
George_George2-Jul-08 2:41
George_George2-Jul-08 2:41 
AnswerRe: occupied port Pin
_AnsHUMAN_ 2-Jul-08 2:52
_AnsHUMAN_ 2-Jul-08 2:52 
GeneralRe: occupied port Pin
George_George2-Jul-08 3:09
George_George2-Jul-08 3:09 
GeneralRe: occupied port Pin
Hamid_RT2-Jul-08 20:10
Hamid_RT2-Jul-08 20:10 
GeneralRe: occupied port Pin
George_George3-Jul-08 21:51
George_George3-Jul-08 21:51 
GeneralRe: occupied port Pin
Hamid_RT4-Jul-08 0:21
Hamid_RT4-Jul-08 0:21 
GeneralRe: occupied port Pin
George_George4-Jul-08 1:00
George_George4-Jul-08 1:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.