Ejemplo n.º 1
0
void color_bayer_to_mono (ushort *in, ushort *out, int width, int height)
{
    int row, col;

    for (row = 0; row < height;  row++) {
        for (col = 0; col < width; col++) {
            int count = 0;
            int val = 0;

            addcell (in, width, height, row - 1, col - 1, 1, &val, &count);
            addcell (in, width, height, row - 1, col + 0, 1, &val, &count);
            addcell (in, width, height, row - 1, col + 1, 1, &val, &count);

            addcell (in, width, height, row + 0, col - 1, 2, &val, &count);
            addcell (in, width, height, row + 0, col + 0, 4, &val, &count);
            addcell (in, width, height, row + 0, col + 1, 2, &val, &count);

            addcell (in, width, height, row + 1, col - 1, 1, &val, &count);
            addcell (in, width, height, row + 1, col + 0, 1, &val, &count);
            addcell (in, width, height, row + 1, col + 1, 1, &val, &count);

            val /= count;
            if (val < 0 || val > 65535)
                val = 65535;
            out[(row * width) + col] = (ushort)val;
         }
    }
}
Ejemplo n.º 2
0
bool laydata::tdtdesign::group_selected(std::string name, laydata::tdtlibdir* libdir) {
   // first check that the cell with this name does not exist already
   if (_cells.end() != _cells.find(name)) {
      tell_log(console::MT_ERROR, "Cell with this name already exists. Group impossible");
      return false;
   }
   //unlink the fully selected shapes from the quadTree of the current cell
   atticList* TBgroup = _target.edit()->groupPrep(libdir);
   if (TBgroup->empty()) {
      tell_log(console::MT_WARNING, "Nothing to group");
      delete TBgroup; return false;
   }
   //Create a new cell
   tdtcell* newcell = addcell(name);
   assert(newcell);
   //Get the selected shapes from the current cell and add them to the new cell
   for(atticList::const_iterator CL = TBgroup->begin();
                                                   CL != TBgroup->end(); CL++) {
      shapeList* lslct = CL->second;
      quadTree* wl = newcell->securelayer(CL->first);
      // There is no point here to ensure that the layer definition exists.
      // We are just transfering shapes from one structure to another.
      // ATDB->securelaydef( CL->first );
      securelaydef( CL->first );
      for(shapeList::const_iterator CI = lslct->begin();
                                                     CI != lslct->end(); CI++) {
         wl->put(*CI);
         if (0 == CL->first) newcell->addchild(this,
                                    static_cast<tdtcellref*>(*CI)->structure());
      }
      lslct->clear();
      delete (lslct);
   }
   TBgroup->clear();delete TBgroup;
   newcell->resort();
   //reference the new cell into the current one.
   tdtdata* ref = _target.edit()->addcellref(this,
                                    getcellnamepair(name),CTM(TP(0,0),1,0,false));
   //select the new cell
   ref->set_status(sh_selected);
   _target.edit()->select_this(ref,0);
   //Just for the records. No shapes are moved to the Attic during this operation
   //Undo is possible simply by ungrouping the new cell
   return true;
}