Very initial implementation to track pixel coordinates and value using mouse.

This commit is contained in:
Luis Lucas committed 2014-03-22 15:23:23 +00:00
1 parent 2c854c07e1
commit 16401d1454
10 files changed
+61 -4

No files matched your search

-1
View File
@@ -220,7 +220,6 @@ void ViewArea::updateSize()
// perform the necessary updates (updateOffset).
resize( p->width(), p->height() );
}
if( w <= width() && h <= height() )
updateOffset();
}
+1
View File
@@ -103,6 +103,7 @@ public:
signals:
void selectionChanged( const QRect &rect );
void positionChanged( const QPoint &pos );
void updateStatusBar( const QPoint &actualPos, int &luma, int &chromaU, int &chromaV );
void zoomFactorChanged( double );
public slots:
+5
View File
@@ -160,6 +160,11 @@ public:
}
}
PlaYUVerFrame *getCurrentFrame()
{
return m_cCurrFrame;
}
};
} // NAMESPACE
+6
View File
@@ -207,4 +207,10 @@ UInt64 PlaYUVerFrame::getBytesPerFrame()
return 0;
}
Pel PlaYUVerFrame::getPixelValueFromYUV(const QPoint &pos, YUVcomponent color)
{
return m_pppcInputPel[color][0][pos.y()*m_uiWidth+pos.x()];
}
} // NAMESPACE
+3
View File
@@ -56,6 +56,9 @@ public:
{
return m_pppcRGBPel;
}
Pel getPixelValueFromYUV(const QPoint &pos, YUVcomponent color);
private:
Void YUV420toRGB();
+1 -1
View File
@@ -249,7 +249,7 @@ QSize SubWindowHandle::sizeHint() const
maxSize = p->size();
}
QSize isize = QSize( m_pCurrStream->getWidth() + 500, m_pCurrStream->getHeight() + 500 );
QSize isize = QSize( m_pCurrStream->getWidth() + 50, m_pCurrStream->getHeight() + 50 );
// If the SubWindowHandle needs more space that the avaiable, we'll give
// to the subwindow a reasonable size preserving the image aspect ratio.
+5
View File
@@ -75,6 +75,11 @@ public:
return m_pCurrStream;
}
ViewArea* getViewArea()
{
return m_cViewArea;
}
/**
* Show the image at its original size
*/
+15
View File
@@ -115,6 +115,21 @@ enum InputStreamColorSpace
NO_FMT = -1, YUV420, YUV400, YUV422, RGB,
};
enum YUVcomponent
{
LUMA = 0,
CHROMA_U,
CHROMA_V,
};
enum RGBcomponent
{
COLOR_R = 0,
COLOR_G,
COLOR_B,
};
}
+24 -2
View File
@@ -117,6 +117,8 @@ void plaYUVerApp::open()
addSubWindow( interfaceChild );
statusBar()->showMessage( tr( "File loaded" ), 2000 );
interfaceChild->show();
connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &) ), this, SLOT( updatePixelValueStatusBar(const QPoint &) ) );
}
else
{
@@ -576,8 +578,8 @@ QMdiSubWindow *plaYUVerApp::findSubWindow( const QString &fileName )
foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){
SubWindowHandle *mdiChild = qobject_cast<SubWindowHandle *>( window);
if( mdiChild->currentFile() == canonicalFilePath )
return window;
}
return window;
}
return 0;
}
@@ -588,4 +590,24 @@ void plaYUVerApp::setActiveSubWindow( QWidget *window )
mdiArea->setActiveSubWindow( qobject_cast<QMdiSubWindow *>( window ) );
}
void plaYUVerApp::updatePixelValueStatusBar(const QPoint & pos)
{
Pel pixel;
Int iWidth, iHeight;
Int posX = pos.x(), posY = pos.y();
QString strStatus = QString("X=%1 Y=%2 ").arg(posX).arg(posY);
SubWindowHandle *currentSubWindow = activeSubWindow();
iWidth = currentSubWindow->getInputStream()->getWidth();
iHeight = currentSubWindow->getInputStream()->getHeight();
if( (posX<iWidth) && (posX>=0) && (posY<iHeight) && (posY>=0) )
{
pixel = currentSubWindow->getInputStream()->getCurrentFrame()->getPixelValueFromYUV(pos, LUMA);
QString strAux = QString("Luma= %1").arg(pixel);
strStatus.append(strAux);
statusBar()->showMessage( strStatus , 0 );
}
}
} // NAMESPACE
+1
View File
@@ -84,6 +84,7 @@ private Q_SLOTS:
void dropEvent(QDropEvent *event);
void setActiveSubWindow( QWidget *window );
void updatePixelValueStatusBar(const QPoint & pos);
private:
QMdiArea *mdiArea;