C++ Question

tank171

Member
May 27, 2007
93
0
0
How do I have the computer look at a certain pixel in a picture, then tell me what color it is? Then after that, how do I have it change that pixel's color? In c++, of course.
 

tank171

Member
May 27, 2007
93
0
0
I am using Windows XP. And, no, I dont have any specific API that I want to use, just as long as it works.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Originally posted by: tank171
How do I have the computer look at a certain pixel in a picture, then tell me what color it is? Then after that, how do I have it change that pixel's color? In c++, of course.

Far too general a question, and not really a C++ topic. Image formats vary greatly, as do bit-depths and buffer layout within formats. You'll either have to use a general purpose lib as suggested above, or post some more details about the image format and operating environment.
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Originally posted by: programmer
The Win32 API has GetPixel (http://msdn2.microsoft.com/en-us/library/ms532282.aspx). The Win32 API is of course C, but you can add all the extra C++ you want on top of it.

An interesting tutorial that wraps similar stuff in C++ at
http://www.relisoft.com/win32/bitmap.html

Yeah, but to use that API you need to have the image loaded into a device context. I assume that if the OP could get that done he wouldn't have needed to ask the question :).