Jump to content
  • Advertisement

Archived

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

Spearhawk

Extracting frame

This topic is 5816 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

I''m trying to extract a frame from a larger image but I can''t get my code to work.
  
// Extract the frame

for(y = 0; y < texHeight; y++)
{
	for(x = 0; x < texWidth * 3; x += 3)
	{
		frame[j] = bitmap->Image((texWidth*(yPos+y))+(xPos+x));
		frame[j+1] = bitmap->Image((texWidth*(yPos+y))+(xPos+x+1));
		frame[j+2] = bitmap->Image((texWidth*(yPos+y))+(xPos+x+2));
		frame[j+3] = 0;

		j += 4;
	}
}
  
texHeight and texWidth is the widht of the fram, yPos and xPos is the starting position. The bitmap is 24 bit and the frame is 32 (since I want to use the trick with alpha to construct a color key). I get no memmory failiour or such but the picture shows up all blured up. Can anyone see what''s wrong? Thanks in advance Spearhawk

Share this post


Link to post
Share on other sites
Advertisement
Nm, I figured it out


  
// Extract the frame

for(y = 0; y < texHeight; y++)
{
for(x = 0; x < texWidth * 3; x += 3)
{
frame[j] = bitmap->Image((bitmap->Width()*3*(yPos+y))+((xPos*3)+x));
frame[j+1] = bitmap->Image((bitmap->Width()*3*(yPos+y))+((xPos*3)+x)+1);
frame[j+2] = bitmap->Image((bitmap->Width()*3*(yPos+y))+((xPos*3)+x)+2);
frame[j+3] = 0;

j += 4;
}
}

Share this post


Link to post
Share on other sites

  • 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!