Click here to Skip to main content
15,887,596 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionAlternative to getPixel() Pin
ceejeeb5-Feb-07 5:45
ceejeeb5-Feb-07 5:45 
AnswerRe: Alternative to getPixel() Pin
Waldermort5-Feb-07 6:16
Waldermort5-Feb-07 6:16 
GeneralRe: Alternative to getPixel() Pin
ceejeeb5-Feb-07 6:33
ceejeeb5-Feb-07 6:33 
GeneralRe: Alternative to getPixel() Pin
Waldermort5-Feb-07 6:56
Waldermort5-Feb-07 6:56 
GeneralRe: Alternative to getPixel() Pin
ceejeeb5-Feb-07 6:58
ceejeeb5-Feb-07 6:58 
GeneralRe: Alternative to getPixel() Pin
Waldermort5-Feb-07 7:12
Waldermort5-Feb-07 7:12 
GeneralRe: Alternative to getPixel() Pin
ceejeeb5-Feb-07 7:55
ceejeeb5-Feb-07 7:55 
GeneralRe: Alternative to getPixel() Pin
Waldermort5-Feb-07 9:11
Waldermort5-Feb-07 9:11 
There is no specific function. If you have downloaded and integrated one of the DIB wrapper classes, derive a new class from it and add a new member.

Lets say you are scanning a web-cam image and you want to get every 10th pixel. In your new function, get the images-bits from the base class which is just one big array of pixels. Calculate the bitmaps paramaters, then in a loop calculate which pixels you want ( y * bitmapwidth_inbytes + x ) and read them from the array.

Just remember, with a DIB, the pixels are not always a 32 value like you get back from GetPixel. They could be:
1 Bits ( 0 == black, 1 == white )
4 Bits ( 1 byte with two indexes into the color table )
8 Bits ( an array of bytes each representing an index into the color table )
16 Bits ( an array of WORD each representing an index into the color table )
24 Bits ( an array of DWORD look on MSDN for RGBQUAD )
32 Bits ( an array of DWORD look on MSDN for RGBQUAD )
64 Bits ( only windows vista supports these I think )

By far, the easiest to deal with are 24 and 32 bit images, all of the others use a color table. If you need the actual COLORREF value, then you must calculate it from whatever value you get from the array.
QuestionHow to call method inside another method.. Pin
Shah Satish5-Feb-07 4:44
Shah Satish5-Feb-07 4:44 
AnswerRe: How to call method inside another method.. Pin
Maximilien5-Feb-07 5:01
Maximilien5-Feb-07 5:01 
GeneralRe: How to call method inside another method.. Pin
Shah Satish5-Feb-07 5:09
Shah Satish5-Feb-07 5:09 
GeneralRe: How to call method inside another method.. Pin
Maximilien5-Feb-07 8:20
Maximilien5-Feb-07 8:20 
AnswerRe: How to call method inside another method.. Pin
benjymous5-Feb-07 5:04
benjymous5-Feb-07 5:04 
GeneralRe: How to call method inside another method.. Pin
Shah Satish5-Feb-07 5:09
Shah Satish5-Feb-07 5:09 
AnswerRe: How to call method inside another method.. Pin
Hamid_RT5-Feb-07 7:53
Hamid_RT5-Feb-07 7:53 
GeneralRe: How to call method inside another method.. Pin
Shah Satish5-Feb-07 7:55
Shah Satish5-Feb-07 7:55 
GeneralRe: How to call method inside another method.. Pin
Hamid_RT5-Feb-07 19:17
Hamid_RT5-Feb-07 19:17 
QuestionRight-click on Tree Control gives bad values. Pin
Maximilien5-Feb-07 4:22
Maximilien5-Feb-07 4:22 
AnswerRe: Right-click on Tree Control gives bad values. Pin
Gary R. Wheeler5-Feb-07 12:57
Gary R. Wheeler5-Feb-07 12:57 
QuestionUnable to export a public static member. Pin
tntlei5-Feb-07 3:30
tntlei5-Feb-07 3:30 
AnswerRe: Unable to export a public static member. Pin
tntlei5-Feb-07 3:32
tntlei5-Feb-07 3:32 
QuestionCDBVariant problem Pin
prithaa5-Feb-07 3:16
prithaa5-Feb-07 3:16 
QuestionINADDR_ANY with second socket? Pin
Dave_5-Feb-07 2:41
Dave_5-Feb-07 2:41 
AnswerRe: INADDR_ANY with second socket? Pin
Mark Salsbery5-Feb-07 5:46
Mark Salsbery5-Feb-07 5:46 
GeneralRe: INADDR_ANY with second socket? Pin
Dave_5-Feb-07 6:01
Dave_5-Feb-07 6:01 

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.