public RECT GrabSprite(int xFrame, int yFrame)
{
#if TRACE
GraphicsEngine.Profiler.Start("DirectDrawSpriteSurface.GrabSprite(int, int)");
#endif
if (xFrame < 0 || xFrame >= animationFrames ||
yFrame < 0 || yFrame >= animationTypes)
{
throw new Exception("Sprite request is out of range");
}
var spriteRect = new RECT();
spriteRect.Top = yFrame*frameHeight;
spriteRect.Bottom = spriteRect.Top;
spriteRect.Bottom += frameHeight;
spriteRect.Left = xFrame*frameWidth;
spriteRect.Right = spriteRect.Left;
spriteRect.Right += frameWidth;
#if TRACE
GraphicsEngine.Profiler.End("DirectDrawSpriteSurface.GrabSprite(int, int)");
#endif
return spriteRect;
}