I want to get values of R, G and B of pixels of an image. I already did it with HDC, but now I would like to complete it with Gdi+ and input image.
This is my code so far:
#include <iostream>
#include <stdlib.h>
#include <windows.h>
#include "gdiplus.h"
#include "stdio.h"
#include "iostream"
using namespace Gdiplus;
using namespace std;
void main(int argc, char* argv[])
{
Bitmap* mybitmap = new("bink.bmp");
int x=0;
int y=0;
Color pixelColor;
//Color pixelcolor[1000][1000];
for ( x = 0; x < 640; x++ )
{
for ( y = 0; y < 480; y++ )
{
//Color pixelColor[x][y] = mybitmap->GetPixel(x,y);
mybitmap->GetPixel(x,y, &pixelColor);
cout << "Pixel color " << x << ", " << y; "is " << pixelColor;
//cout << "Pixel color " << x << ", " << y; "is " << pixelColor[x][y];
}
}
}
It is not working... can You help somehow?