Nez.TextureAtlasGenerator.TextureAtlasPacker.copySpritesToOutput C# (CSharp) Метод

copySpritesToOutput() статический приватный Метод

Once the arranging is complete, copies the bitmap data for each sprite to its chosen position in the single larger output bitmap.
static private copySpritesToOutput ( List sprites, IList sourceSprites, ICollection outputSprites, int width, int height ) : PixelBitmapContent
sprites List
sourceSprites IList
outputSprites ICollection
width int
height int
Результат PixelBitmapContent
		static PixelBitmapContent<Color> copySpritesToOutput( List<ArrangedSprite> sprites, IList<BitmapContent> sourceSprites,
		                                               ICollection<Rectangle> outputSprites, int width, int height )
		{
			var output = new PixelBitmapContent<Color>( width, height );

			foreach( var sprite in sprites )
			{
				var source = sourceSprites[sprite.index];

				var x = sprite.x;
				var y = sprite.y;

				var w = source.Width;
				var h = source.Height;

				// Copy the main sprite data to the output sheet.
				BitmapContent.Copy( source, new Rectangle( 0, 0, w, h ), output, new Rectangle( x + 1, y + 1, w, h ) );

				// Copy a border strip from each edge of the sprite, creating
				// a one pixel padding area to avoid filtering problems if the
				// sprite is scaled or rotated.
				BitmapContent.Copy( source, new Rectangle( 0, 0, 1, h ), output, new Rectangle( x, y + 1, 1, h ) );
				BitmapContent.Copy( source, new Rectangle( w - 1, 0, 1, h ), output, new Rectangle( x + w + 1, y + 1, 1, h ) );
				BitmapContent.Copy( source, new Rectangle( 0, 0, w, 1 ), output, new Rectangle( x + 1, y, w, 1 ) );
				BitmapContent.Copy( source, new Rectangle( 0, h - 1, w, 1 ), output, new Rectangle( x + 1, y + h + 1, w, 1 ) );

				// Copy a single pixel from each corner of the sprite, filling in the corners of the one pixel padding area.
				BitmapContent.Copy( source, new Rectangle( 0, 0, 1, 1 ), output, new Rectangle( x, y, 1, 1 ) );
				BitmapContent.Copy( source, new Rectangle( w - 1, 0, 1, 1 ), output, new Rectangle( x + w + 1, y, 1, 1 ) );
				BitmapContent.Copy( source, new Rectangle( 0, h - 1, 1, 1 ), output, new Rectangle( x, y + h + 1, 1, 1 ) );
				BitmapContent.Copy( source, new Rectangle( w - 1, h - 1, 1, 1 ), output, new Rectangle( x + w + 1, y + h + 1, 1, 1 ) );

				// Remember where we placed this sprite.
				outputSprites.Add( new Rectangle( x + 1, y + 1, w, h ) );
			}

			return output;
		}