Reputation: 1292
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
Upvotes: 0
Views: 526
Reputation: 16
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.
Upvotes: 0
Reputation: 27214
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");
Upvotes: 1