refactor scanner ext. to use RenderContext
Change-Id: I31e4ea09b3a7bd65e589481c4c128275a8a7c1b7
This commit is contained in:
parent
b4bbb5e5d7
commit
a97fc29f72
@ -50,10 +50,10 @@ class GridWindow : public vcl::Window
|
||||
return (maPos.X() < rComp.maPos.X());
|
||||
}
|
||||
|
||||
void draw(vcl::Window& rWin, const BitmapEx& rBitmapEx)
|
||||
void draw(vcl::RenderContext& rRenderContext, const BitmapEx& rBitmapEx)
|
||||
{
|
||||
const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY)));
|
||||
rWin.DrawBitmapEx(maPos - aOffset, rBitmapEx);
|
||||
const Point aOffset(rRenderContext.PixelToLogic(Point(mnOffX, mnOffY)));
|
||||
rRenderContext.DrawBitmapEx(maPos - aOffset, rBitmapEx);
|
||||
}
|
||||
|
||||
bool isHit(vcl::Window& rWin, const Point& rPos)
|
||||
@ -100,10 +100,10 @@ class GridWindow : public vcl::Window
|
||||
double findMaxX();
|
||||
double findMaxY();
|
||||
|
||||
void drawGrid();
|
||||
void drawOriginal();
|
||||
void drawNew();
|
||||
void drawHandles();
|
||||
void drawGrid(vcl::RenderContext& rRenderContext);
|
||||
void drawOriginal(vcl::RenderContext& rRenderContext);
|
||||
void drawNew(vcl::RenderContext& rRenderContext);
|
||||
void drawHandles(vcl::RenderContext& rRenderContext);
|
||||
|
||||
void computeExtremes();
|
||||
static void computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut );
|
||||
@ -116,7 +116,7 @@ class GridWindow : public vcl::Window
|
||||
void onResize();
|
||||
virtual void Resize() SAL_OVERRIDE;
|
||||
virtual Size GetOptimalSize() const SAL_OVERRIDE;
|
||||
void drawLine( double x1, double y1, double x2, double y2 );
|
||||
void drawLine(vcl::RenderContext& rRenderContext, double x1, double y1, double x2, double y2);
|
||||
public:
|
||||
GridWindow(vcl::Window* pParent);
|
||||
void Init(double* pXValues, double* pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap);
|
||||
@ -336,9 +336,9 @@ void GridWindow::transform( const Point& rOriginal, double& x, double& y )
|
||||
y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / (double)nHeight + m_fMinY;
|
||||
}
|
||||
|
||||
void GridWindow::drawLine( double x1, double y1, double x2, double y2 )
|
||||
void GridWindow::drawLine(vcl::RenderContext& rRenderContext, double x1, double y1, double x2, double y2 )
|
||||
{
|
||||
DrawLine( transform( x1, y1 ), transform( x2, y2 ) );
|
||||
rRenderContext.DrawLine(transform(x1, y1), transform(x2, y2));
|
||||
}
|
||||
|
||||
void GridWindow::computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut )
|
||||
@ -455,87 +455,89 @@ void GridWindow::setBoundings(double fMinX, double fMinY, double fMaxX, double f
|
||||
computeChunk( m_fMinY, m_fMaxY, m_fChunkY, m_fMinChunkY );
|
||||
}
|
||||
|
||||
void GridWindow::drawGrid()
|
||||
void GridWindow::drawGrid(vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
char pBuf[256];
|
||||
SetLineColor( Color( COL_BLACK ) );
|
||||
rRenderContext.SetLineColor(Color(COL_BLACK));
|
||||
// draw vertical lines
|
||||
for( double fX = m_fMinChunkX; fX < m_fMaxX; fX += m_fChunkX )
|
||||
for (double fX = m_fMinChunkX; fX < m_fMaxX; fX += m_fChunkX)
|
||||
{
|
||||
drawLine( fX, m_fMinY, fX, m_fMaxY );
|
||||
drawLine(rRenderContext, fX, m_fMinY, fX, m_fMaxY);
|
||||
// draw tickmarks
|
||||
Point aPt = transform( fX, m_fMinY );
|
||||
std::sprintf( pBuf, "%g", fX );
|
||||
OUString aMark( pBuf, strlen(pBuf), osl_getThreadTextEncoding() );
|
||||
Size aTextSize( GetTextWidth( aMark ), GetTextHeight() );
|
||||
aPt.X() -= aTextSize.Width()/2;
|
||||
aPt.Y() += aTextSize.Height()/2;
|
||||
DrawText( aPt, aMark );
|
||||
Point aPt = transform(fX, m_fMinY);
|
||||
std::sprintf(pBuf, "%g", fX);
|
||||
OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding());
|
||||
Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight());
|
||||
aPt.X() -= aTextSize.Width() / 2;
|
||||
aPt.Y() += aTextSize.Height() / 2;
|
||||
rRenderContext.DrawText(aPt, aMark);
|
||||
}
|
||||
// draw horizontal lines
|
||||
for( double fY = m_fMinChunkY; fY < m_fMaxY; fY += m_fChunkY )
|
||||
for (double fY = m_fMinChunkY; fY < m_fMaxY; fY += m_fChunkY)
|
||||
{
|
||||
drawLine( m_fMinX, fY, m_fMaxX, fY );
|
||||
drawLine(rRenderContext, m_fMinX, fY, m_fMaxX, fY);
|
||||
// draw tickmarks
|
||||
Point aPt = transform( m_fMinX, fY );
|
||||
std::sprintf( pBuf, "%g", fY );
|
||||
OUString aMark( pBuf, strlen(pBuf), osl_getThreadTextEncoding() );
|
||||
Size aTextSize( GetTextWidth( aMark ), GetTextHeight() );
|
||||
Point aPt = transform(m_fMinX, fY);
|
||||
std::sprintf(pBuf, "%g", fY);
|
||||
OUString aMark(pBuf, strlen(pBuf), osl_getThreadTextEncoding());
|
||||
Size aTextSize(rRenderContext.GetTextWidth(aMark), rRenderContext.GetTextHeight());
|
||||
aPt.X() -= aTextSize.Width() + 2;
|
||||
aPt.Y() -= aTextSize.Height()/2;
|
||||
DrawText( aPt, aMark );
|
||||
aPt.Y() -= aTextSize.Height() / 2;
|
||||
rRenderContext.DrawText(aPt, aMark);
|
||||
}
|
||||
|
||||
// draw boundings
|
||||
drawLine( m_fMinX, m_fMinY, m_fMaxX, m_fMinY );
|
||||
drawLine( m_fMinX, m_fMaxY, m_fMaxX, m_fMaxY );
|
||||
drawLine( m_fMinX, m_fMinY, m_fMinX, m_fMaxY );
|
||||
drawLine( m_fMaxX, m_fMinY, m_fMaxX, m_fMaxY );
|
||||
drawLine(rRenderContext, m_fMinX, m_fMinY, m_fMaxX, m_fMinY);
|
||||
drawLine(rRenderContext, m_fMinX, m_fMaxY, m_fMaxX, m_fMaxY);
|
||||
drawLine(rRenderContext, m_fMinX, m_fMinY, m_fMinX, m_fMaxY);
|
||||
drawLine(rRenderContext, m_fMaxX, m_fMinY, m_fMaxX, m_fMaxY);
|
||||
}
|
||||
|
||||
void GridWindow::drawOriginal()
|
||||
void GridWindow::drawOriginal(vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
if( m_nValues && m_pXValues && m_pOrigYValues )
|
||||
if (m_nValues && m_pXValues && m_pOrigYValues)
|
||||
{
|
||||
SetLineColor( Color( COL_RED ) );
|
||||
for( int i = 0; i < m_nValues-1; i++ )
|
||||
rRenderContext.SetLineColor(Color(COL_RED));
|
||||
for (int i = 0; i < m_nValues - 1; i++)
|
||||
{
|
||||
drawLine( m_pXValues[ i ], m_pOrigYValues[ i ],
|
||||
m_pXValues[ i+1 ], m_pOrigYValues[ i+1 ] );
|
||||
drawLine(rRenderContext,
|
||||
m_pXValues[i], m_pOrigYValues[i],
|
||||
m_pXValues[i + 1], m_pOrigYValues[i + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GridWindow::drawNew()
|
||||
void GridWindow::drawNew(vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
if( m_nValues && m_pXValues && m_pNewYValues )
|
||||
if (m_nValues && m_pXValues && m_pNewYValues)
|
||||
{
|
||||
SetClipRegion(vcl::Region(m_aGridArea));
|
||||
SetLineColor( Color( COL_YELLOW ) );
|
||||
for( int i = 0; i < m_nValues-1; i++ )
|
||||
rRenderContext.SetClipRegion(vcl::Region(m_aGridArea));
|
||||
rRenderContext.SetLineColor(Color(COL_YELLOW));
|
||||
for (int i = 0; i < m_nValues - 1; i++)
|
||||
{
|
||||
drawLine( m_pXValues[ i ], m_pNewYValues[ i ],
|
||||
m_pXValues[ i+1 ], m_pNewYValues[ i+1 ] );
|
||||
drawLine(rRenderContext,
|
||||
m_pXValues[i], m_pNewYValues[i],
|
||||
m_pXValues[i + 1], m_pNewYValues[i + 1]);
|
||||
}
|
||||
SetClipRegion();
|
||||
rRenderContext.SetClipRegion();
|
||||
}
|
||||
}
|
||||
|
||||
void GridWindow::drawHandles()
|
||||
void GridWindow::drawHandles(vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
for(sal_uInt32 i(0L); i < m_aHandles.size(); i++)
|
||||
{
|
||||
m_aHandles[i].draw(*this, m_aMarkerBitmap);
|
||||
m_aHandles[i].draw(rRenderContext, m_aMarkerBitmap);
|
||||
}
|
||||
}
|
||||
|
||||
void GridWindow::Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect )
|
||||
void GridWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
|
||||
{
|
||||
Window::Paint(rRenderContext, rRect);
|
||||
drawGrid();
|
||||
drawOriginal();
|
||||
drawNew();
|
||||
drawHandles();
|
||||
drawGrid(rRenderContext);
|
||||
drawOriginal(rRenderContext);
|
||||
drawNew(rRenderContext);
|
||||
drawHandles(rRenderContext);
|
||||
}
|
||||
|
||||
void GridWindow::MouseMove( const MouseEvent& rEvt )
|
||||
|
@ -50,7 +50,7 @@ private:
|
||||
bool mbDragDrawn;
|
||||
bool mbIsDragging;
|
||||
|
||||
void DrawRectangles(Point& rUL, Point& rBR);
|
||||
void DrawRectangles(vcl::RenderContext& rRenderContext, Point& rUL, Point& rBR);
|
||||
public:
|
||||
ScanPreview(vcl::Window* pParent, WinBits nStyle)
|
||||
: Window(pParent, nStyle)
|
||||
@ -62,16 +62,23 @@ public:
|
||||
, mbIsDragging(false)
|
||||
{
|
||||
}
|
||||
virtual ~ScanPreview() { disposeOnce(); }
|
||||
|
||||
virtual ~ScanPreview()
|
||||
{
|
||||
disposeOnce();
|
||||
}
|
||||
|
||||
virtual void dispose() SAL_OVERRIDE
|
||||
{
|
||||
mpParentDialog.clear();
|
||||
vcl::Window::dispose();
|
||||
}
|
||||
|
||||
void Init(SaneDlg *pParent)
|
||||
{
|
||||
mpParentDialog = pParent;
|
||||
}
|
||||
|
||||
void ResetForNewScanner()
|
||||
{
|
||||
maTopLeft = Point();
|
||||
@ -79,15 +86,27 @@ public:
|
||||
maMinTopLeft = Point();
|
||||
maMaxBottomRight = Point(PREVIEW_WIDTH, PREVIEW_HEIGHT);
|
||||
}
|
||||
void EnableDrag() { mbDragEnable = true; }
|
||||
void DisableDrag() { mbDragEnable = false; }
|
||||
bool IsDragEnabled() { return mbDragEnable; }
|
||||
virtual void Paint(vcl::RenderContext& /*rRenderContext*/, const Rectangle& rRect) SAL_OVERRIDE;
|
||||
|
||||
void EnableDrag()
|
||||
{
|
||||
mbDragEnable = true;
|
||||
}
|
||||
void DisableDrag()
|
||||
{
|
||||
mbDragEnable = false;
|
||||
}
|
||||
bool IsDragEnabled()
|
||||
{
|
||||
return mbDragEnable;
|
||||
}
|
||||
|
||||
virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
|
||||
virtual void MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
|
||||
virtual void MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE;
|
||||
virtual void MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
|
||||
Point GetPixelPos(const Point& rIn) const;
|
||||
Point GetLogicPos(const Point& rIn) const;
|
||||
|
||||
void GetPreviewLogicRect(Point& rTopLeft, Point &rBottomRight) const
|
||||
{
|
||||
rTopLeft = GetLogicPos(maTopLeft);
|
||||
@ -127,17 +146,16 @@ public:
|
||||
{
|
||||
maTopLeft = GetPixelPos(rTopLeft);
|
||||
maBottomRight = GetPixelPos(rBottomRight);
|
||||
maPreviewRect = Rectangle( maTopLeft,
|
||||
Size( maBottomRight.X() - maTopLeft.X(),
|
||||
maBottomRight.Y() - maTopLeft.Y() )
|
||||
);
|
||||
maPreviewRect = Rectangle(maTopLeft,
|
||||
Size(maBottomRight.X() - maTopLeft.X(),
|
||||
maBottomRight.Y() - maTopLeft.Y()));
|
||||
}
|
||||
void SetPreviewMaxRect(const Point& rTopLeft, const Point &rBottomRight)
|
||||
{
|
||||
maMinTopLeft = rTopLeft;
|
||||
maMaxBottomRight = rBottomRight;
|
||||
}
|
||||
void DrawDrag();
|
||||
void DrawDrag(vcl::RenderContext& rRenderContext);
|
||||
void UpdatePreviewBounds();
|
||||
void SetBitmap(SvStream &rStream)
|
||||
{
|
||||
@ -233,14 +251,10 @@ SaneDlg::SaneDlg( vcl::Window* pParent, Sane& rSane, bool bScanEnabled ) :
|
||||
maOldLink = mrSane.SetReloadOptionsHdl( LINK( this, SaneDlg, ReloadSaneOptionsHdl ) );
|
||||
|
||||
mpOptionBox->SetNodeBitmaps(get<FixedImage>("plus")->GetImage(),
|
||||
get<FixedImage>("minus")->GetImage());
|
||||
mpOptionBox->SetStyle( mpOptionBox->GetStyle()|
|
||||
WB_HASLINES |
|
||||
WB_HASBUTTONS |
|
||||
WB_NOINITIALSELECTION |
|
||||
WB_HASBUTTONSATROOT |
|
||||
WB_HASLINESATROOT
|
||||
);
|
||||
get<FixedImage>("minus")->GetImage());
|
||||
mpOptionBox->SetStyle(mpOptionBox->GetStyle() |
|
||||
WB_HASLINES | WB_HASBUTTONS | WB_NOINITIALSELECTION |
|
||||
WB_HASBUTTONSATROOT | WB_HASLINESATROOT);
|
||||
}
|
||||
|
||||
SaneDlg::~SaneDlg()
|
||||
@ -250,7 +264,7 @@ SaneDlg::~SaneDlg()
|
||||
|
||||
void SaneDlg::dispose()
|
||||
{
|
||||
mrSane.SetReloadOptionsHdl( maOldLink );
|
||||
mrSane.SetReloadOptionsHdl(maOldLink);
|
||||
mpOKButton.clear();
|
||||
mpCancelButton.clear();
|
||||
mpDeviceInfoButton.clear();
|
||||
@ -811,22 +825,22 @@ IMPL_LINK( SaneDlg, ModifyHdl, Edit*, pEdit )
|
||||
else if( pEdit == mpTopField )
|
||||
{
|
||||
mpPreview->ChangePreviewLogicTopLeftY(mpTopField->GetValue());
|
||||
mpPreview->DrawDrag();
|
||||
mpPreview->Invalidate();
|
||||
}
|
||||
else if( pEdit == mpLeftField )
|
||||
{
|
||||
mpPreview->ChangePreviewLogicTopLeftX(mpLeftField->GetValue());
|
||||
mpPreview->DrawDrag();
|
||||
mpPreview->Invalidate();
|
||||
}
|
||||
else if( pEdit == mpBottomField )
|
||||
{
|
||||
mpPreview->ChangePreviewLogicBottomRightY(mpBottomField->GetValue());
|
||||
mpPreview->DrawDrag();
|
||||
mpPreview->Invalidate();
|
||||
}
|
||||
else if( pEdit == mpRightField )
|
||||
{
|
||||
mpPreview->ChangePreviewLogicBottomRightX(mpRightField->GetValue());
|
||||
mpPreview->DrawDrag();
|
||||
mpPreview->Invalidate();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -918,18 +932,17 @@ void ScanPreview::UpdatePreviewBounds()
|
||||
void ScanPreview::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect)
|
||||
{
|
||||
Window::Paint(rRenderContext, rRect);
|
||||
SetMapMode(MAP_APPFONT);
|
||||
SetFillColor( Color( COL_WHITE ) );
|
||||
SetLineColor( Color( COL_WHITE ) );
|
||||
DrawRect( Rectangle( Point( 0, 0 ),
|
||||
Size( PREVIEW_WIDTH, PREVIEW_HEIGHT ) ) );
|
||||
SetMapMode( MapMode( MAP_PIXEL ) );
|
||||
rRenderContext.SetMapMode(MAP_APPFONT);
|
||||
rRenderContext.SetFillColor(Color(COL_WHITE));
|
||||
rRenderContext.SetLineColor(Color(COL_WHITE));
|
||||
rRenderContext.DrawRect(Rectangle(Point(0, 0),
|
||||
Size(PREVIEW_WIDTH, PREVIEW_HEIGHT)));
|
||||
rRenderContext.SetMapMode(MapMode(MAP_PIXEL));
|
||||
// check for sane values
|
||||
DrawBitmap( maPreviewRect.TopLeft(), maPreviewRect.GetSize(),
|
||||
maPreviewBitmap );
|
||||
rRenderContext.DrawBitmap(maPreviewRect.TopLeft(), maPreviewRect.GetSize(), maPreviewBitmap);
|
||||
|
||||
mbDragDrawn = false;
|
||||
DrawDrag();
|
||||
DrawDrag(rRenderContext);
|
||||
}
|
||||
|
||||
void SaneDlg::DisableOption()
|
||||
@ -1102,7 +1115,7 @@ void ScanPreview::MouseMove(const MouseEvent& rMEvt)
|
||||
maTopLeft.Y() = maBottomRight.Y();
|
||||
maBottomRight.Y() = nSwap;
|
||||
}
|
||||
DrawDrag();
|
||||
Invalidate();
|
||||
mpParentDialog->UpdateScanArea(false);
|
||||
}
|
||||
Window::MouseMove( rMEvt );
|
||||
@ -1188,7 +1201,7 @@ void ScanPreview::MouseButtonDown( const MouseEvent& rMEvt )
|
||||
if( mbIsDragging )
|
||||
{
|
||||
SetPointerPosPixel( aMousePixel );
|
||||
DrawDrag();
|
||||
Invalidate();
|
||||
}
|
||||
Window::MouseButtonDown( rMEvt );
|
||||
}
|
||||
@ -1204,51 +1217,51 @@ void ScanPreview::MouseButtonUp( const MouseEvent& rMEvt )
|
||||
Window::MouseButtonUp( rMEvt );
|
||||
}
|
||||
|
||||
void ScanPreview::DrawRectangles( Point& rUL, Point& rBR )
|
||||
void ScanPreview::DrawRectangles(vcl::RenderContext& rRenderContext, Point& rUL, Point& rBR)
|
||||
{
|
||||
int nMiddleX, nMiddleY;
|
||||
Point aBL, aUR;
|
||||
|
||||
aUR = Point( rBR.X(), rUL.Y() );
|
||||
aBL = Point( rUL.X(), rBR.Y() );
|
||||
nMiddleX = ( rBR.X() - rUL.X() ) / 2 + rUL.X();
|
||||
nMiddleY = ( rBR.Y() - rUL.Y() ) / 2 + rUL.Y();
|
||||
aUR = Point(rBR.X(), rUL.Y());
|
||||
aBL = Point(rUL.X(), rBR.Y());
|
||||
nMiddleX = (rBR.X() - rUL.X()) / 2 + rUL.X();
|
||||
nMiddleY = (rBR.Y() - rUL.Y()) / 2 + rUL.Y();
|
||||
|
||||
DrawLine( rUL, aBL );
|
||||
DrawLine( aBL, rBR );
|
||||
DrawLine( rBR, aUR );
|
||||
DrawLine( aUR, rUL );
|
||||
DrawRect( Rectangle( rUL, Size( RECT_SIZE_PIX,RECT_SIZE_PIX ) ) );
|
||||
DrawRect( Rectangle( aBL, Size( RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) );
|
||||
DrawRect( Rectangle( rBR, Size( -RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) );
|
||||
DrawRect( Rectangle( aUR, Size( -RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
|
||||
DrawRect( Rectangle( Point( nMiddleX - RECT_SIZE_PIX/2, rUL.Y() ), Size( RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
|
||||
DrawRect( Rectangle( Point( nMiddleX - RECT_SIZE_PIX/2, rBR.Y() ), Size( RECT_SIZE_PIX, -RECT_SIZE_PIX ) ) );
|
||||
DrawRect( Rectangle( Point( rUL.X(), nMiddleY - RECT_SIZE_PIX/2 ), Size( RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
|
||||
DrawRect( Rectangle( Point( rBR.X(), nMiddleY - RECT_SIZE_PIX/2 ), Size( -RECT_SIZE_PIX, RECT_SIZE_PIX ) ) );
|
||||
rRenderContext.DrawLine(rUL, aBL);
|
||||
rRenderContext.DrawLine(aBL, rBR);
|
||||
rRenderContext.DrawLine(rBR, aUR);
|
||||
rRenderContext.DrawLine(aUR, rUL);
|
||||
rRenderContext.DrawRect(Rectangle(rUL, Size(RECT_SIZE_PIX,RECT_SIZE_PIX)));
|
||||
rRenderContext.DrawRect(Rectangle(aBL, Size(RECT_SIZE_PIX, -RECT_SIZE_PIX)));
|
||||
rRenderContext.DrawRect(Rectangle(rBR, Size(-RECT_SIZE_PIX, -RECT_SIZE_PIX)));
|
||||
rRenderContext.DrawRect(Rectangle(aUR, Size(-RECT_SIZE_PIX, RECT_SIZE_PIX )));
|
||||
rRenderContext.DrawRect(Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rUL.Y()), Size(RECT_SIZE_PIX, RECT_SIZE_PIX)));
|
||||
rRenderContext.DrawRect(Rectangle(Point(nMiddleX - RECT_SIZE_PIX / 2, rBR.Y()), Size(RECT_SIZE_PIX, -RECT_SIZE_PIX)));
|
||||
rRenderContext.DrawRect(Rectangle(Point(rUL.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(RECT_SIZE_PIX, RECT_SIZE_PIX)));
|
||||
rRenderContext.DrawRect(Rectangle(Point(rBR.X(), nMiddleY - RECT_SIZE_PIX / 2), Size(-RECT_SIZE_PIX, RECT_SIZE_PIX)));
|
||||
}
|
||||
|
||||
void ScanPreview::DrawDrag()
|
||||
void ScanPreview::DrawDrag(vcl::RenderContext& rRenderContext)
|
||||
{
|
||||
static Point aLastUL, aLastBR;
|
||||
|
||||
if( ! mbDragEnable )
|
||||
if (!mbDragEnable)
|
||||
return;
|
||||
|
||||
RasterOp eROP = GetRasterOp();
|
||||
SetRasterOp( ROP_INVERT );
|
||||
SetMapMode( MapMode( MAP_PIXEL ) );
|
||||
RasterOp eROP = rRenderContext.GetRasterOp();
|
||||
rRenderContext.SetRasterOp(ROP_INVERT);
|
||||
rRenderContext.SetMapMode(MapMode(MAP_PIXEL));
|
||||
|
||||
if( mbDragDrawn )
|
||||
DrawRectangles( aLastUL, aLastBR );
|
||||
if (mbDragDrawn)
|
||||
DrawRectangles(rRenderContext, aLastUL, aLastBR);
|
||||
|
||||
aLastUL = maTopLeft;
|
||||
aLastBR = maBottomRight;
|
||||
DrawRectangles( maTopLeft, maBottomRight );
|
||||
DrawRectangles(rRenderContext, maTopLeft, maBottomRight);
|
||||
|
||||
mbDragDrawn = true;
|
||||
SetRasterOp( eROP );
|
||||
SetMapMode(MAP_APPFONT);
|
||||
rRenderContext.SetRasterOp(eROP);
|
||||
rRenderContext.SetMapMode(MAP_APPFONT);
|
||||
}
|
||||
|
||||
Point ScanPreview::GetPixelPos( const Point& rIn) const
|
||||
|
Loading…
x
Reference in New Issue
Block a user