"Magical" changing value

Started by
-1 comments, last by Destroyer 21 years, 6 months ago
Hi, The following is a snippet of code for loading in an image BMP...
  

			for(int fyindex = 0; fyindex < bmpinfo.biHeight; fyindex++)
			{
			//	int ytemp = fyindex*bmpinfo.biWidth;

				for(int fxindex = 0; fxindex < bmpinfo.biWidth; fxindex++)
				{
					UCHAR bmpbyte = 0;
					forebmpfile.read((char *)&bmpbyte, 1);
					foretempbuffer[fxindex + fyindex*bmpinfo.biWidth] = bmpbyte;			
				}
				forebmpfile.seekg(padding, ios::cur);
			}

			int fheightindex = 0;  
			for(int fy = bmpinfo.biHeight - 1;  fy >= 0; --fy)   //Flip the image

			{     
				for(int fx = 0; fx < bmpinfo.biWidth; ++fx)         
					forefinalbuffer[fheightindex*bmpinfo.biWidth + fx] = foretempbuffer[fy*bmpinfo.biWidth + fx]; 

				++fheightindex;  
			}
			delete[] foretempbuffer;

			forebmpfile.close();

			Post_Error("Color value of foreground = %i or %i", forefinalbuffer[2], foretempbuffer[2]);
  
I''m trying to load in a plain blue bmp with a value of 221 (palette index). Post_Error write values to file called Errorlog.txt and in this file I found the following... Color value of foreground = 3 or 221 Even though the two shows right in the code that the value of 221 is supposed to be assigned to both values... it shows 3. What am I missing here ? Something I did dumb I hope Thanks in advance, Destroyer

This topic is closed to new replies.

Advertisement