public static LTexture[][] GetSplit2Textures(LTexture image, int width, int height) { if (image == null) { return(null); } if (!image.IsLoaded()) { image.LoadTexture(); } int wlength = image.GetWidth() / width; int hlength = image.GetHeight() / height; LTexture[][] textures = (LTexture[][])CollectionUtils.XNA_CreateJaggedArray(typeof(LTexture), wlength, hlength); for (int y = 0; y < hlength; y++) { for (int x = 0; x < wlength; x++) { textures[x][y] = image.GetSubTexture((x * width), (y * height), width, height); } } return(textures); }
public static LTexture[] GetSplitTextures(LTexture image, int width, int height) { if (image == null) { return(null); } if (!image.IsLoaded()) { image.LoadTexture(); } int frame = 0; int wlength = image.GetWidth() / width; int hlength = image.GetHeight() / height; int total = wlength * hlength; LTexture[] images = new LTexture[total]; for (int y = 0; y < hlength; y++) { for (int x = 0; x < wlength; x++) { images[frame] = image.GetSubTexture((x * width), (y * height), width, height); frame++; } } return(images); }
public static LTexture[] GetDivide(string fileName, int count, int[] width, int[] height) { if (count <= 0) { throw new Exception("Divide"); } LTexture image = LTextures.LoadTexture(fileName); if (image == null) { return(null); } if (!image.IsLoaded()) { image.LoadTexture(); } if (width == null) { width = new int[count]; int w = image.GetWidth(); for (int j = 0; j < count; j++) { width[j] = w / count; } } if (height == null) { height = new int[count]; int h = image.GetHeight(); for (int i = 0; i < count; i++) { height[i] = h; } } LTexture[] images = new LTexture[count]; int offsetX = 0; for (int i = 0; i < count; i++) { images[i] = image.GetSubTexture(offsetX, 0, width[i], height[i]); offsetX += width[i]; } return(images); }
public static LTexture[] GetSplitTextures(LTexture image, int width, int height) { if (image == null) { return null; } if (!image.IsLoaded()) { image.LoadTexture(); } int frame = 0; int wlength = image.GetWidth() / width; int hlength = image.GetHeight() / height; int total = wlength * hlength; LTexture[] images = new LTexture[total]; for (int y = 0; y < hlength; y++) { for (int x = 0; x < wlength; x++) { images[frame] = image.GetSubTexture((x * width), (y * height), width, height); frame++; } } return images; }
public static LTexture[][] GetSplit2Textures(LTexture image, int width, int height) { if (image == null) { return null; } if (!image.IsLoaded()) { image.LoadTexture(); } int wlength = image.GetWidth() / width; int hlength = image.GetHeight() / height; LTexture[][] textures = (LTexture[][])CollectionUtils.XNA_CreateJaggedArray(typeof(LTexture), wlength, hlength); for (int y = 0; y < hlength; y++) { for (int x = 0; x < wlength; x++) { textures[x][y] = image.GetSubTexture((x * width), (y * height), width, height); } } return textures; }