// Public functions void LightManager::update() { if (_timeElapsed > _speed || _effectMode == Plasma) { nextPixel(); _timeElapsed = 0; } }
/** \brief Calculate a free position where the nth byte should be hidden. * * \param &pixelNum const unsignedint the number of the pixel that should be hidden * \return Pixel a free pixel where a new byte can be stored */ Pixel SteganoHide::calculateHidingPosition(const unsigned int &pixelNum) { Pixel returnPixel(0, 0); //std::cout << "sondation faktor: " << pixelNum << " steps: " << steps << std::endl; pushPixelBy(returnPixel, quadraticSondation(pixelNum, this->pixelAmount)); //std::cout << returnPixel.x << ":" << returnPixel.y << std::endl; Pixel nextPixel(returnPixel); incrementPixel(nextPixel); int shiftings = 0; while(!isPixelEmpty(returnPixel) || !isPixelEmpty(nextPixel)) { incrementPixel(returnPixel); incrementPixel(nextPixel); shiftings++; } // save shiftings in comments that we can restore them on exposing hidden information if(shiftings != 0) { this->usedPixels += std::to_string(pixelNum) + ":" + std::to_string(shiftings) + "\n"; //this->steganoImage.comment(this->steganoImage.comment() + std::to_string(pixelNum) + ":" + std::to_string(shiftings) + "\n"); } return returnPixel; }
PixelMap * Camera::render(short aa=1) { //local variables int tVW = aa*this->getVWidth(); int tVH = aa*this->getVHeight(); Polygon * tracedPg; Color tracedColor; bool end; //Initialize PixelMap with given dimensions PixelMap * render = new PixelMap ("render", tVW, tVH); //apply the new vWidth and Height to Camera if (aa != 1) { this->setView(tVW, tVH, this->getVAngle(), true); } //reset vPos in Camera resetVPos(); //generate first ray generateRay(true); cout << "\nRendering initialized.\n\tResolution: \t" << tVW/aa << "x" << tVH/aa << " at " << aa << "xAA\n\tPolygons: \t" << allPolygons.size() << endl; while (true) { //generate ray for new vPos generateRay(); //start of new position --> update vector inDivPolygons to pass to trace() if (this->checkDiv) this->checkDivPgs(); //RayTracing. Returns pointer to the valid polygon from a given vector including pointers to polygons in that division if (this->getDivSize() != 1) { tracedPg = this->vRay.trace(&(this->inDivPolygons)); } else { tracedPg = this->vRay.trace(); //use all polygons } //check for intersection. No intersection: set pixel to backgroundcolor if (tracedPg->isActive()) { tracedColor = tracedPg->getColor(); } else { tracedColor = black; } //set pixel in PixelMap to color of polygon and move to next pixel (2nd arg TRUE) in the PixelMap render->setPixel(tracedColor, this->getVPos()); //move to the next pixel in vPos. End loop if vPos reached top right end = nextPixel(); if (end) break; } //apply AntiAliasing *render = render->antiAliase(aa); cout << "Rendering finished.\n" << endl; //reset vWidth and Height to old values if (aa != 1) { this->setView(tVW/aa, tVH/aa, this->getVAngle(), true); } return render; }