aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Embroidery/libEmbroideryTest/libEmbroideryTest.cpp
blob: 7e1f5b01f54dbd46da40f9a083b3bee4abfc4225 (plain)
1
2
3
4
5
6
7
8
9
10
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { 
#include "stdafx.h"
#include "emb-pattern.h"
#include <iostream>
#include <iomanip>
#include "thread-color.h"

using namespace std;



int main()
{
	EmbPattern* p = embPattern_create();

	int ok = embPattern_read(p, "C:\\Users\\Roy\\Desktop\\abc.dst");

	if (ok)
	{
		cout << "Embroidery file read OK" << endl;
		cout << "Writing Stitches..." << endl;

		int stitchCount = embStitchList_count(p->stitchList);

		int t_count = embThreadList_count(p->threadList);

		for (size_t i = 0; i < t_count; i++)
		{
			EmbThread t = embThreadList_getAt(p->threadList, i);

			cout << "R: " << (int)t.color.r << ", ";
			cout << "G: " << (int)t.color.g << ", ";
			cout << "B: " << (int)t.color.b << endl;
		}

		EmbStitchList* sList = p->stitchList;

		while (sList)
		{
			EmbStitch s = sList->stitch;
			//cout << " X: " << setprecision(3) << s.xx << " Y: " << setprecision(3) << s.yy << " Color Index: " << s.color << endl;

			printf("\"%f\",\"%f\"\n", s.xx, s.yy);
			sList = sList->next;
		}

		//for (size_t i = 0; i < 1000; i++)
		//{
		//	EmbStitch stitch = embStitchList_getAt(p->stitchList, i);
		//	cout << i << " X: " << setprecision(3) << stitch.xx << " Y: " << setprecision(3) << stitch.yy << " Color Index: " << stitch.color << endl;
		//}
	}
	else
	{
		cout << "Embroidery file read failed!";
	}

	getchar();

	return 0;
}