Mixer: Use a four color gradient for meters.
This commit is contained in:
parent
6adf6a9389
commit
07161196bd
|
@ -53,7 +53,20 @@ DPM::DPM ( int X, int Y, int W, int H, const char *L ) :
|
||||||
|
|
||||||
/* initialize gradients */
|
/* initialize gradients */
|
||||||
if ( DPM::_gradient[ 0 ] == 0 )
|
if ( DPM::_gradient[ 0 ] == 0 )
|
||||||
DPM::blend( FL_GREEN, FL_RED );
|
{
|
||||||
|
int breaks[] = {0,60,70,80,90,127};
|
||||||
|
|
||||||
|
Fl_Color cols[] = {
|
||||||
|
fl_rgb_color( 45,58,64),
|
||||||
|
fl_rgb_color( 84,181,195 ),
|
||||||
|
fl_rgb_color( 122,200,211 ),
|
||||||
|
fl_rgb_color( 178,213,212 ),
|
||||||
|
fl_rgb_color( 209,213,179 ),
|
||||||
|
fl_rgb_color( 250, 40, 30 )
|
||||||
|
};
|
||||||
|
|
||||||
|
DPM::blend( 6, breaks, cols );
|
||||||
|
}
|
||||||
|
|
||||||
box( FL_FLAT_BOX );
|
box( FL_FLAT_BOX );
|
||||||
color( FL_BACKGROUND_COLOR );
|
color( FL_BACKGROUND_COLOR );
|
||||||
|
@ -208,6 +221,7 @@ DPM::draw ( void )
|
||||||
fl_line( X, yy, X + W - 1, yy );
|
fl_line( X, yy, X + W - 1, yy );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* } */
|
/* } */
|
||||||
/* else */
|
/* else */
|
||||||
/* { */
|
/* { */
|
||||||
|
|
|
@ -88,12 +88,16 @@ public:
|
||||||
|
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
blend ( Fl_Color min, Fl_Color max )
|
blend ( int nbreaks, int* b, Fl_Color *c )
|
||||||
{
|
{
|
||||||
for ( int i = 128; i-- ; )
|
for ( int i = 0; i < nbreaks - 1; i++ )
|
||||||
_gradient[ i ] = fl_color_average( max, min, i / (float)128 );
|
{
|
||||||
|
int k = 0;
|
||||||
|
for ( int j = b[i]; j <= b[i+1]; j++, k++ )
|
||||||
|
_gradient[ j ] = fl_color_average( c[i+1], c[i], ( k ) / (float)(b[i+1] - b[i] ));
|
||||||
|
}
|
||||||
|
|
||||||
for ( int i = 128; i-- ; )
|
for ( int i = 0; i < 127; i++ )
|
||||||
_dim_gradient[ i ] = fl_color_average( FL_BLACK, _gradient[ i ], _dim );
|
_dim_gradient[ i ] = fl_color_average( FL_BLACK, _gradient[ i ], _dim );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue