public void addPoint ( float pos , Color col ) { ControlPoint point = new ControlPoint ( col , pos ) ; for ( int i = 0 ; i < list . size ( ) - 1 ; i ++ ) { ControlPoint now = ( ControlPoint ) list . get ( i ) ; ControlPoint next = ( ControlPoint ) list . get ( i + 1 ) ; if ( ( now . pos <= 0.5f ) && ( next . pos >= 0.5f ) ) { list . add ( i + 1 , point ) ; break ; } } repaint ( 0 ) ; }
Add a control point to the gradient