/// <summary> /// Attempts to reserve a position on a texture atlas for the specified surface, and if the reservation /// is successful, blits the surface to the atlas. /// </summary> private static Boolean BlitSurfaceToDynamicTextureAtlas(DynamicTextureAtlas atlas, Surface2D surface) { if (!atlas.TryReserveCell(surface.Width, surface.Height, out var reservation)) { return(false); } surface.ProcessAlpha(true, Color.Magenta); surface.Blit(atlas.Surface, new Point2(reservation.X, reservation.Y), atlas.IsFlipped ? SurfaceFlipDirection.Vertical : SurfaceFlipDirection.None); return(true); }