c# - get only 1 pixel's color from a texture2D -
c# - get only 1 pixel's color from a texture2D -
currently, i'm using method pixels' color of texture2d
color[] pixelcolours = new color[mytexture.width*mytexture.height]; mytexture.getdata<color>(pixelcolours);
as can see, store every pixels' color in tab. the texture2d pretty huge : 1000 pixels x 1000 pixels. but need 1 pixel's color, means store 999.999 useless others pixels. the pixel's position on texture2d moving, code in update() method. are there others ways 1 pixel fast low memory cost ?
the getdata method overloaded , allows specify starting pixel , how many elements get: http://msdn.microsoft.com/en-us/library/bb197093.aspx.
c# colors xna texture2d
Comments
Post a Comment