Logo Search packages:      
Sourcecode: djvulibre version File versions

int DjVuImage::is_legal_bilevel (  )  const

This function returns true if this object contains a well formed {Bilevel DjVu Image}. Calling function get_bitmap# on a well formed bilevel image should always return a non zero value. Note that function get_bitmap# works as soon as a foreground mask component is present, regardless of the fact that the image follows the rules or not.

Definition at line 539 of file DjVuImage.cpp.

References get_bg44(), get_bgpm(), get_fgjb(), get_fgpm(), and get_info().

{
  // Components
  GP<DjVuInfo> info = get_info();
  GP<JB2Image> fgjb = get_fgjb();
  GP<IW44Image> bg44 = get_bg44();
  GP<GPixmap>  bgpm = get_bgpm();
  GP<GPixmap>  fgpm = get_fgpm();
  // Check info
  if (! info)
    return 0;
  int width = info->width;
  int height = info->height;
  if (! (width>0 && height>0))
    return 0;
  // Check fgjb
  if (!fgjb)
    return 0;
  if (fgjb->get_width()!=width || fgjb->get_height()!=height)
    return 0;
  // Check that color information is not present.
  if (bg44 || bgpm || fgpm)
    return 0;
  // Ok.
  return 1;
}


Generated by  Doxygen 1.6.0   Back to index