public static GetPic ( |
||
info | ||
Résultat | void |
public void Gen2(List <BiliInterfaceInfo> infos) { Log.Info("【副榜】开始生成" + infos.Count + "个视频的图片(每3个一张图)"); foreach (BiliInterfaceInfo info in infos) { BiliInterface.GetPic(info); } for (int i = 0; i < infos.Count; i += 3) { image = Properties.Resources.fubang2; g = Graphics.FromImage(image); g.SmoothingMode = SmoothingMode.HighQuality; g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; g.PixelOffsetMode = PixelOffsetMode.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBilinear; AddPic2(infos[i], 1); if (i + 1 < infos.Count) { AddPic2(infos[i + 1], 2); } if (i + 2 < infos.Count) { AddPic2(infos[i + 2], 3); } string url = Environment.CurrentDirectory + @"\pic\Rank" + infos[i].Fpaiming + "-" + (infos[i].Fpaiming + 2) + ".png"; Log.Info("保存图片 " + url); image.Save(url); } Log.Info("副榜图片批量生成完成"); }
public void Gen(List <BiliInterfaceInfo> infos) { //Gen2(infos); //return; Log.Info("【副榜】开始生成" + infos.Count + "个视频的图片(每3个一张图)"); foreach (BiliInterfaceInfo info in infos) { BiliInterface.GetPic(info); } for (int i = 0; i < infos.Count; i += 3) { image = Properties.Resources.fubang;//Image.FromFile("fubang.png"); g = Graphics.FromImage(image); AddPic(infos[i], 1); if (i + 1 < infos.Count) { AddPic(infos[i + 1], 2); } if (i + 2 < infos.Count) { AddPic(infos[i + 2], 3); } string url = Environment.CurrentDirectory + @"\pic\Rank" + infos[i].Fpaiming + "-" + (infos[i].Fpaiming + 2) + ".jpg"; Log.Info("保存图片 " + url); image.Save(url); } Log.Info("副榜图片批量生成完成"); }
public static void GenWithTemplate(IEnumerable <BiliInterfaceInfo> binfos, Image bg, string template, int repeat, float offset, string ext = "jpg") { Zhubang zb = new Zhubang(); foreach (BiliInterfaceInfo info in binfos) { BiliInterface.GetPic(info); } List <Zhubang.TemplateInfo> tinfos = new List <Zhubang.TemplateInfo>(); for (int j = 0; j < binfos.Count(); j += repeat) { Image image = (Image)bg.Clone(); for (int i = 0; i < repeat; i++) { if (j + i >= binfos.Count()) { break; } tinfos = ParseTemplate(binfos.ElementAt(j + i), template); foreach (var tinfo in tinfos) { if (tinfo.point != null) { tinfo.point.Y += offset * i; } if (tinfo.rectangle != null) { tinfo.rectangle.Y += offset * i; } } image = zb.GenWithTemplate(image, tinfos); } string url = FileManager.currentPath + @"\pic\Rank" + binfos.ElementAt(j).Fpaiming + "-" + (binfos.ElementAt(j).Fpaiming + repeat - 1) + "." + ext; image.Save(url); image.Dispose(); } }