diff -r c99393ba1ab2dbc9e9c8e8d9148105999c5482fb -r 214995dda98411e0f6eab4c7127ad29882ffaa12 axios.sln --- a/axios.sln Wed May 16 22:13:43 2012 -0500 +++ b/axios.sln Thu May 17 00:46:46 2012 -0500 @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +# Visual Studio 2010 Express for Windows Phone Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Axios_Windows", "axios\Axios_Windows.csproj", "{742C938F-997D-4EFD-95D2-BB09CDADCD2E}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Axios_Xbox_360", "axios\Axios_Xbox_360.csproj", "{B5664516-72B7-4BA3-9F72-25CAA90867D8}" @@ -45,6 +45,7 @@ {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Debug|Windows Phone.ActiveCfg = Debug|Xbox 360 {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Debug|Windows Phone.Build.0 = Debug|Xbox 360 {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Debug|x86.ActiveCfg = Debug|Xbox 360 + {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Debug|x86.Build.0 = Debug|Xbox 360 {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Debug|Xbox 360.ActiveCfg = Debug|Xbox 360 {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Debug|Xbox 360.Build.0 = Debug|Xbox 360 {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Release|Any CPU.ActiveCfg = Release|Xbox 360 @@ -53,6 +54,7 @@ {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Release|Windows Phone.ActiveCfg = Release|Xbox 360 {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Release|Windows Phone.Build.0 = Release|Xbox 360 {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Release|x86.ActiveCfg = Release|Xbox 360 + {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Release|x86.Build.0 = Release|Xbox 360 {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Release|Xbox 360.ActiveCfg = Release|Xbox 360 {B5664516-72B7-4BA3-9F72-25CAA90867D8}.Release|Xbox 360.Build.0 = Release|Xbox 360 {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Debug|Any CPU.ActiveCfg = Debug|Windows Phone @@ -61,14 +63,18 @@ {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Debug|Windows Phone.ActiveCfg = Debug|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Debug|Windows Phone.Build.0 = Debug|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Debug|x86.ActiveCfg = Debug|Windows Phone + {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Debug|x86.Build.0 = Debug|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Debug|Xbox 360.ActiveCfg = Debug|Windows Phone + {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Debug|Xbox 360.Build.0 = Debug|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|Any CPU.ActiveCfg = Release|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|Mixed Platforms.ActiveCfg = Release|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|Mixed Platforms.Build.0 = Release|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|Windows Phone.ActiveCfg = Release|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|Windows Phone.Build.0 = Release|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|x86.ActiveCfg = Release|Windows Phone + {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|x86.Build.0 = Release|Windows Phone {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|Xbox 360.ActiveCfg = Release|Windows Phone + {C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|Xbox 360.Build.0 = Release|Windows Phone EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff -r c99393ba1ab2dbc9e9c8e8d9148105999c5482fb -r 214995dda98411e0f6eab4c7127ad29882ffaa12 axios/Engine/Extensions/Texture2D.cs --- a/axios/Engine/Extensions/Texture2D.cs Wed May 16 22:13:43 2012 -0500 +++ b/axios/Engine/Extensions/Texture2D.cs Thu May 17 00:46:46 2012 -0500 @@ -286,6 +286,27 @@ return r; } + //Create new Texture which is a subsection of original with dimensions of partWidth and partHeight + public static Texture2D Cut(this Texture2D original, int partWidth, int partHeight) + { + Texture2D newTexture = new Texture2D(original.GraphicsDevice, partWidth, partHeight); //Create texture of new area = to subsection area + int pixelCount = partWidth * partHeight; //Number of pixels in the new texture + Color[] originalData = new Color[original.Width * original.Height]; + original.GetData(originalData); //Get the pixel data from the original texture + Color[] newData = new Color[pixelCount]; //Create pixel sheet for new texture + + for (int y = 0; y < partHeight; y++) //increment from the top-most pixel + { + for (int x = 0; x < partWidth; x++) //increment from the top-most, left-most pixel + { + int colorIndex = x + y * partWidth; //get pixel at {x, y} coordinates + newData[colorIndex] = originalData[(x + y * original.Width)]; //set the color to pixel at original {x, y} coordinates + } + } + + newTexture.SetData(newData); //set the color data for the new texture + return newTexture; //return Texture2D object cut from original + } } } \ No newline at end of file