Sun, 23 Feb 2003 17:40:41 +0000
get_row_run_lengths() now fills in an array of run_t to provide more information.
bitblt.c | file | annotate | diff | revisions | |
bitblt.h | file | annotate | diff | revisions |
1.1 --- a/bitblt.c Sat Feb 22 10:02:06 2003 +0000 1.2 +++ b/bitblt.c Sun Feb 23 17:40:41 2003 +0000 1.3 @@ -4,7 +4,7 @@ 1.4 * will be compressed using ITU-T T.6 (G4) fax encoding. 1.5 * 1.6 * bitblt routines 1.7 - * $Id: bitblt.c,v 1.12 2003/02/20 04:11:06 eric Exp $ 1.8 + * $Id: bitblt.c,v 1.13 2003/02/23 09:40:41 eric Exp $ 1.9 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 1.10 * 1.11 * This program is free software; you can redistribute it and/or modify 1.12 @@ -730,7 +730,7 @@ 1.13 int32_t y, 1.14 int32_t min_x, int32_t max_x, 1.15 int32_t max_runs, 1.16 - uint32_t *run_length) 1.17 + run_t *runs) 1.18 { 1.19 uint8_t *byte_ptr; 1.20 uint8_t byte; 1.21 @@ -742,6 +742,7 @@ 1.22 1.23 uint8_t pol = 0x00; /* 0x00 = counting zeros (white), 1.24 0xff = counting ones (black) */ 1.25 + int32_t left = 0; /* left x coordinate of current run, relative */ 1.26 1.27 uint32_t rl; 1.28 int32_t i = 0; 1.29 @@ -780,7 +781,11 @@ 1.30 if (last_flag) 1.31 { 1.32 if (rl) 1.33 - run_length [i++] = rl; 1.34 + { 1.35 + runs [i].value = pol; 1.36 + runs [i].left = left; 1.37 + runs [i++].width = rl; 1.38 + } 1.39 return (i); 1.40 } 1.41 bit_pos = 0; 1.42 @@ -794,7 +799,10 @@ 1.43 } 1.44 else 1.45 { 1.46 - run_length [i++] = rl; 1.47 + runs [i].value = pol; 1.48 + runs [i].left = left; 1.49 + runs [i++].width = rl; 1.50 + left += rl; 1.51 if (i == max_runs) 1.52 return (-i); 1.53 rl = 0;
2.1 --- a/bitblt.h Sat Feb 22 10:02:06 2003 +0000 2.2 +++ b/bitblt.h Sun Feb 23 17:40:41 2003 +0000 2.3 @@ -4,7 +4,7 @@ 2.4 * will be compressed using ITU-T T.6 (G4) fax encoding. 2.5 * 2.6 * bitblt routines 2.7 - * $Id: bitblt.h,v 1.11 2003/02/20 04:11:06 eric Exp $ 2.8 + * $Id: bitblt.h,v 1.12 2003/02/23 09:40:41 eric Exp $ 2.9 * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com> 2.10 * 2.11 * This program is free software; you can redistribute it and/or modify 2.12 @@ -115,8 +115,16 @@ 2.13 * Returns the actual number of runs counted, or -max_runs if there 2.14 * was not enough room in the array. 2.15 */ 2.16 + 2.17 +typedef struct 2.18 +{ 2.19 + bool value; 2.20 + int32_t left; 2.21 + uint32_t width; 2.22 +} run_t; 2.23 + 2.24 int32_t get_row_run_lengths (Bitmap *src, 2.25 int32_t y, 2.26 int32_t min_x, int32_t max_x, 2.27 int32_t max_runs, 2.28 - uint32_t *run_length); 2.29 + run_t *runs);