Merge branch 'dev_properties_side_bar'

This commit is contained in:
jfmcarreira committed 2014-04-17 18:14:32 +01:00
commit cb12f3710f
5 files changed
+98 -81

No files matched your search

+59 -36
View File
@@ -35,6 +35,19 @@
namespace plaYUVer
{
const QBrush g_eColorPallet[][3] =
{
{
Qt::darkGray, // Luma
Qt::blue, // Cb
Qt::red, // Cr
},
{
Qt::red, // Channel Red
Qt::green, // Channel Green
Qt::blue, // Channel Blue
},};
class HistogramWidgetPrivate
{
public:
@@ -134,7 +147,7 @@ void HistogramWidget::setupWidget( int width, int height, HistogramOptions optio
{
m_channelType = LumaHistogram;
m_scaleType = LogScaleHistogram;
m_colorType = RedColor;
m_colorType = FirstChannelColor;
m_renderingType = FullImageHistogram;
setOptions( options );
@@ -507,22 +520,22 @@ void HistogramWidget::paintEvent( QPaintEvent * )
switch( m_channelType )
{
case HistogramWidget::RedChannelHistogram: // Red channel.
max = histogram->getMaximum( PlaYUVerFrameStatistics::RedChannel );
case HistogramWidget::FirstChannelHistogram: // Y channel.
max = histogram->getMaximum( PlaYUVerFrameStatistics::YChannel );
break;
case HistogramWidget::GreenChannelHistogram: // Green channel.
max = histogram->getMaximum( PlaYUVerFrameStatistics::GreenChannel );
case HistogramWidget::SecondChannelHistogram: // Cb channel.
max = histogram->getMaximum( PlaYUVerFrameStatistics::CbChannel );
break;
case HistogramWidget::BlueChannelHistogram: // Blue channel.
max = histogram->getMaximum( PlaYUVerFrameStatistics::BlueChannel );
case HistogramWidget::ThirdChannelHistogram: // Cr channel.
max = histogram->getMaximum( PlaYUVerFrameStatistics::CrChannel );
break;
case HistogramWidget::AlphaChannelHistogram: // Alpha channel.
max = histogram->getMaximum( PlaYUVerFrameStatistics::AlphaChannel );
break;
case HistogramWidget::ColorChannelsHistogram: // All color channels.
max = qMax( qMax( histogram->getMaximum( PlaYUVerFrameStatistics::RedChannel ), histogram->getMaximum( PlaYUVerFrameStatistics::GreenChannel ) ),
histogram->getMaximum( PlaYUVerFrameStatistics::BlueChannel ) );
max = qMax( qMax( histogram->getMaximum( PlaYUVerFrameStatistics::YChannel ), histogram->getMaximum( PlaYUVerFrameStatistics::CbChannel ) ),
histogram->getMaximum( PlaYUVerFrameStatistics::CrChannel ) );
break;
case HistogramWidget::LumaHistogram: // Luminance.
max = histogram->getMaximum( PlaYUVerFrameStatistics::LumaChannel );
@@ -546,6 +559,7 @@ void HistogramWidget::paintEvent( QPaintEvent * )
// so there's no need to write double-buffering code in paintEvent()
// to avoid flicker.
QPainter p1( this );
Int pallet = d->imageColorSpace;
// Drawing selection or all histogram values.
@@ -570,22 +584,22 @@ void HistogramWidget::paintEvent( QPaintEvent * )
switch( m_channelType )
{
case HistogramWidget::RedChannelHistogram: // Red channel.
v = histogram->getValue( PlaYUVerFrameStatistics::RedChannel, i++ );
case HistogramWidget::FirstChannelHistogram: // Y channel.
v = histogram->getValue( PlaYUVerFrameStatistics::YChannel, i++ );
break;
case HistogramWidget::GreenChannelHistogram: // Green channel.
v = histogram->getValue( PlaYUVerFrameStatistics::GreenChannel, i++ );
case HistogramWidget::SecondChannelHistogram: // Cb channel.
v = histogram->getValue( PlaYUVerFrameStatistics::CbChannel, i++ );
break;
case HistogramWidget::BlueChannelHistogram: // Blue channel.
v = histogram->getValue( PlaYUVerFrameStatistics::BlueChannel, i++ );
case HistogramWidget::ThirdChannelHistogram: // Cr channel.
v = histogram->getValue( PlaYUVerFrameStatistics::CrChannel, i++ );
break;
case HistogramWidget::AlphaChannelHistogram: // Alpha channel.
v = histogram->getValue( PlaYUVerFrameStatistics::AlphaChannel, i++ );
break;
case HistogramWidget::ColorChannelsHistogram: // All color.
vr = histogram->getValue( PlaYUVerFrameStatistics::RedChannel, i );
vg = histogram->getValue( PlaYUVerFrameStatistics::GreenChannel, i );
vb = histogram->getValue( PlaYUVerFrameStatistics::BlueChannel, i++ );
vr = histogram->getValue( PlaYUVerFrameStatistics::YChannel, i );
vg = histogram->getValue( PlaYUVerFrameStatistics::CbChannel, i );
vb = histogram->getValue( PlaYUVerFrameStatistics::CrChannel, i++ );
break;
case HistogramWidget::LumaHistogram: // Luminance.
v = histogram->getValue( PlaYUVerFrameStatistics::LumaChannel, i++ );
@@ -714,11 +728,11 @@ void HistogramWidget::paintEvent( QPaintEvent * )
// colors channel mode?
switch( m_colorType )
{
case HistogramWidget::RedColor:
case HistogramWidget::FirstChannelColor:
p1.drawLine( x, wHeight, x, wHeight - yr );
break;
case HistogramWidget::GreenColor:
case HistogramWidget::SecondChannelColor:
p1.drawLine( x, wHeight, x, wHeight - yg );
break;
@@ -733,12 +747,12 @@ void HistogramWidget::paintEvent( QPaintEvent * )
// colors channel mode?
switch( m_colorType )
{
case HistogramWidget::RedColor:
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
case HistogramWidget::FirstChannelColor:
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yg );
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yb );
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yr );
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
@@ -750,12 +764,12 @@ void HistogramWidget::paintEvent( QPaintEvent * )
break;
case HistogramWidget::GreenColor:
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
case HistogramWidget::SecondChannelColor:
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yb );
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yr );
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yg );
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
@@ -768,11 +782,11 @@ void HistogramWidget::paintEvent( QPaintEvent * )
break;
default:
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yr );
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yg );
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yb );
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
@@ -798,12 +812,15 @@ void HistogramWidget::paintEvent( QPaintEvent * )
// colors channel mode?
switch( m_colorType )
{
case HistogramWidget::RedColor:
case HistogramWidget::FirstChannelColor:
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yg );
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yb );
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yr );
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
@@ -815,12 +832,15 @@ void HistogramWidget::paintEvent( QPaintEvent * )
break;
case HistogramWidget::GreenColor:
case HistogramWidget::SecondChannelColor:
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yb );
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yr );
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yg );
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
@@ -834,10 +854,13 @@ void HistogramWidget::paintEvent( QPaintEvent * )
default:
p1.setPen( QPen( Qt::red, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][FirstChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yr );
p1.setPen( QPen( Qt::green, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][SecondChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yg );
p1.setPen( QPen( Qt::blue, 1, Qt::SolidLine ) );
p1.setPen( QPen( g_eColorPallet[pallet][ThirdChannelColor], 1, Qt::SolidLine ) );
p1.drawLine( x, wHeight, x, wHeight - yb );
p1.setPen( QPen( Qt::white, 1, Qt::SolidLine ) );
@@ -868,15 +891,15 @@ void HistogramWidget::paintEvent( QPaintEvent * )
{
switch( m_channelType )
{
case HistogramWidget::RedChannelHistogram:
case HistogramWidget::FirstChannelHistogram:
guidePos = d->colorGuide.red();
break;
case HistogramWidget::GreenChannelHistogram:
case HistogramWidget::SecondChannelHistogram:
guidePos = d->colorGuide.green();
break;
case HistogramWidget::BlueChannelHistogram:
case HistogramWidget::ThirdChannelHistogram:
guidePos = d->colorGuide.blue();
break;
+8 -11
View File
@@ -49,10 +49,10 @@ public:
{
/** Luminance */
LumaHistogram = 0,
/** RGB channels */
RedChannelHistogram,
GreenChannelHistogram,
BlueChannelHistogram,
/** Channels */
FirstChannelHistogram,
SecondChannelHistogram,
ThirdChannelHistogram,
/** Alpha channel */
AlphaChannelHistogram,
/** All color channels */
@@ -69,12 +69,10 @@ public:
enum HistogramAllColorMode
{
/** Red color to foreground in All Colors Channel mode */
RedColor = 0,
/** Green color to foreground in All Colors Channel mode */
GreenColor,
/** Blue color to foreground in All Colors Channel mode */
BlueColor
// Select wich component is shown in foreground
FirstChannelColor,
SecondChannelColor,
ThirdChannelColor,
};
enum HistogramRendering
@@ -187,7 +185,6 @@ private :
private:
HistogramWidgetPrivate* d;
};
}
+23 -24
View File
@@ -356,7 +356,6 @@ FramePropertiesSideBar::FramePropertiesSideBar( QWidget* parent ) :
setLayout( mainLayout );
setEnabled( false );
connect( this, SIGNAL( visibilityChanged(bool) ), this, SLOT( slotUpdateHistogram() ) );
connect( channelCB, SIGNAL( activated(int) ), this, SLOT( slotChannelChanged(int) ) );
connect( scaleButtonGroup, SIGNAL( buttonClicked(int) ), this, SLOT( slotScaleChanged(int) ) );
@@ -433,9 +432,9 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame )
channelCB->clear();
channelCB->clear();
channelCB->insertItem( LuminosityChannel, QIcon( ":/images/channel-luma.png" ), "Luminance" );
channelCB->insertItem( RedChannel, QIcon( ":/images/channel-red.png" ), "Red" );
channelCB->insertItem( GreenChannel, QIcon( ":/images/channel-green.png" ), "Green" );
channelCB->insertItem( BlueChannel, QIcon( ":/images/channel-blue.png" ), "Blue" );
channelCB->insertItem( FirstChannel, QIcon( ":/images/channel-red.png" ), "Red" );
channelCB->insertItem( SecondChannel, QIcon( ":/images/channel-green.png" ), "Green" );
channelCB->insertItem( ThirdChannel, QIcon( ":/images/channel-blue.png" ), "Blue" );
if( PlaYUVerFrame::isRGBorYUVorGray( pel_fmt ) == PlaYUVerFrame::COLOR_ARGB )
{
channelCB->insertItem( AlphaChannel, QIcon( ":/images/channel-alpha.png" ), "Alpha" );
@@ -457,20 +456,20 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame )
else if( PlaYUVerFrame::isRGBorYUVorGray( pel_fmt ) == PlaYUVerFrame::COLOR_YUV )
{
channelCB->clear();
channelCB->insertItem( LuminosityChannel, QIcon( ":/images/channel-luma.png" ), "Luminance" );
channelCB->insertItem( ChromaUhannel, QIcon( ":/images/channel-red.png" ), "Chroma U" );
channelCB->insertItem( ChromaVhannel, QIcon( ":/images/channel-green.png" ), "Chroma V" );
channelCB->insertItem( FirstChannel, QIcon( ":/images/channel-luma.png" ), "Luminance" );
channelCB->insertItem( SecondChannel, QIcon( ":/images/channel-red.png" ), "Chroma U" );
channelCB->insertItem( ThirdChannel, QIcon( ":/images/channel-green.png" ), "Chroma V" );
channelCB->insertItem( ColorChannels, QIcon( ":/images/channel-all.png" ), "All Channels" );
colorsCB->clear();
colorsCB->addItem( "Luminance" );
colorsCB->addItem( "Chroma U" );
colorsCB->addItem( "Chroma V" );
colorsCB->setEnabled( false );
colorsCB->setWhatsThis( tr( "<p>Select here the main color displayed with Colors Channel mode:"
"<p><b>Luminance</b>: Draw the Luminance channel in the foreground.<p>"
"<b>Chroma U</b>: Draw the Chroma U channel in the foreground.<p>"
"<b>Chroma V</b>: Draw the Chroma V channel in the foreground.<p>" ) );
colorsCB->addItem( "Luminance" );
colorsCB->addItem( "Chroma U" );
colorsCB->addItem( "Chroma V" );
colorsCB->setEnabled( false );
colorsCB->setWhatsThis( tr( "<p>Select here the main color displayed with Colors Channel mode:"
"<p><b>Luminance</b>: Draw the Luminance channel in the foreground.<p>"
"<b>Chroma U</b>: Draw the Chroma U channel in the foreground.<p>"
"<b>Chroma V</b>: Draw the Chroma V channel in the foreground.<p>" ) );
colorsCB->show();
colorsLabel->show();
}
@@ -563,16 +562,16 @@ void FramePropertiesSideBar::slotChannelChanged( int channel )
switch( channel )
{
case RedChannel:
histogramWidget->m_channelType = HistogramWidget::RedChannelHistogram;
case FirstChannel:
histogramWidget->m_channelType = HistogramWidget::FirstChannelHistogram;
colorsCB->setEnabled( false );
break;
case GreenChannel:
histogramWidget->m_channelType = HistogramWidget::GreenChannelHistogram;
case SecondChannel:
histogramWidget->m_channelType = HistogramWidget::SecondChannelHistogram;
colorsCB->setEnabled( false );
break;
case BlueChannel:
histogramWidget->m_channelType = HistogramWidget::BlueChannelHistogram;
case ThirdChannel:
histogramWidget->m_channelType = HistogramWidget::ThirdChannelHistogram;
colorsCB->setEnabled( false );
break;
case AlphaChannel:
@@ -603,13 +602,13 @@ void FramePropertiesSideBar::slotColorsChanged( int color )
switch( color )
{
case AllColorsGreen:
histogramWidget->m_colorType = HistogramWidget::GreenColor;
histogramWidget->m_colorType = HistogramWidget::SecondChannelColor;
break;
case AllColorsBlue:
histogramWidget->m_colorType = HistogramWidget::BlueColor;
histogramWidget->m_colorType = HistogramWidget::ThirdChannelColor;
break;
default: // Red.
histogramWidget->m_colorType = HistogramWidget::RedColor;
histogramWidget->m_colorType = HistogramWidget::FirstChannelColor;
break;
}
+4 -6
View File
@@ -77,13 +77,11 @@ private:
enum ColorChannel
{
LuminosityChannel = 0,
RedChannel = 1,
ChromaUhannel = 1,
GreenChannel = 2,
ChromaVhannel = 2,
BlueChannel = 3,
AlphaChannel = 5,
FirstChannel = 1,
SecondChannel = 2,
ThirdChannel = 3,
ColorChannels = 4,
AlphaChannel = 5,
};
enum AllColorsColorType
+4 -4
View File
@@ -48,10 +48,10 @@ public:
enum StatisticsChannel
{
LumaChannel = 0,
RedChannel,
GreenChannel,
BlueChannel,
AlphaChannel,
RedChannel = 1,
GreenChannel = 2,
BlueChannel = 3,
AlphaChannel = 4,
YChannel = 1,
CbChannel = 2,
CrChannel = 3