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

void GBitmap::save_rle ( ByteStream bs  ) 

Saves the image into ByteStream bs# using the RLE file format. The image is saved as a bilevel image. All non zero pixels are considered black pixels. See section {PNM and RLE file formats}.

Definition at line 1010 of file GBitmap.cpp.

References GUTF8String::format(), GBaseString::length(), monitor(), and ByteStream::writall().

  // checks
  if (ncolumns==0 || nrows==0)
    G_THROW( ERR_MSG("GBitmap.not_init") );
  GMonitorLock lock(monitor());
  if (grays > 2)
    G_THROW( ERR_MSG("GBitmap.cant_make_PBM") );
  // header
  GUTF8String head;
  head.format("R4\n%d %d\n", ncolumns, nrows);
  bs.writall((void*)(const char *)head, head.length());
  // body
  if (rle)
      bs.writall((void*)rle, rlelength);
      unsigned char *runs = 0;
      GPBuffer<unsigned char> gruns(runs);
      int size = encode(runs,gruns);
      bs.writall((void*)runs, size);

Generated by  Doxygen 1.6.0   Back to index