diff --git a/TODO b/TODO index 85013e0..16f3f9d 100644 --- a/TODO +++ b/TODO @@ -30,7 +30,9 @@ Sync / inputs: * Display selected input values * Display selected overrides * Edit curves in UI -* Specific controls for color grading Misc: * General overhaul (e.g. use tabs) +* Color grading controls: + * White balance control in components tab + * Don't reset when hitting value or saturation 0 diff --git a/colorgrading.cc b/colorgrading.cc index 32d9dc1..b023bda 100644 --- a/colorgrading.cc +++ b/colorgrading.cc @@ -35,9 +35,11 @@ bool ColorSelectorBar( { const float BarWidth = 24.f; const float BarHeight = 180.f; - const float fullWidth = CalcItemWidth( ); const ImVec2 labelSize = CalcTextSize( label ); const ImVec2 maxValueSize = CalcTextSize( "-9.99" ); + const float fullWidth{ + std::max( BarWidth , std::max( labelSize.x , maxValueSize.x ) ) + + 2 }; // Compute bounding boxes auto* const win( GetCurrentWindow( ) ); @@ -103,8 +105,8 @@ bool ColorSelectorBar( dl->AddRect( bbBar.Min , bbBar.Max , fCol ); // Draw colored area on bar - const float val( std::max( base , std::min( unit * 2 , nValue ) ) ); - const float vy2( ( BarHeight - 2 ) * ( 1 - val / ( unit * 2 ) ) ); + const float val( std::max( base , std::min( base + unit * 2 , nValue ) ) ); + const float vy2( ( BarHeight - 2 ) * ( 1 - ( val - base ) / ( unit * 2 ) ) ); dl->AddRectFilled( bbBar.Min + ImVec2( 1 , BarHeight * .5 ) , bbBar.Min + ImVec2( BarWidth - 1 , 1 + vy2 ) , dispColor ); @@ -160,7 +162,8 @@ bool HueSaturationPad( const auto mPos{ ctx->IO.MousePos }; const auto rmPos{ mPos - wCenter }; const auto mcSqDist{ rmPos.x * rmPos.x + rmPos.y * rmPos.y }; - const bool hovered{ mcSqDist <= wSize * wSize * .25f }; + const bool hovered{ ItemHoverable( bb , id ) && ( + mcSqDist <= wSize * wSize * .25f ) }; const bool tabFocus{ FocusableItemRegister( win , id ) }; if ( tabFocus || ( hovered && ctx->IO.MouseClicked[ 0 ] ) ) { SetActiveID( id , win ); @@ -290,9 +293,9 @@ bool ColorGradingControls( ColorConvertRGBtoHSV( scRed , scGreen , scBlue , hue , saturation , value ); PushMultiItemsWidths( 2 ); - changed = HueSaturationPad( "##wheel" , &hue , &saturation , 180.f ); + changed = HueSaturationPad( "" , &hue , &saturation , 180.f ); PopItemWidth( ); - SameLine( 0 , GetStyle( ).ItemInnerSpacing.x ); + SameLine( 0 , 0 * GetStyle( ).ItemInnerSpacing.x ); ImVec4 updated{ 0 , 0 , 0 , 1 }; ColorConvertHSVtoRGB( hue , saturation * .5f , 1 , updated.x , updated.y , updated.z ); diff --git a/demo.srd b/demo.srd index 62ced5f..07c7682 100644 --- a/demo.srd +++ b/demo.srd @@ -447,13 +447,13 @@ (section "Color grading" (color-grading "Lift" cg-lift-r cg-lift-g cg-lift-b - (base -1) (unit 1)) + (base -.1) (unit .1)) (color-grading "Gain" cg-gain-r cg-gain-g cg-gain-b (base 0) (unit 1)) (color-grading "Gamma" cg-gamma-r cg-gamma-g cg-gamma-b - (base -.9) (unit 1.8)) + (base -.9) (unit .9)) ) ) # FIXME: overrides for vignette diff --git a/main.cc b/main.cc index 0cb6158..fc76468 100644 --- a/main.cc +++ b/main.cc @@ -10,8 +10,6 @@ #include "rendertarget.hh" #include "sync.hh" -#include "colorgrading.hh" - using ebcl::T_Optional;