This topic is now archived and is closed to further replies.


"Magical" changing value

Recommended Posts

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; *)&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]; 

			delete[] foretempbuffer;


			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

Share this post

Link to post
Share on other sites