void Sky::insertGrad() { ColorScale gradient; gradient.insert(0.0,sf::Color(mColUp.r,mColUp.g,mColUp.b,mColUp.a)); gradient.insert(1.0,sf::Color(mColDown.r,mColDown.g,mColDown.b,mColDown.a)); //LOG(mColUp.r); gradient.fillTab(tab,size); sf::Image img; img.create(size,size); for(int i=0; i<size; ++i) { for(int j=0; j<size; ++j) { img.setPixel(i,j,this->tab[j]); } } texture.loadFromImage(img); sprite.setTexture(texture); }
/** * Fills the tab with gradient color. */ void AbstractFractaleAlgo::fillTabWithGradient() { ColorScale gradient; // Choose colors for the gradient gradient.insert(0.0,sf::Color::Black); gradient.insert(1.0,sf::Color::Green); gradient.insert(2.0,sf::Color::Magenta); gradient.insert(3.0,sf::Color::Yellow); // Fill a table with this gradient gradient.fillTab(colorTab, TAB_SIZE); }