axiosengine 

axiosengine Commit Details


Date:2012-05-17 00:46:46 (12 years 4 months ago)
Author:Bret Deasy
Branch:master
Commit:f2272b05558f2ad1902b05979272c77e5d56ed8e
Parents: 184247003bcd1600c5b61b3643cb47031a93b74b
Message:Adding Cut extension method to Texture2D.cs Will create a subTexture of Width & Height from top-left

Changes:

File differences

axios.sln
11
22
3
3
44
55
66
......
4545
4646
4747
48
4849
4950
5051
......
5354
5455
5556
57
5658
5759
5860
......
6163
6264
6365
66
6467
68
6569
6670
6771
6872
6973
7074
75
7176
77
7278
7379
7480

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}"
{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
{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
{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
axios/Engine/Extensions/Texture2D.cs
286286
287287
288288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
289310
290311
291312
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<Color>(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<Color>(newData); //set the color data for the new texture
return newTexture; //return Texture2D object cut from original
}
}
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.06599s using 14 queries.