set Data to PixelBitmapContent - CSharp System.Drawing

CSharp examples for System.Drawing:Bitmap

Description

set Data to PixelBitmapContent

Demo Code


using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content.Pipeline.Graphics;
using System;//w w w .j a v  a 2s .  c  o m

public class Main{
        public static void setData( this PixelBitmapContent<Color> self, Color[] data )
      {
         var i = 0;
         for( var y = 0; y < self.Height; y++ )
         {
            for( var x = 0; x < self.Width; x++ )
               self.SetPixel( x, y, data[i++] );
         }
      }
}

Related Tutorials