Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

int GBitmap::rle_get_runs ( int  rowno,
int *  rlens 
) const

Gets the lengths of all runs in line rowno#. The array rlens# must be large enough to accomodate w+2# integers where w# is the number of columns in the image. These integers represent the lengths of consecutive runs of alternatively white or black pixels. Lengths can be zero in order to allow for lines starting with black pixels. This function returns the total number of runs in the line.

Definition at line 1138 of file GBitmap.cpp.

References monitor(), and read_run().

  GMonitorLock lock(monitor());
  if (!rle)
    return 0;
  if (rowno<0 || rowno>=nrows)
    return 0;
  if (!rlerows)
    const_cast<GPBuffer<unsigned char *> &>(grlerows).resize(nrows);
    makerows(nrows,ncolumns,rle,const_cast<unsigned char **>(rlerows));
  int n = 0;
  int d = 0;
  int c = 0;
  unsigned char *runs = rlerows[rowno];
  while (c < ncolumns)
      const int x=read_run(runs);
      if (n>0 && !x)
          d = d-rlens[n];
          rlens[n++] = (c+=x)-d;
          d = c;
  return n;

Generated by  Doxygen 1.6.0   Back to index