Logo Search packages:      
Sourcecode: djvulibre version File versions

void GPixmap::init ( const GPixmap ref,
const GRect rect 

Resets the GPixmap by copying the rectangle rect# of the color image ref#. The previous content of the GPixmap is discarded.

Definition at line 390 of file GPixmap.cpp.

References columns(), GRect::height(), init(), rows(), GRect::width(), GRect::xmin, and GRect::ymin.

  init(rect.height(), rect.width(), 0);
  // compute destination rectangle
  GRect rect2(0, 0, ref.columns(), ref.rows() );
  rect2.intersect(rect2, rect);
  rect2.translate(-rect.xmin, -rect.ymin);
  // copy bits
  if (! rect2.isempty())
    for (int y=rect2.ymin; y<rect2.ymax; y++)
      GPixel *dst = (*this)[y];
      const GPixel *src = ref[y+rect.ymin] + rect.xmin;
      for (int x=rect2.xmin; x<rect2.xmax; x++)
        dst[x] = src[x];

Generated by  Doxygen 1.6.0   Back to index