using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading.Tasks; using System.Drawing; using System.Drawing.Imaging; using AForge.Controls; namespace ShenTun.Camera.AForgeL { internal class Common { public static List iList = new List(); public static List GetPicSizeMode() { List picList = new List(); PicSizMode p1 = new PicSizMode() { Code = 2, Name = "自动", }; picList.Add(p1); PicSizMode p2 = new PicSizMode() { Code = 3, Name = "居中", }; picList.Add(p2); PicSizMode p3 = new PicSizMode() { Code = 0, Name = "正常", }; picList.Add(p3); PicSizMode p4 = new PicSizMode() { Code = 1, Name = "拉伸", }; picList.Add(p4); PicSizMode p5 = new PicSizMode() { Code = 4, Name = "缩放", }; picList.Add(p5); return picList; } public static List GetImageFormatList() { ImgFormatItem gif = new ImgFormatItem() { Code = ImageFormat.Gif, Name = "GIF", }; iList.Add(gif); ImgFormatItem Jpeg = new ImgFormatItem() { Code = ImageFormat.Jpeg, Name = "JPEG", }; iList.Add(Jpeg); ImgFormatItem png = new ImgFormatItem() { Code = ImageFormat.Png, Name = "PNG", }; iList.Add(png); ImgFormatItem bmp = new ImgFormatItem() { Code = ImageFormat.Bmp, Name = "BMP", }; iList.Add(bmp); ImgFormatItem wmf = new ImgFormatItem() { Code = ImageFormat.Wmf, Name = "WMF", }; iList.Add(wmf); ImgFormatItem tiff = new ImgFormatItem() { Code = ImageFormat.Tiff, Name = "TIFF", }; iList.Add(tiff); ImgFormatItem exif = new ImgFormatItem() { Code = ImageFormat.Exif, Name = "EXIF", }; iList.Add(exif); ImgFormatItem Emf = new ImgFormatItem() { Code = ImageFormat.Emf, Name = "EMF", }; iList.Add(Emf); return iList; } public static string GetImageFormatString(ImageFormat imageFormat) { ImgFormatItem item = iList.Where(p => (p.Code.Equals(imageFormat))).FirstOrDefault(); return item.Name; } } }