You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.0 KiB

1 month ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Forms;
  6. using System.Threading.Tasks;
  7. using System.Drawing;
  8. using System.Drawing.Imaging;
  9. using AForge.Controls;
  10. namespace ShenTun.Camera.AForgeL
  11. {
  12. internal class Common
  13. {
  14. public static List<ImgFormatItem> iList = new List<ImgFormatItem>();
  15. public static List<PicSizMode> GetPicSizeMode()
  16. {
  17. List<PicSizMode> picList = new List<PicSizMode>();
  18. PicSizMode p1 = new PicSizMode()
  19. {
  20. Code = 2,
  21. Name = "自动",
  22. };
  23. picList.Add(p1);
  24. PicSizMode p2 = new PicSizMode()
  25. {
  26. Code = 3,
  27. Name = "居中",
  28. };
  29. picList.Add(p2);
  30. PicSizMode p3 = new PicSizMode()
  31. {
  32. Code = 0,
  33. Name = "正常",
  34. };
  35. picList.Add(p3);
  36. PicSizMode p4 = new PicSizMode()
  37. {
  38. Code = 1,
  39. Name = "拉伸",
  40. };
  41. picList.Add(p4);
  42. PicSizMode p5 = new PicSizMode()
  43. {
  44. Code = 4,
  45. Name = "缩放",
  46. };
  47. picList.Add(p5);
  48. return picList;
  49. }
  50. public static List<ImgFormatItem> GetImageFormatList()
  51. {
  52. ImgFormatItem gif = new ImgFormatItem()
  53. {
  54. Code = ImageFormat.Gif,
  55. Name = "GIF",
  56. };
  57. iList.Add(gif);
  58. ImgFormatItem Jpeg = new ImgFormatItem()
  59. {
  60. Code = ImageFormat.Jpeg,
  61. Name = "JPEG",
  62. };
  63. iList.Add(Jpeg);
  64. ImgFormatItem png = new ImgFormatItem()
  65. {
  66. Code = ImageFormat.Png,
  67. Name = "PNG",
  68. };
  69. iList.Add(png);
  70. ImgFormatItem bmp = new ImgFormatItem()
  71. {
  72. Code = ImageFormat.Bmp,
  73. Name = "BMP",
  74. };
  75. iList.Add(bmp);
  76. ImgFormatItem wmf = new ImgFormatItem()
  77. {
  78. Code = ImageFormat.Wmf,
  79. Name = "WMF",
  80. };
  81. iList.Add(wmf);
  82. ImgFormatItem tiff = new ImgFormatItem()
  83. {
  84. Code = ImageFormat.Tiff,
  85. Name = "TIFF",
  86. };
  87. iList.Add(tiff);
  88. ImgFormatItem exif = new ImgFormatItem()
  89. {
  90. Code = ImageFormat.Exif,
  91. Name = "EXIF",
  92. };
  93. iList.Add(exif);
  94. ImgFormatItem Emf = new ImgFormatItem()
  95. {
  96. Code = ImageFormat.Emf,
  97. Name = "EMF",
  98. };
  99. iList.Add(Emf);
  100. return iList;
  101. }
  102. public static string GetImageFormatString(ImageFormat imageFormat)
  103. {
  104. ImgFormatItem item = iList.Where(p => (p.Code.Equals(imageFormat))).FirstOrDefault();
  105. return item.Name;
  106. }
  107. }
  108. }