Merge branch 'll-devel'
This commit is contained in:
commit
e95cef366d
4 files changed
+68
-4
No files matched your search
@@ -235,12 +235,18 @@ Void SubWindowHandle::zoomToFit()
|
|||||||
scaleView( niceFit );
|
scaleView( niceFit );
|
||||||
}
|
}
|
||||||
|
|
||||||
Void SubWindowHandle::scaleView( Double factor )
|
Void SubWindowHandle::scaleViewFactor( Double factor )
|
||||||
{
|
{
|
||||||
Q_ASSERT( m_cViewArea->image() );
|
Q_ASSERT( m_cViewArea->image() );
|
||||||
m_cViewArea->zoomChangeEvent( factor );
|
m_cViewArea->zoomChangeEvent( factor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Void SubWindowHandle::scaleView( Double scale )
|
||||||
|
{
|
||||||
|
Q_ASSERT( m_cViewArea->image() );
|
||||||
|
m_cViewArea->setZoomFactor( scale );
|
||||||
|
}
|
||||||
|
|
||||||
Void SubWindowHandle::scaleView( Int width, Int height )
|
Void SubWindowHandle::scaleView( Int width, Int height )
|
||||||
{
|
{
|
||||||
scaleView( QSize( width, height ) );
|
scaleView( QSize( width, height ) );
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public:
|
|||||||
* @param factor factor of scale. Ex: 1.2 scale the image up by 20% and
|
* @param factor factor of scale. Ex: 1.2 scale the image up by 20% and
|
||||||
* 0.8 scale the image down by 25%
|
* 0.8 scale the image down by 25%
|
||||||
*/
|
*/
|
||||||
Void scaleView( Double factor );
|
Void scaleView( Double scale );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current image size is scaled to a rectangle as large as possible
|
* The current image size is scaled to a rectangle as large as possible
|
||||||
@@ -121,6 +121,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
Void scaleView( const QSize & size );
|
Void scaleView( const QSize & size );
|
||||||
|
|
||||||
|
Void scaleViewFactor( Double factor );
|
||||||
|
|
||||||
Double getScaleFactor()
|
Double getScaleFactor()
|
||||||
{
|
{
|
||||||
return m_cViewArea->getZoomFactor();
|
return m_cViewArea->getZoomFactor();
|
||||||
|
|||||||
+57
-1
@@ -37,6 +37,8 @@
|
|||||||
|
|
||||||
#include "ViewArea.h"
|
#include "ViewArea.h"
|
||||||
#include "GridManager.h"
|
#include "GridManager.h"
|
||||||
|
#include "PlaYUVerFrame.h"
|
||||||
|
#include "InputStream.h"
|
||||||
|
|
||||||
namespace plaYUVer
|
namespace plaYUVer
|
||||||
{
|
{
|
||||||
@@ -108,7 +110,7 @@ Double ViewArea::getZoomFactor()
|
|||||||
Void ViewArea::zoomChangeEvent(Double factor)
|
Void ViewArea::zoomChangeEvent(Double factor)
|
||||||
{
|
{
|
||||||
Double zoomFactor;
|
Double zoomFactor;
|
||||||
Double maxZoom = 10.0;
|
Double maxZoom = 100.0;
|
||||||
Double minZoom = ( 32.0 / m_pixmap.width() );
|
Double minZoom = ( 32.0 / m_pixmap.width() );
|
||||||
|
|
||||||
if( ( m_zoomFactor == minZoom ) && (factor < 1 ) )
|
if( ( m_zoomFactor == minZoom ) && (factor < 1 ) )
|
||||||
@@ -324,6 +326,60 @@ void ViewArea::paintEvent( QPaintEvent *event )
|
|||||||
|
|
||||||
painter.restore();
|
painter.restore();
|
||||||
|
|
||||||
|
|
||||||
|
if(m_zoomFactor>=25.0)
|
||||||
|
{
|
||||||
|
Int imageWidth = m_pixmap.width();
|
||||||
|
Int imageHeight = m_pixmap.height();
|
||||||
|
PlaYUVerFrame *curFrame = getInputStream()->getCurrFrame();
|
||||||
|
Pixel sPixelValue;
|
||||||
|
|
||||||
|
QFont font("Helvetica");
|
||||||
|
font.setPixelSize(m_zoomFactor/4);
|
||||||
|
painter.setFont(font);
|
||||||
|
|
||||||
|
QRect vr = windowToView( winRect );
|
||||||
|
vr &= QRect( 0, 0, imageWidth, imageHeight );
|
||||||
|
|
||||||
|
for(Int i=vr.x() ; i<=vr.right() ; i++)
|
||||||
|
{
|
||||||
|
for(Int j=vr.y() ; j<=vr.bottom() ; j++)
|
||||||
|
{
|
||||||
|
QPoint pixelTopLeft(i,j);
|
||||||
|
sPixelValue = curFrame->getPixelValue( pixelTopLeft, COLOR_YUV );
|
||||||
|
|
||||||
|
QRect pixelRect(viewToWindow(pixelTopLeft), QSize(m_zoomFactor,m_zoomFactor));
|
||||||
|
if( sPixelValue.Luma < 128 )
|
||||||
|
painter.setPen(QColor(Qt::white));
|
||||||
|
else
|
||||||
|
painter.setPen(QColor(Qt::black));
|
||||||
|
painter.drawText(pixelRect, Qt::AlignCenter, QString::number(sPixelValue.Luma));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QColor color( Qt::white );
|
||||||
|
QPen mainPen = QPen( color, 1, Qt::SolidLine );
|
||||||
|
painter.setPen(mainPen);
|
||||||
|
|
||||||
|
// Draw vertical line
|
||||||
|
for( Int x = vr.x(); x <= vr.right(); x ++ )
|
||||||
|
{
|
||||||
|
// Always draw the full line otherwise the line stippling
|
||||||
|
// varies with the location of view area and we get glitchy
|
||||||
|
// patterns.
|
||||||
|
painter.drawLine( viewToWindow(QPoint(x,0)), viewToWindow(QPoint(x,imageHeight)) );
|
||||||
|
qDebug() << "Line " << viewToWindow(QPoint(x,0)) << viewToWindow(QPoint(x,imageHeight)) << m_zoomFactor;
|
||||||
|
}
|
||||||
|
// Draw horizontal line
|
||||||
|
for( Int y = vr.y(); y <= vr.bottom(); y ++ )
|
||||||
|
{
|
||||||
|
painter.drawLine( viewToWindow(QPoint(0,y)), viewToWindow(QPoint(imageWidth,y)) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Draw a border around the image.
|
// Draw a border around the image.
|
||||||
if( m_xOffset || m_yOffset )
|
if( m_xOffset || m_yOffset )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ void plaYUVerApp::scaleFrame( int ratio )
|
|||||||
{
|
{
|
||||||
if( activeSubWindow() )
|
if( activeSubWindow() )
|
||||||
{
|
{
|
||||||
activeSubWindow()->scaleView( ( Double )( ratio ) / 100.0 );
|
activeSubWindow()->scaleViewFactor( ( Double )( ratio ) / 100.0 );
|
||||||
|
|
||||||
// actionZoomIn->setEnabled( activeSubWindow()->getScaleFactor() < 3.0 );
|
// actionZoomIn->setEnabled( activeSubWindow()->getScaleFactor() < 3.0 );
|
||||||
// actionZoomOut->setEnabled( activeSubWindow()->getScaleFactor() > 0.333 );
|
// actionZoomOut->setEnabled( activeSubWindow()->getScaleFactor() > 0.333 );
|
||||||
|
|||||||
Reference in new issue
Block a user