summaryrefslogtreecommitdiffstats
path: root/pes.h
blob: b132773d287e450e80eab035f0cf0ca6ae00010d (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
#ifndef PES_H
#define PES_H

struct region {
	const void *ptr;
	unsigned int size;
};

struct color {
	const char *name;
	unsigned char r,g,b;
};

struct stitch {
	int x, y, jumpstitch;
};

struct pes_block {
	struct pes_block *next;
	struct color *color;
	int nr_stitches, max_stitches;
	struct stitch *stitch;
};

struct pes {
	int nr_colors;
	int min_x, max_x, min_y, max_y;
	struct pes_block *blocks, *last;
};

/* Input */
int read_file(int fd, struct region *region);
int read_path(const char *path, struct region *region);
int parse_pes(struct region *region, struct pes *pes);

/* Output */
void output_svg(struct pes *pes);
void output_png(struct pes *pes);
void output_cairo(struct pes *pes, const char *filename, int size, double density);

#endif /* PES_H */