Jump to content
  • Advertisement

Archived

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

Destroyer

"Magical" changing value

This topic is 5817 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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;
					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

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!