void World::display_pixel(const list<RenderedPixel>& render) const { list<RenderedPixel>::const_iterator it; //list<RenderedInt> rendered; //vector<RenderedInt> rendered; vector<RenderPixel*> rendered; rendered.reserve(render.size()); for ( it=render.begin() ; it != render.end(); it++) { RGBColor mapped_color; if (vp.show_out_of_gamut) mapped_color = clamp_to_color(it->color); else mapped_color = max_to_one(it->color); if (vp.gamma != 1.0) mapped_color = mapped_color.powc(vp.inv_gamma); //have to start from max y coordinate to convert to screen coordinates //int x = it->xy.x; int y = vp.vres - it->xy.y - 1; /*RenderedInt rend; rend.x = it->xy.x; rend.y = y; rend.r = (int)(mapped_color.r * 255); rend.g = (int)(mapped_color.g * 255); rend.b = (int)(mapped_color.b * 255); rendered.push_back(rend);*/ rendered.push_back(new RenderPixel); rendered.back()->x = it->xy.x; rendered.back()->y = y; rendered.back()->red = (int)(mapped_color.r * 255); rendered.back()->green = (int)(mapped_color.g * 255); rendered.back()->blue = (int)(mapped_color.b * 255); } paintArea->setPixel(rendered); rendered.clear(); }
void World::display_pixel(const int row, const int column, const RGBColor& raw_color) const { RGBColor mapped_color; if (vp.show_out_of_gamut) mapped_color = clamp_to_color(raw_color); else mapped_color = max_to_one(raw_color); if (vp.gamma != 1.0) mapped_color = mapped_color.powc(vp.inv_gamma); //have to start from max y coordinate to convert to screen coordinates int x = column; int y = vp.vres - row - 1; paintArea->setPixel(x, y, (int)(mapped_color.r * 255), (int)(mapped_color.g * 255), (int)(mapped_color.b * 255)); }