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

void GRectMapper::map ( int &  x,
int &  y 
)

Maps a point according to the affine transform. Variables x# and y# initially contain the coordinates of a point. This operation overwrites these variables with the coordinates of a second point located in the same position relative to the corners of the output rectangle as the first point relative to the matching corners of the input rectangle. Coordinates are rounded to the nearest integer.

Definition at line 381 of file GRect.cpp.

References GRect::xmax, GRect::xmin, GRect::ymax, and GRect::ymin.

Referenced by map(), GMapOval::map(), GMapPoly::map(), GMapRect::map(), DjVuImage::map(), and DjVuToPS::print().

{
  int mx = x;
  int my = y;
  // precalc
  if (! (rw.p && rh.p))
    precalc();
  // swap and mirror
  if (code & SWAPXY)
    iswap(mx,my);
  if (code & MIRRORX)
    mx = rectFrom.xmin + rectFrom.xmax - mx;
  if (code & MIRRORY)
    my = rectFrom.ymin + rectFrom.ymax - my;
  // scale and translate
  x = rectTo.xmin + (mx - rectFrom.xmin) * rw;
  y = rectTo.ymin + (my - rectFrom.ymin) * rh;
}


Generated by  Doxygen 1.6.0   Back to index