#### Archived

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

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

## 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 on other sites
Nm, I figured it out

  // Extract the framefor(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;	}}

1. 1
Rutin
25
2. 2
3. 3
JoeJ
18
4. 4
5. 5

• 14
• 11
• 9
• 9
• 10
• ### Forum Statistics

• Total Topics
631754
• Total Posts
3002104
×