diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-12 09:00:21 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-12 09:00:21 +0300 |
| commit | 78e431cbb1e3b92f7b831bd20d6dc5690e4fbfa4 (patch) | |
| tree | cb2b2787e7c535a1e1fa0426504be4f83ad47515 /Software/Visual_Studio/Tango.UnitTesting | |
| parent | df6b48edee60137b1ed06586ffdaf47ea47cb4aa (diff) | |
| parent | a452b4d94bc1fd5cd8f8605049fa34a0e8ab4766 (diff) | |
| download | Tango-78e431cbb1e3b92f7b831bd20d6dc5690e4fbfa4.tar.gz Tango-78e431cbb1e3b92f7b831bd20d6dc5690e4fbfa4.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting')
| -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(); + } } } |
