aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Embroidery/libEmbroideryTest/libEmbroideryTest.cpp
blob: 7e1f5b01f54dbd46da40f9a083b3bee4abfc4225 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#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;
}