From e5200c6ba6a1b13525cc1261992ad61b03f93951 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Fri, 10 May 2019 14:49:12 +0300 Subject: Implemented TWN & TCC Import on PPC. --- .../Tango.UnitTesting/Pulse/Pulse_TST.cs | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs index 073841997..65bb31208 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs @@ -82,5 +82,47 @@ namespace Tango.UnitTesting.Pulse Helper.ShowInExplorer(imgFile); } + + [TestMethod] + public void Create_Twn_Sample_File() + { + String abcFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "ABC.dst"); + + TwnFile twnFile = new TwnFile(); + twnFile.Name = "My design"; + twnFile.NumberOfCopies = 1; + twnFile.MediaID = 0; + twnFile.SpoolingMethod = SpoolingMethods.SpoolPerSegment; + + Bitmap thumbnail = new Bitmap(1280, 720); + using (Graphics g = Graphics.FromImage(thumbnail)) + { + g.Clear(Color.Gray); + g.DrawString("My design", new Font(new FontFamily("Arial"), 70), Brushes.Red, 1280 / 2, 720 / 2); + } + twnFile.Thumbnail = thumbnail; + + twnFile.EmbroideryFileFormat = "dst"; + twnFile.EmbroideryFile = File.ReadAllBytes(abcFile); + + //Add gradient segment. + TwnSegment gradientSegment = new TwnSegment(); + gradientSegment.Length = 100 * 10; //10 meters. + gradientSegment.BrushStops.Add(new TwnStop(255, 0, 0, 0)); //0% + gradientSegment.BrushStops.Add(new TwnStop(0, 0, 255, 1)); //100% + twnFile.Segments.Add(gradientSegment); + + //Add solid segment. + TwnSegment solidSegment = new TwnSegment(); + solidSegment.Length = 100 * 20; //20 meters. + solidSegment.BrushStops.Add(new TwnStop(0, 255, 0, 0)); + twnFile.Segments.Add(solidSegment); + + var twnFilePath = TemporaryManager.Default.CreateFile(".twn"); + + twnFile.ToFile(twnFilePath); + + twnFilePath.Display(); + } } } -- cgit v1.3.1