get_row_run_lengths() now fills in an array of run_t to provide more information.

Sun, 23 Feb 2003 17:40:41 +0000

author
eric
date
Sun, 23 Feb 2003 17:40:41 +0000
changeset 72
cddd6226b509
parent 71
3e2d23e25fc3
child 73
6e306105c128

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