private void Run(string[] args) { int imageWidth = 1920; int imageHeighht = 1080; CorImage image = new CorImage(imageWidth, imageHeighht, Color.White); //InsertGridAndMarkers(image); string dragon = LevelUp("R"); dragon = LevelUp(dragon); dragon = LevelUp(dragon); dragon = LevelUp(dragon); dragon = LevelUp(dragon); dragon = LevelUp(dragon); dragon = LevelUp(dragon); dragon = LevelUp(dragon); dragon = LevelUp(dragon); dragon = LevelUp(dragon); dragon = LevelUp(dragon); dragon = LevelUp(dragon); //dragon = LevelUp(dragon); List <NavUnit> list = new List <NavUnit>(); list.Drive(dragon, Direction.North, 0, 0, 8, 8); list.CentreGraph(imageWidth, imageHeighht, 10); list.FitGraph(imageWidth, imageHeighht, 10); list.CentreGraph(imageWidth, imageHeighht, 10); list.Draw(image, 1, CurveType.Line); image.Save(@"d:\numbers\philip\dragonL.png", ImageFormat.Png); }
private static void InsertGridAndMarkers(CorImage image) { Pen pen = new Pen(Color.Gray, 1F) { DashStyle = DashStyle.Dot }; for (int i = 0; i < image.Width; i += 10) { image.Graphics.DrawLine(pen, i, 0, i, image.Height); if (i % 50 == 0) { image.DrawString(i.ToString(), "Consolas", 8F, Color.Gray, i, 0); } } for (int i = 10; i < image.Height; i += 10) { image.Graphics.DrawLine(pen, 0, i, image.Width, i); if (i % 50 == 0) { image.DrawString(i.ToString(), "Consolas", 8F, Color.Gray, 0, i); } } }
private void Run(string[] args) { string versionFile = @"d:\numbers\philip\pv.txt"; int version = int .Parse (File .ReadAllText (versionFile ) ) ; string map = args[0]; int imageWidth = int.Parse(args[1]); int imageHeight = int.Parse(args[2]); float unitWidth = float.Parse(args[3]); float unitHeight = float.Parse(args[4]); float lineWidth = float.Parse(args[5]); float borderPixels = float.Parse(args[6]); int level = 5; float levelEmSize = 18.5F; CurveType curveType = CurveType.ZigZag; CorImage image = new CorImage(imageWidth, imageHeight, Color.White); SizeF sizeF = image.MeasureString(level.ToString(), "arial", levelEmSize); image .DrawString (level.ToString() , "arial" , levelEmSize , Color.Black , imageWidth / 2 - sizeF.Width / 2 , imageHeight / 2 - sizeF.Height / 2 ) ; List <NavUnit> navUnits = new List <NavUnit>(level); PhilipFractal philipFractal = new PhilipFractal(); map = philipFractal.Map(level); ConDeb.Print(map.ToUpper()); navUnits .Drive (map , Direction.West , 0 , 0 , unitWidth , unitHeight ) ; List <Color> colors = SetupColors(); ColorGradientFactory cgf = new ColorGradientFactory (colors.ToArray() ) ; navUnits.CentreGraph(imageWidth, imageHeight, borderPixels); navUnits.FitGraph(imageWidth, imageHeight, 10); navUnits.Draw(image, lineWidth, curveType, cgf); //image.DrawString("Hello", "Arial", 100.5F, Color.Black, 0, 0); image.Save(@"d:\numbers\philip\newphilip" + curveType.ToString() + level.ToString() + version.ToString() + ".gif", ImageFormat.Gif); image.Dispose(); version++; File.WriteAllText(versionFile, version.ToString()); }