Light Light::reflect_on(const rt::color& color) const { return Light( color.get_red() / 255.0 * red, color.get_green() / 255.0 * green, color.get_blue() / 255.0 * blue ); }
rt::color compose(const rt::color& c1, const rt::color& c2) { rt::color inv_c1(255-c1.get_red(), 255-c1.get_green(), 255-c1.get_blue(), 255-c1.get_alpha()); return rt::color( c2.get_red()-std::min(inv_c1.get_red(), c2.get_red()), c2.get_green()-std::min(inv_c1.get_green(), c2.get_green()), c2.get_blue()-std::min(inv_c1.get_blue(), c2.get_blue()) ); }
Light::Light(const rt::color& color) : red(light_component_of_color_component(color.get_red())), green(light_component_of_color_component(color.get_green())), blue(light_component_of_color_component(color.get_blue())) { }