Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in source code about reading intensities of pixel

Status
Not open for further replies.

kan13

Technical User
Mar 4, 2003
6
0
0
MU
Hi everyone
I’m doing a project on reading the intensity of 256 grey-level bitmap. I’ve written a source code but the problem is that I am getting 1 error. It says that GetPixel function does not take 2 parameters. I’m not being able to correct it. Please help me.
Thank you.

Below is the source code:

/*in View.h*/
// Implementation
public:
unsigned int i[25][100];
int x,b;
int Get_Intensity(int);
COLORREF GetPixel (int, int);


/* in View.cpp */
#define MAX 100

void Get_Intensity(int i[25][100])
{
int x,y,FirstX,FirstY,LastX, LastY, Interval,count,Z;

x=0;
y=0;

FirstX = x+50;
FirstY = y+50;

LastX = FirstX + 394;
LastY = FirstY +100;

Interval = (LastX - FirstX)/25;


for (count = FirstX+Interval; count <= LastX;
(count=count+Interval)++)
{
for (int Z = FirstY; Z <= LastY; Z++)
{
i[count][Z] = GetPixel(count, Z);

}

}

}



int main()
{
int i[25][MAX];

for (int x=0; x<25; x++)
for (int b=0; b<MAX; b++)
i[x]=0;


return 0;
}
 
Straight from MSDN:

The GetPixel function retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.

COLORREF GetPixel(
HDC hdc, // handle to DC
int nXPos, // x-coordinate of pixel
int nYPos // y-coordinate of pixel
);

rgds
Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top