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

void GBitmap::rle_get_bitmap ( const int  ncolumns,
const unsigned char *&  runs,
unsigned char *  bitmap,
const bool  invert 
) [static]

Gets the bitmap line rle data passed. One line of pixel is stored one with 8 bits per unsigned char# in an array. The array must be large enough to hold the whole line.

Definition at line 1057 of file GBitmap.cpp.

References read_run().

Referenced by save_pbm().

{
  const int obyte_def=invert?0xff:0;
  const int obyte_ndef=invert?0:0xff;
  int mask=0x80,obyte=0;
  for(int c=ncolumns;c > 0 ;)
  {
    int x=read_run(runs);
    c-=x;
    while((x--)>0)
    {
      if(!(mask>>=1))
      {
        *(bitmap++) = obyte^obyte_def;
        obyte=0;
        mask=0x80;
        for(;x>=8;x-=8)
        {
          *(bitmap++)=obyte_def;
        }
      }
    }
    if(c>0)
    {
      int x=read_run(runs);
      c-=x;
      while((x--)>0)
      {
        obyte|=mask;
        if(!(mask>>=1))
        {
          *(bitmap++)=obyte^obyte_def;
          obyte=0;
          mask=0x80;
          for(;(x>8);x-=8)
            *(bitmap++)=obyte_ndef;
        }
      }
    }
  }
  if(mask != 0x80)
  {
    *(bitmap++)=obyte^obyte_def;
  }
}


Generated by  Doxygen 1.6.0   Back to index