I have no clue how this function is used, i only know its parameters. Can anyone tell me how its supposed to be implemented? I've searched all kinds of places to figure it out but i cant find anything lol
I have no clue how this function is used, i only know its parameters. Can anyone tell me how its supposed to be implemented? I've searched all kinds of places to figure it out but i cant find anything lol
At a guess I would say that it would return the ARGB colour value at a co-ord.
[edit] At least that is what the name would suggest [/edit]
Is this what you were looking for?
http://msdn2.microsoft.com/en-us/lib...wt(VS.71).aspx
no, like what to include in order to use it, and do i have to do anything else to use it as well?
Did you not take the time to look on the site? It's a member of the CImage class. All the requirements are on this page.
http://msdn2.microsoft.com/en-us/lib...y5(VS.80).aspx
Could MSDN be any slower, geez. But to answer your question that function returns a long word with the Red Green and Blue value of a pixel in an unsigned long value at the given coordinate. How you use it is up to you, you call the function and do something with it.
I would think that an image editing program could implement a color dropper, burn, etc tool to change the color of the pixels around it, and many other implementations I assume.
here's the definition of COLORREF to show you how to interpret the value returned
http://msdn2.microsoft.com/en-us/library/aa923096.aspx
Last edited by indigo0086; 07-03-2007 at 10:13 AM.
ok i finally found an article that's sort of about GetPixel(), and this is what it had in the example:
and he included windows.h for it, but when i run this code i get an error that says "Undefined reference to GetPixel@12". Anyone know what might be wrong there?Code:int x,y; unsigned char pixels[30][100]; HDC hdc = GetDC(NULL); for(y=SY;y<SY+30;y++) for(x=SX;y<SX+100;x++) if(GetPixel(hdc,x,y)==0) cout << "black" << endl;
You need to add the "gdi32.lib" in your project properties
* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.
now it says build error and thats it
What compiler and ide are you using. if you are using msw you have to include "gdi32.lib", if you are using gcc/g++ you have to use "gdi32lib.a". Most IDEs allow you to just put "gdi32. And it will look in the library path for it, others may not.
I'm using dev c++ and i dont really know what the ide is, i think its mingw/gcc or something like that
okay, there should be a place where you can change the build options of a project. Look for "linker settings" or "library settings" and add "gdi32"
I already had that there but it was "gdi32.lib" and it comes with this exact error
and its the same when i take .lib offCode:C:\Dev-Cpp\Makefile.win [Build Error] ["HTS] Error 1
Under Tools -> Compiler Options
Check the box for: Add these commands to the linker command line
and then add: -lgdi32
ok i got it, i didnt need to put it in the project properties, i had to put it where swoopy specified