From 15130c89115b045490186280232ba6f620a9d9a9 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 16 Apr 2014 00:01:28 +0100 Subject: [PATCH] Add support to parse just a specific region of the image Currently incomplete due to the lack of copy region in PlaYUVer frame --- source/app/PropertiesSidebar.cpp | 29 ++++++++++++++++++++--------- source/app/plaYUVerApp.cpp | 25 +++++++++++++++++++++++++ source/app/plaYUVerApp.h | 2 ++ 3 files changed, 47 insertions(+), 9 deletions(-) diff --git a/source/app/PropertiesSidebar.cpp b/source/app/PropertiesSidebar.cpp index f2ede4c..5dfdcc9 100755 --- a/source/app/PropertiesSidebar.cpp +++ b/source/app/PropertiesSidebar.cpp @@ -218,15 +218,6 @@ FramePropertiesSideBar::FramePropertiesSideBar( QWidget* parent ) : colorsLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); colorsCB = new QComboBox; - colorsCB->addItem( tr( "Red" ) ); - colorsCB->addItem( tr( "Green" ) ); - colorsCB->addItem( tr( "Blue" ) ); - colorsCB->setEnabled( false ); - colorsCB->setWhatsThis( tr( "

Select here the main color displayed with Colors Channel mode:" - "

Red: Draw the red image channel in the foreground.

" - "Green: Draw the green image channel in the foreground.

" - "Blue: Draw the blue image channel in the foreground.

" ) ); - colorsCB->hide(); colorsLabel->hide(); @@ -426,6 +417,16 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame ) channelCB->insertItem( AlphaChannel, QIcon( ":/images/channel-alpha.png" ), "Alpha" ); } channelCB->insertItem( ColorChannels, QIcon( ":/images/channel-all.png" ), "Colors" ); + + colorsCB->clear(); + colorsCB->addItem( "Red" ); + colorsCB->addItem( "Green" ); + colorsCB->addItem( "Blue" ); + colorsCB->setEnabled( false ); + colorsCB->setWhatsThis( tr( "

Select here the main color displayed with Colors Channel mode:" + "

Red: Draw the Red image channel in the foreground.

" + "Green: Draw the Green image channel in the foreground.

" + "Blue: Draw the Blue image channel in the foreground.

" ) ); colorsCB->show(); colorsLabel->show(); } @@ -436,6 +437,16 @@ Void FramePropertiesSideBar::setData( PlaYUVerFrame* pcFrame ) channelCB->insertItem( ChromaUhannel, QIcon( ":/images/channel-red.png" ), "Chroma U" ); channelCB->insertItem( ChromaVhannel, 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( "

Select here the main color displayed with Colors Channel mode:" + "

Luminance: Draw the Luminance channel in the foreground.

" + "Chroma U: Draw the Chroma U channel in the foreground.

" + "Chroma V: Draw the Chroma V channel in the foreground.

" ) ); colorsCB->show(); colorsLabel->show(); } diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 986f315..8298c7b 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -149,6 +149,9 @@ Void plaYUVerApp::loadFile( QString fileName ) interfaceChild->show(); connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this, SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) ); +// connect( interfaceChild->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, +// SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) ); + interfaceChild->zoomToFit(); interfaceChild->getViewArea()->setTool( m_appTool ); } @@ -239,11 +242,33 @@ void plaYUVerApp::updateProperties() { m_pcStreamProperties->setData( m_pcCurrentSubWindow->getInputStream() ); m_pcFrameProperties->setData( m_pcCurrentSubWindow->getInputStream()->getCurrFrame() ); + //m_pcFrameProperties->setSelection( m_pcCurrentSubWindow->getViewArea()->selectedArea() ); } else { m_pcStreamProperties->setData( m_pcCurrentSubWindow->getInputStream() ); m_pcFrameProperties->setData( m_pcCurrentSubWindow->getInputStream()->getCurrFrame() ); + //m_pcFrameProperties->setSelection( m_pcCurrentSubWindow->getViewArea()->selectedArea() ); + } +} + +void plaYUVerApp::updatePropertiesSelectedArea( QRect area ) +{ + if( m_pcCurrentSubWindow ) + { + if( area.isNull() ) + { + m_pcFrameProperties->setData( m_pcCurrentSubWindow->getInputStream()->getCurrFrame() ); + m_pcFrameProperties->setSelection( area ); + } + else + { + m_pcFrameProperties->setSelection( area ); + } + } + else + { + m_pcFrameProperties->setData( NULL ); } } diff --git a/source/app/plaYUVerApp.h b/source/app/plaYUVerApp.h index 52bea4b..9a8dafd 100644 --- a/source/app/plaYUVerApp.h +++ b/source/app/plaYUVerApp.h @@ -99,6 +99,8 @@ private Q_SLOTS: void updatePixelValueStatusBar(const QPoint & pos, InputStream* stream); + void updatePropertiesSelectedArea( QRect area ); + void setAllSubWindowTool( ); void setNavigationTool( ); void setSelectionTool( );