diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-10 14:49:12 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-05-10 14:49:12 +0300 |
| commit | e5200c6ba6a1b13525cc1261992ad61b03f93951 (patch) | |
| tree | 3035ae63f69ceeafe0e4ee1fc329d14010269455 /Software/Visual_Studio/Tango.UnitTesting/Pulse | |
| parent | 5217f784963202cdf07b05930f17ced91d423652 (diff) | |
| download | Tango-e5200c6ba6a1b13525cc1261992ad61b03f93951.tar.gz Tango-e5200c6ba6a1b13525cc1261992ad61b03f93951.zip | |
Implemented TWN & TCC Import on PPC.
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting/Pulse')
| -rw-r--r-- | Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs | 42 |
1 files changed, 42 insertions, 0 deletions
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(); + } } } |
