Commit 59b44fa8 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Generation of colored icons improved.

parent 05f74cef
...@@ -122,7 +122,7 @@ void AlgorithmSelector::finalizeTools() ...@@ -122,7 +122,7 @@ void AlgorithmSelector::finalizeTools()
foreach( int categoryId, ToolCategory::categoriesId() ) foreach( int categoryId, ToolCategory::categoriesId() )
if( !m_ToolsByCategory[categoryId].empty() ) if( !m_ToolsByCategory[categoryId].empty() )
{ {
QBoxLayout *l = new QVBoxLayout(); QVBoxLayout *l = new QVBoxLayout();
l->setAlignment( Qt::AlignHCenter ); l->setAlignment( Qt::AlignHCenter );
l->setContentsMargins( 0, 0, 0, 0 ); l->setContentsMargins( 0, 0, 0, 0 );
l->setSpacing( 0 ); l->setSpacing( 0 );
...@@ -132,9 +132,9 @@ void AlgorithmSelector::finalizeTools() ...@@ -132,9 +132,9 @@ void AlgorithmSelector::finalizeTools()
categoryButton->setIconSize( QSize(80,80) ); categoryButton->setIconSize( QSize(80,80) );
categoryButton->setFlat( true ); categoryButton->setFlat( true );
categoryButton->setMinimumSize( 80, 80 ); categoryButton->setMinimumSize( 80, 80 );
//categoryButton->setMaximumSize( 80, 80 ); categoryButton->setMaximumSize( 80, 80 );
categoryButton->setCheckable( true ); categoryButton->setCheckable( true );
l->addWidget( categoryButton ); l->addWidget( categoryButton, 0, Qt::AlignHCenter );
m_CategoryButtonGroup->addButton( categoryButton, categoryId ); m_CategoryButtonGroup->addButton( categoryButton, categoryId );
QLabel *categoryLabel = new QLabel( ToolCategory::categoryName(categoryId) ); QLabel *categoryLabel = new QLabel( ToolCategory::categoryName(categoryId) );
...@@ -143,7 +143,7 @@ void AlgorithmSelector::finalizeTools() ...@@ -143,7 +143,7 @@ void AlgorithmSelector::finalizeTools()
categoryLabel->setFont( f ); categoryLabel->setFont( f );
categoryLabel->setAlignment( Qt::AlignHCenter ); categoryLabel->setAlignment( Qt::AlignHCenter );
//categoryLabel->setWordWrap( true ); //categoryLabel->setWordWrap( true );
l->addWidget( categoryLabel ); l->addWidget( categoryLabel, 0, Qt::AlignHCenter );
QWidget *categoryPannel = new QWidget(); QWidget *categoryPannel = new QWidget();
categoryPannel->setLayout( l ); categoryPannel->setLayout( l );
......
...@@ -31,17 +31,13 @@ void ToolCategory::declareCategory( int id, const QString& name, const QString & ...@@ -31,17 +31,13 @@ void ToolCategory::declareCategory( int id, const QString& name, const QString &
// Update pixel color values. // Update pixel color values.
QColor c = QApplication::palette().color( QPalette::Active, QPalette::BrightText ); int h = QApplication::palette().color( QPalette::Active, QPalette::Text ).hslHue();
QColor s = QApplication::palette().color( QPalette::Active, QPalette::Shadow );
for( int y=0; y<alphaMask.height(); ++y ) for( int y=0; y<alphaMask.height(); ++y )
for( int x=0; x<alphaMask.width(); ++x ) for( int x=0; x<alphaMask.width(); ++x )
{ {
float l = alphaMask.pixelColor(x,y).redF(); int l = alphaMask.pixelColor(x,y).lightness();
float a = alphaMask.pixelColor(x,y).alphaF(); int a = alphaMask.pixelColor(x,y).alpha();
QColor color( l*c.red () + (1.0f-l)*s.red (), QColor color = QColor::fromHsl( h, 191, l, a );
l*c.green() + (1.0f-l)*s.green(),
l*c.blue () + (1.0f-l)*s.blue (),
a*(l*c.alpha() + (1.0f-l)*s.alpha()) );
icon.setPixelColor( x,y, color ); icon.setPixelColor( x,y, color );
} }
...@@ -55,5 +51,5 @@ void ToolCategory::declareCategory( int id, const QString& name, const QString & ...@@ -55,5 +51,5 @@ void ToolCategory::declareCategory( int id, const QString& name, const QString &
s_CategoryById[id] = s_CategoryNames.size(); s_CategoryById[id] = s_CategoryNames.size();
s_CategoryNames.append( name ); s_CategoryNames.append( name );
s_CategoryIcons.append( iconName/*iconFilePath*/ ); s_CategoryIcons.append( iconFilePath );
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment