Improve PlaYUVerPixel and add support for RGBA format

Changes ColorSpace enum
Add Alpha channel support in pixel class
Add RGBA pixel format to the list of supported formats
This commit is contained in:
jfmcarreira committed 2018-02-04 20:32:59 +00:00
1 parent d735df75fd
commit 2d6ba03d4a
8 files changed
+287 -243

No files matched your search

+3 -3
View File
@@ -295,7 +295,7 @@ Void FramePropertiesDock::setFrame( PlaYUVerFrame* pcFrame )
if( m_iLastFrameType != colorSpace )
{
m_iLastFrameType = colorSpace;
if( colorSpace == PlaYUVerPixel::COLOR_RGB || colorSpace == PlaYUVerPixel::COLOR_ARGB )
if( colorSpace == PlaYUVerPixel::COLOR_RGB || colorSpace == PlaYUVerPixel::COLOR_RGBA )
{
channelCB->clear();
channelCB->clear();
@@ -303,7 +303,7 @@ Void FramePropertiesDock::setFrame( PlaYUVerFrame* pcFrame )
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( colorSpace == PlaYUVerPixel::COLOR_ARGB )
if( colorSpace == PlaYUVerPixel::COLOR_RGBA )
{
channelCB->insertItem( AlphaChannel, QIcon( ":/images/channel-alpha.png" ), "Alpha" );
}
@@ -513,7 +513,7 @@ Void FramePropertiesDock::slotChannelChanged( Int channel )
{
if( m_pcFrame->getColorSpace() == PlaYUVerPixel::COLOR_YUV )
channel += 1;
if( channel == AlphaChannel && m_pcFrame->getColorSpace() != PlaYUVerPixel::COLOR_ARGB )
if( channel == AlphaChannel && m_pcFrame->getColorSpace() != PlaYUVerPixel::COLOR_RGBA )
channel = ColorChannels;
switch( channel )
+24 -20
View File
@@ -977,7 +977,6 @@ Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos )
{
if( m_pcCurrFrame )
{
PlaYUVerPixel sPixelValue;
Int iWidth, iHeight;
Int posX = pos.x();
Int posY = pos.y();
@@ -990,28 +989,33 @@ Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos )
{
strStatus = QString( "(%1,%2) " ).arg( posX ).arg( posY );
Int ColorSpace = m_pcCurrFrame->getColorSpace();
if( ColorSpace == PlaYUVerPixel::COLOR_GRAY )
Int colorSpace = m_pcCurrFrame->getColorSpace();
PlaYUVerPixel pixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
switch( colorSpace )
{
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
strStatus.append( QString( "Y: %1" ).arg( sPixelValue.Y() ) );
}
if( ColorSpace == PlaYUVerPixel::COLOR_YUV )
{
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
case PlaYUVerPixel::COLOR_GRAY:
strStatus.append( QString( "Y: %1" ).arg( pixelValue.Y() ) );
break;
case PlaYUVerPixel::COLOR_YUV:
strStatus.append( QString( "Y: %1 U: %2 V: %3" )
.arg( sPixelValue.Y() )
.arg( sPixelValue.Cb() )
.arg( sPixelValue.Cr() ) );
}
if( ( ColorSpace == PlaYUVerPixel::COLOR_RGB ) )
{
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
.arg( pixelValue.Y() )
.arg( pixelValue.Cb() )
.arg( pixelValue.Cr() ) );
break;
case PlaYUVerPixel::COLOR_RGB:
strStatus.append( QString( "R: %1 G: %2 B: %3" )
.arg( sPixelValue.R() )
.arg( sPixelValue.G() )
.arg( sPixelValue.B() ) );
.arg( pixelValue.R() )
.arg( pixelValue.G() )
.arg( pixelValue.B() ) );
break;
case PlaYUVerPixel::COLOR_RGBA:
strStatus.append( QString( "R: %1 G: %2 B: %3 A: %4" )
.arg( pixelValue.R() )
.arg( pixelValue.G() )
.arg( pixelValue.B() )
.arg( pixelValue.A() ) );
break;
}
emit updateStatusBar( strStatus );
}
+12 -4
View File
@@ -541,10 +541,18 @@ Void ViewArea::paintEvent( QPaintEvent* event )
else
paInter.setPen( QColor( Qt::black ) );
paInter.drawText( pixelRect, Qt::AlignCenter,
"R: " + QString::number( sPixelValue.R() ) + "\n" +
"G: " + QString::number( sPixelValue.G() ) + "\n" +
"B: " + QString::number( sPixelValue.B() ) );
paInter.drawText( pixelRect, Qt::AlignCenter, "R: " + QString::number( sPixelValue.R() ) + "\nG: " + QString::number( sPixelValue.G() ) + "\nB: " + QString::number( sPixelValue.B() ) );
}
if( ( frFormat == PlaYUVerPixel::COLOR_RGBA ) )
{
sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft.x(), pixelTopLeft.y() );
if( ( sPixelValue.R() + sPixelValue.G() + sPixelValue.B() ) < ( m_uiPixelHalfScale * 3 ) )
paInter.setPen( QColor( Qt::white ) );
else
paInter.setPen( QColor( Qt::black ) );
paInter.drawText( pixelRect, Qt::AlignCenter, "R: " + QString::number( sPixelValue.R() ) + "\nG: " + QString::number( sPixelValue.G() ) + "\nB: " + QString::number( sPixelValue.B() ) + "\nA: " + QString::number( sPixelValue.A() ) );
}
}
}