diff options
author | Trever L. Adams <trever.adams@gmail.com> | 2012-01-19 00:14:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-19 11:51:56 -0800 |
commit | c3ab5a56681873e35ef17b5eade00c29330c0201 (patch) | |
tree | b4429e76d138be1f93aae412d1586c481e509a86 | |
parent | b7621097afe1cbb4fb07fd61482e8d38716cbfa6 (diff) | |
download | pesconvert-c3ab5a56681873e35ef17b5eade00c29330c0201.tar.gz |
Fix jumpstitch output
I noticed that your thumbnailer shows jump stitches yielding some ugly
thread lines in some cases.
I have attached a patch which solves this problem. Feel free to use it,
modify it, whatever.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | cairo.c | 3 | ||||
-rw-r--r-- | pes.c | 8 | ||||
-rw-r--r-- | pes.h | 2 |
3 files changed, 8 insertions, 5 deletions
@@ -35,7 +35,8 @@ void output_cairo(struct pes *pes, const char *filename, int size, double densit for (i = 1; i < block->nr_stitches; i++) { ++stitch; - cairo_line_to(cr, X(stitch), Y(stitch)); + if(!stitch->jumpstitch) cairo_line_to(cr, X(stitch), Y(stitch)); + else cairo_move_to(cr, X(stitch), Y(stitch)); } cairo_set_line_width(cr, scale * density); cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND); @@ -169,7 +169,7 @@ static struct pes_block *new_block(struct pes *pes) return block; } -static int add_stitch(struct pes *pes, int x, int y) +static int add_stitch(struct pes *pes, int x, int y, int jumpstitch) { struct pes_block *block = pes->last; struct stitch *stitch = block->stitch; @@ -195,6 +195,7 @@ static int add_stitch(struct pes *pes, int x, int y) } stitch[nr_stitches].x = x; stitch[nr_stitches].y = y; + stitch[nr_stitches].jumpstitch = jumpstitch; block->nr_stitches = nr_stitches+1; return 0; } @@ -213,7 +214,7 @@ static int parse_pes_stitches(struct region *region, unsigned int pec, struct pe block = new_block(pes); while (p < end) { - int val1 = p[0], val2 = p[1]; + int val1 = p[0], val2 = p[1], jumpstitch = 0; p += 2; if (val1 == 255 && !val2) return 0; @@ -234,6 +235,7 @@ static int parse_pes_stitches(struct region *region, unsigned int pec, struct pe if (val1 & 2048) val1 -= 4096; val2 = *p++; + jumpstitch = 1; } else { if (val1 & 64) val1 -= 128; @@ -255,7 +257,7 @@ static int parse_pes_stitches(struct region *region, unsigned int pec, struct pe oldx = val1; oldy = val2; - if (add_stitch(pes, val1, val2)) + if (add_stitch(pes, val1, val2, jumpstitch)) return -1; } return 0; @@ -12,7 +12,7 @@ struct color { }; struct stitch { - int x, y; + int x, y, jumpstitch; }; struct pes_block { |