X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftags%2F0.61.08%2Fsrc%2Fmodules%2Fmod_filter%2Fcolorcorrect.cpp;fp=synfig-core%2Ftags%2F0.61.08%2Fsrc%2Fmodules%2Fmod_filter%2Fcolorcorrect.cpp;h=0000000000000000000000000000000000000000;hb=6fa8f2f38d4b0b35f8539bf94e27ae27015c7689;hp=3a0468e253bc9fe607233b605221b2877763b16a;hpb=47fce282611fbba1044921d22ca887f9b53ad91a;p=synfig.git diff --git a/synfig-core/tags/0.61.08/src/modules/mod_filter/colorcorrect.cpp b/synfig-core/tags/0.61.08/src/modules/mod_filter/colorcorrect.cpp deleted file mode 100644 index 3a0468e..0000000 --- a/synfig-core/tags/0.61.08/src/modules/mod_filter/colorcorrect.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file colorcorrect.cpp -** \brief Implementation of the "Color Correct" layer -** -** $Id$ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === H E A D E R S ======================================================= */ - -#ifdef USING_PCH -# include "pch.h" -#else -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "colorcorrect.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#endif - -/* === U S I N G =========================================================== */ - -using namespace etl; -using namespace std; -using namespace synfig; - -/* === G L O B A L S ======================================================= */ - -SYNFIG_LAYER_INIT(Layer_ColorCorrect); -SYNFIG_LAYER_SET_NAME(Layer_ColorCorrect,"colorcorrect"); -SYNFIG_LAYER_SET_LOCAL_NAME(Layer_ColorCorrect,N_("Color Correct")); -SYNFIG_LAYER_SET_CATEGORY(Layer_ColorCorrect,N_("Filters")); -SYNFIG_LAYER_SET_VERSION(Layer_ColorCorrect,"0.1"); -SYNFIG_LAYER_SET_CVS_ID(Layer_ColorCorrect,"$Id$"); - -/* === P R O C E D U R E S ================================================= */ - -/* === M E T H O D S ======================================================= */ - -/* === E N T R Y P O I N T ================================================= */ - -Layer_ColorCorrect::Layer_ColorCorrect(): - hue_adjust(Angle::zero()), - brightness(0), - contrast(1.0), - exposure(0.0) -{ -} - -inline Color -Layer_ColorCorrect::correct_color(const Color &in)const -{ - Color ret(in); - Real brightness((this->brightness-0.5)*this->contrast+0.5); - - if(gamma.get_gamma_r()!=1.0) - { - if(ret.get_r() < 0) - { - ret.set_r(-gamma.r_F32_to_F32(-ret.get_r())); - }else - { - ret.set_r(gamma.r_F32_to_F32(ret.get_r())); - } - } - if(gamma.get_gamma_g()!=1.0) - { - if(ret.get_g() < 0) - { - ret.set_g(-gamma.g_F32_to_F32(-ret.get_g())); - }else - { - ret.set_g(gamma.g_F32_to_F32(ret.get_g())); - } - } - if(gamma.get_gamma_b()!=1.0) - { - if(ret.get_b() < 0) - { - ret.set_b(-gamma.b_F32_to_F32(-ret.get_b())); - }else - { - ret.set_b(gamma.b_F32_to_F32(ret.get_b())); - } - } - - assert(!isnan(ret.get_r())); - assert(!isnan(ret.get_g())); - assert(!isnan(ret.get_b())); - - if(exposure!=0.0) - { - const float factor(exp(exposure)); - ret.set_r(ret.get_r()*factor); - ret.set_g(ret.get_g()*factor); - ret.set_b(ret.get_b()*factor); - } - - // Adjust Contrast - if(contrast!=1.0) - { - ret.set_r(ret.get_r()*contrast); - ret.set_g(ret.get_g()*contrast); - ret.set_b(ret.get_b()*contrast); - } - - if(brightness) - { - // Adjust R Channel Brightness - if(ret.get_r()>-brightness) - ret.set_r(ret.get_r()+brightness); - else if(ret.get_r()-brightness) - ret.set_g(ret.get_g()+brightness); - else if(ret.get_g()-brightness) - ret.set_b(ret.get_b()+brightness); - else if(ret.get_b()begin()); - - for(y=0;yamount_complete(10000,10000)) - return false; - - return true; -} - -Rect -Layer_ColorCorrect::get_full_bounding_rect(Context context)const -{ - return context.get_full_bounding_rect(); -}