Logo Search packages:      
Sourcecode: djvulibre version File versions

int DjVuImage::is_legal_photo (  )  const

This function returns true if this object contains a well formed {Photo DjVu Image}. Calling function get_pixmap# on a well formed photo image should always return a non zero value. Note that function get_pixmap# works as soon as sufficient information is present, regardless of the fact that the image follows the rules or not.

Definition at line 567 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 that extra information is not present.
  if (fgjb || fgpm)
    return 0;
  // Check bg44
  if (bg44 && bg44->get_width()==width && bg44->get_height()==height)
    return 1;
  // Check bgpm
  if (bgpm && (int)bgpm->columns()==width && (int)bgpm->rows()==height)
    return 1;
  // Ok.
  return 0;
}


Generated by  Doxygen 1.6.0   Back to index