public void DrawByName(string name, string exportPath, string logoName, string splitString, string exportSplitString, bool isScaleAll) { if (!Directory.Exists(exportPath)) { Directory.CreateDirectory(exportPath); } // get list logo order behind main logo ScriptConfig config = props.ScriptConfig; List <ScriptObject> logoList = config.LogoList.OrderBy(p => p.Order).ToList(); string[] names = name.Trim().Split(new string[] { splitString }, StringSplitOptions.None); string exportName = name.Replace(splitString, exportSplitString); for (int i = 0; i < names.Length; i++) { ScriptObject obj = logoList[i]; string fontPath = props.LogoRootPath + obj.FontName; Font ff = GetCustomFont(fontPath, obj.FontSize); { Layer layer = new Layer(new LayerText(names[i], ff, obj.FontSize, LogoUtil.ConvertStringToColor(obj.TextColor) , (int)obj.OutlineSize, LogoUtil.ConvertStringToColor(obj.OutlineColorHex) , (LineJoin)obj.LineJoin)); layer.UpdateLayer(obj.LogoPosition, obj.LogoScale, obj.LogoRotation, obj.LogoContainer); layerManager.AddTextLayer(layer); } } if (logoList.Count > 0) { layerManager.ExportImage(exportPath + exportName + ".png", new Size(2400, 3200), isScaleAll); } }
public void DrawByName(string name, string exportPath, string logoName) { try { if (!Directory.Exists(exportPath)) { Directory.CreateDirectory(exportPath); } // get list logo order behind main logo ScriptConfig config = props.ScriptConfig; List <ScriptObject> logoList = config.LogoList.OrderBy(p => p.Order).ToList(); string[] names = name.Trim().Split(new string[] { Settings.Default.SplitString }, StringSplitOptions.None); string exportName = name.Replace(Settings.Default.SplitString, Settings.Default.ExportSplitString); for (int i = 0; i < names.Length; i++) { ScriptObject obj = logoList[i]; string fontPath = props.LogoRootPath + obj.FontName; Font ff = GetCustomFont(fontPath, obj.FontSize); { AutoArtist.Model.Layer layer = new AutoArtist.Model.Layer(new AutoArtist.Model.LayerText(names[i], ff, obj.FontSize, LogoUtil.ConvertStringToColor(obj.TextColor) , (int)obj.OutlineSize, LogoUtil.ConvertStringToColor(obj.OutlineColorHex) , (LineJoin)obj.LineJoin)); layer.UpdateLayer(obj.LogoPosition, obj.LogoScale, obj.LogoRotation, obj.LogoContainer); layerManager.AddTextLayer(layer); } } if (logoList.Count > 0) { layerManager.ExportImage(exportPath + exportName + ".png", new Size(2400, 3200), config.AutoScaleAll); } else { System.Windows.Forms.MessageBox.Show("Cannot found any logo info!"); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Error: " + ex.Message); } }