/// <summary> /// Creates a TPL from multiple images. /// Palette formats are only required for color indexed TPL formats (CI4, CI8 and CI14X2)! /// If you use a color indexed format, please provide at least one palette format. /// If you use multiple color indexed TPLs, the palette formats must have the same index as the image and tpl format! /// </summary> /// <param name="images"></param> /// <param name="tplFormats"></param> /// <returns></returns> public static TPL FromImages(Image[] images, TPL_TextureFormat[] tplFormats, TPL_PaletteFormat[] paletteFormats) { if (tplFormats.Length < images.Length) throw new Exception("You must specify a format for each image!"); TPL tmpTpl = new TPL(); tmpTpl.createFromImages(images, tplFormats, paletteFormats); return tmpTpl; }
/// <summary> /// Creates a TPL from multiple images. /// Palette formats are only required for color indexed TPL formats (CI4, CI8 and CI14X2)! /// If you use a color indexed format, please provide at least one palette format. /// If you use multiple color indexed TPLs, the palette formats must have the same index as the image and tpl format! /// </summary> /// <param name="imagePaths"></param> /// <param name="tplFormats"></param> /// <returns></returns> public static TPL FromImages(string[] imagePaths, TPL_TextureFormat[] tplFormats, TPL_PaletteFormat[] paletteFormats) { if (tplFormats.Length < imagePaths.Length) throw new Exception("You must specify a format for each image!"); List<Image> images = new List<Image>(); foreach (string imagePath in imagePaths) images.Add(Image.FromFile(imagePath)); TPL tmpTpl = new TPL(); tmpTpl.createFromImages(images.ToArray(), tplFormats, paletteFormats); return tmpTpl; }