Domanda

My name is Miguel, and I'm trying to get each single pixel in one .bmp, but so far, when i initialize the bitmap, it doesn't get any value, so i guess that i have initialized it wrong. This is my current code:(Snippet)

Bitmap *PerlinImage;

void OpenPerlinFile()
{
    PerlinImage = new Bitmap((WCHAR*)"C:\\Users\\Utilizador\\Documents\\Visual Studio 2012\\Projects\\Cube3D\\IDTech_JavaOpenGL_Port\\perlinNoise.bmp");
}

// END

void Initialize(void)
{
    OpenPerlinFile();

    Unit tempunit;
    Color color; 

    int ccount = 0;
    for (int h = 0; h != PerlinImage->GetHeight(); h++)
......

Now, can you look at my code, and maybe predict what I'm doing wrong.

Thank You

Miguel Petersen

È stato utile?

Soluzione

Invoking GdiplusStartup is needed. Also check value of PerlinImage, if it's not NULL, then you could check error with PerlinImage->GetLastStatus(). If PerlinImage is NULL, then you may forget to call GdiplusStartup.

Altri suggerimenti

Assuming you've got the path correct, the following:

PerlinImage = new Bitmap((WCHAR*)"C:\\Users\\Utilizador\\Documents\\Visual Studio 2012\\Projects\\Cube3D\\IDTech_JavaOpenGL_Port\\perlinNoise.bmp");

should be:

PerlinImage = new Bitmap(_T("C:\\Users\\Utilizador\\Documents\\Visual Studio 2012\\Projects\\Cube3D\\IDTech_JavaOpenGL_Port\\perlinNoise.bmp"));

Or, without the helper macro:

PerlinImage = new Bitmap(L"C:\\Users\\Utilizador\\Documents\\Visual Studio 2012\\Projects\\Cube3D\\IDTech_JavaOpenGL_Port\\perlinNoise.bmp");
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top