Logo Search packages:      
Sourcecode: djvulibre version File versions

int GRect::intersect ( const GRect rect1,
const GRect rect2 
)

Sets the rectangle to the intersection of rectangles rect1# and rect2#. This function returns true if the intersection rectangle is not empty.

Definition at line 148 of file GRect.cpp.

References isempty(), xmax, xmin, ymax, and ymin.

Referenced by contains(), DjVuTXT::find_text_in_rect(), and DjVuToPS::print().

{
  xmin = imax(rect1.xmin, rect2.xmin);
  xmax = imin(rect1.xmax, rect2.xmax);
  ymin = imax(rect1.ymin, rect2.ymin);
  ymax = imin(rect1.ymax, rect2.ymax);
  if (! isempty()) 
    return 1;
  xmin = ymin = xmax = ymax = 0;
  return 0;
}


Generated by  Doxygen 1.6.0   Back to index