Archived

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

Spearhawk

Extracting frame

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