private void ClipSprite <TSurface, TSource>(string spriteName, string spritesheet, Rectangle spriteBounds, IGraphicsContext <TSurface, TSource> graphicsContext, ISpriteManager <TSource> spriteManager) { TSurface target = graphicsContext.CreateTarget(spriteBounds.Width, spriteBounds.Height); graphicsContext.Draw(spriteManager[spritesheet], target, new Rectangle(0, 0, spriteBounds.Width, spriteBounds.Height), spriteBounds); spriteManager[spriteName] = graphicsContext.TargetToSource(target); }
public TSource TargetToSource(TSurface target) => GraphicsContext.TargetToSource(target);