Example #1
0
void doMakeStereoRaster(const TRasterPT<T> &rleft, const TRasterPT<T> &rright) {
  int lx = rleft->getLx();
  int ly = rright->getLy();

  for (int i = 0; i < ly; i++) {
    T *pixl = rleft->pixels(i);
    T *pixr = rright->pixels(i);

    for (int j = 0; j < lx; j++, pixl++, pixr++) {
      pixl->g = pixr->g;
      pixl->b = pixr->b;
    }
  }
}
Example #2
0
void doSetChannel(const TRasterPT<T> &rin, const TRasterPT<T> &rout,
                  UCHAR channel, bool greytones) {
  int lx = rin->getLx();
  int ly = rout->getLy();

  int i, j;
  for (i = 0; i < ly; i++) {
    T *pixin  = rin->pixels(i);
    T *pixout = rout->pixels(i);
    if (greytones || channel == TRop::MChan) {
      switch (channel) {
      case TRop::RChan:
        for (j = 0; j < lx; j++, pixin++, pixout++)
          pixout->r = pixout->g = pixout->b = pixout->m = pixin->r;
        break;
      case TRop::GChan:
        for (j = 0; j < lx; j++, pixin++, pixout++)
          pixout->r = pixout->g = pixout->b = pixout->m = pixin->g;
        break;
      case TRop::BChan:
        for (j = 0; j < lx; j++, pixin++, pixout++)
          pixout->r = pixout->g = pixout->b = pixout->m = pixin->b;
        break;
      case TRop::MChan:
        for (j = 0; j < lx; j++, pixin++, pixout++)
          pixout->r = pixout->g = pixout->b = pixout->m = pixin->m;
        break;
      default:
        assert(false);
      }
    } else {
      for (j = 0; j < lx; j++, pixin++, pixout++) {
        pixout->r = channel & TRop::RChan ? pixin->r : 0;
        pixout->b = channel & TRop::BChan ? pixin->b : 0;
        pixout->g = channel & TRop::GChan ? pixin->g : 0;
      }
    }
  }
}
Example #3
0
 void doCell(PIXEL *cellBuffer, const PIXEL &cellColor, const PIXEL &bgColor,
             int x0, int y0, int x1, int y1) {
   // Apply the mask to the cell. 0 pixels are bgColored, GRAY::maxChannelValue
   // ones are cellColored.
   PIXEL *pix, *line    = cellBuffer, *lineEnd;
   GRAY *grPix, *grLine = m_mask->pixels(y0) + x0, *grLineEnd;
   int x, y, grWrap = m_mask->getWrap(), lx = x1 - x0;
   for (y = y0; y < y1; ++y, line += this->m_wrap, grLine += grWrap) {
     lineEnd   = line + lx;
     grLineEnd = grLine + lx;
     for (x = x0, pix = line, grPix = grLine; x < x1; ++x, ++pix, ++grPix)
       *pix = blend(bgColor, cellColor,
                    grPix->value / (double)GRAY::maxChannelValue);
   }
 }