src/textord/bbgrid.cpp
Image TraceOutlineOnReducedPix(C_OUTLINE *outline, int gridsize, ICOORD bleft, int *left,
                              int *bottom) {
  const TBOX &box = outline->bounding_box();
  Image pix = GridReducedPix(box, gridsize, bleft, left, bottom);
  int wpl = pixGetWpl(pix);
  l_uint32 *data = pixGetData(pix);
  int length = outline->pathlength();
  ICOORD pos = outline->start_pos();
  for (int i = 0; i < length; ++i) {
    int grid_x = (pos.x() - bleft.x()) / gridsize - *left;
    int grid_y = (pos.y() - bleft.y()) / gridsize - *bottom;
    SET_DATA_BIT(data + grid_y * wpl, grid_x);
    pos += outline->step(i);
  }
  return pix;
}
// Helper function to return a scaled Pix with one pixel per grid cell,
// set (black) where the given outline enters the corresponding grid cell,
// and clear where the outline does not touch the grid cell.
// Also returns the grid coords of the bottom-left of the Pix, in *left
// and *bottom, which corresponds to (0, 0) on the Pix.
// Note that the Pix is used upside-down, with (0, 0) being the bottom-left.
Helper function to return a scaled Pix with one pixel per grid cell,
set (black) where the given outline enters the corresponding grid cell,
and clear where the outline does not touch the grid cell.
Also returns the grid coords of the bottom-left of the Pix, in *left
and *bottom, which corresponds to (0, 0) on the Pix.
Note that the Pix is used upside-down, with (0, 0) being the bottom-left.
Helper function to return a scaled Pix with one pixel per grid cell set ( black ) where the given outline enters the corresponding grid cell and clear where the outline does not touch the grid cell . Also returns the grid coords of the bottom - left of the Pix in * left and * bottom which corresponds to ( 0 0 ) on the Pix . Note that the Pix is used upside - down with ( 0 0 ) being the bottom - left .
Image TraceOutlineOnReducedPix(C_OUTLINE *outline, int gridsize, ICOORD bleft, int *left,
                              int *bottom) {
  const TBOX &box = outline->bounding_box();
  Image pix = GridReducedPix(box, gridsize, bleft, left, bottom);
  int wpl = pixGetWpl(pix);
  l_uint32 *data = pixGetData(pix);
  int length = outline->pathlength();
  ICOORD pos = outline->start_pos();
  for (int i = 0; i < length; ++i) {
    int grid_x = (pos.x() - bleft.x()) / gridsize - *left;
    int grid_y = (pos.y() - bleft.y()) / gridsize - *bottom;
    SET_DATA_BIT(data + grid_y * wpl, grid_x);
    pos += outline->step(i);
  }
  return pix;
}
Image TraceOutlineOnReducedPix ( C_OUTLINE * outline , int gridsize , ICOORD bleft , int * left , int * bottom ) { const TBOX & box = outline -> bounding_box ( ) ; Image pix = GridReducedPix ( box , gridsize , bleft , left , bottom ) ; int wpl = pixGetWpl ( pix ) ; l_uint32 * data = pixGetData ( pix ) ; int length = outline -> pathlength ( ) ; ICOORD pos = outline -> start_pos ( ) ; for ( int i = 0 ; i < length ; ++ i ) { int grid_x = ( pos . x ( ) - bleft . x ( ) ) / gridsize - * left ; int grid_y = ( pos . y ( ) - bleft . y ( ) ) / gridsize - * bottom ; SET_DATA_BIT ( data + grid_y * wpl , grid_x ) ; pos += outline -> step ( i ) ; } return pix ; }
Helper function to return a scaled Pix with one pixel per grid cell,
set (black) where the given outline enters the corresponding grid cell,
and clear where the outline does not touch the grid cell.
Helper function to return a scaled Pix with one pixel per grid cell set ( black ) where the given outline enters the corresponding grid cell and clear where the outline does not touch the grid cell .