本文整理汇总了C++中wxDC::SetLogicalOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::SetLogicalOrigin方法的具体用法?C++ wxDC::SetLogicalOrigin怎么用?C++ wxDC::SetLogicalOrigin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::SetLogicalOrigin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void bmImage::render(wxDC& dc) {
bitmap = wxBitmap(aswxImage);
dc.Clear();
// few variables to make life easier
cv::Vec2f pScale = cv::Vec2f(((bmImageFrame*)this->GetParent())->scale);
cv::Vec2f pVOffScale = cv::Vec2f(((bmImageFrame*)this->GetParent())->voff);
cv::Vec2f pScroll = cv::Vec2f(((bmImageFrame*)this->GetParent())->scroll);
wxPoint orgp = dc.GetLogicalOrigin();
wxPoint trp(pScroll[0], pScroll[1]);
if (asCvMat.cols * pScale[0] < this->GetSize().GetWidth()) {
trp.x = -(this->GetSize().GetWidth() - asCvMat.cols * pScale[0]) / 2 / pScale[0];
}
if (asCvMat.rows * pScale[1] < this->GetSize().GetHeight()) {
trp.y = -(this->GetSize().GetHeight() - asCvMat.rows * pScale[1]) / 2 / pScale[1];
}/*
trp += wxPoint(
-(this->GetSize().GetWidth() - asCvMat.cols * pVOffScale[0]) / 2 / pVOffScale[0],
-(this->GetSize().GetHeight() - asCvMat.rows * pVOffScale[1]) / 2 / pVOffScale[1]
);*/
trp += wxPoint(
-asCvMat.cols * (pVOffScale[0] - 1.0f) / 2,
-asCvMat.rows * (pVOffScale[1] - 1.0f) / 2
);
dc.SetLogicalOrigin(trp.x, trp.y);
dc.SetUserScale(pScale[0], pScale[1]);
dc.DrawBitmap(bitmap, wxPoint(0, 0), false);
dc.SetLogicalOrigin(orgp.x, orgp.y);
}
示例2: DoDrawBackground
bool wxWindow::DoDrawBackground(wxDC& dc)
{
wxRect rect;
wxSize size = GetSize(); // Why not GetClientSize() ?
rect.x = 0;
rect.y = 0;
rect.width = size.x;
rect.height = size.y;
wxWindow * const parent = GetParent();
if ( HasTransparentBackground() && !UseBgCol() && parent )
{
// DirectFB paints the parent first, then its child windows, so by
// the time this code is called, parent's background was already
// drawn and there's no point in (imperfectly!) duplicating the work
// here:
#ifndef __WXDFB__
wxASSERT( !IsTopLevel() );
wxPoint pos = GetPosition();
AdjustForParentClientOrigin( pos.x, pos.y, 0 );
// Adjust DC logical origin
wxCoord org_x, org_y, x, y;
dc.GetLogicalOrigin( &org_x, &org_y );
x = org_x + pos.x;
y = org_y + pos.y;
dc.SetLogicalOrigin( x, y );
// Adjust draw rect
rect.x = pos.x;
rect.y = pos.y;
// Let parent draw the background
parent->EraseBackground( dc, rect );
// Restore DC logical origin
dc.SetLogicalOrigin( org_x, org_y );
#endif // !__WXDFB__
}
else
{
// Draw background ourselves
EraseBackground( dc, rect );
}
return true;
}
示例3: PrepareDC
void MainFrame::PrepareDC(wxDC& dc)
{
dc.SetLogicalOrigin( 0, 0 );
dc.SetAxisOrientation( 1, 0);
dc.SetUserScale( 1.0, 1.0 );
dc.SetMapMode( wxMM_TEXT );
}
示例4: DoDrawBackground
bool wxWindow::DoDrawBackground(wxDC& dc)
{
wxRect rect;
wxSize size = GetSize(); // Why not GetClientSize() ?
rect.x = 0;
rect.y = 0;
rect.width = size.x;
rect.height = size.y;
wxWindow * const parent = GetParent();
if ( HasTransparentBackground() && parent )
{
wxASSERT( !IsTopLevel() );
wxPoint pos = GetPosition();
AdjustForParentClientOrigin( pos.x, pos.y, 0 );
// Adjust DC logical origin
wxCoord org_x, org_y, x, y;
dc.GetLogicalOrigin( &org_x, &org_y );
x = org_x + pos.x;
y = org_y + pos.y;
dc.SetLogicalOrigin( x, y );
// Adjust draw rect
rect.x = pos.x;
rect.y = pos.y;
// Let parent draw the background
parent->EraseBackground( dc, rect );
// Restore DC logical origin
dc.SetLogicalOrigin( org_x, org_y );
}
else
{
// Draw background ourselves
EraseBackground( dc, rect );
}
return true;
}
示例5: InitialStateWithTransformedDC
void ClippingBoxTestCaseBase::InitialStateWithTransformedDC()
{
// Initial clipping box with transformed DC.
m_dc->SetDeviceOrigin(10, 15);
m_dc->SetUserScale(0.5, 1.5);
m_dc->SetLogicalScale(4.0, 2.0);
m_dc->SetLogicalOrigin(-15, -20);
m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
m_dc->Clear();
CheckBox(-20, -25, 50, 40);
}
示例6: OneRegionWithTransformedDC
void ClippingBoxTestCaseBase::OneRegionWithTransformedDC()
{
// Setting one clipping box inside DC area
// with applied some transformations.
m_dc->SetDeviceOrigin(10, 15);
m_dc->SetUserScale(0.5, 1.5);
m_dc->SetLogicalScale(4.0, 2.0);
m_dc->SetLogicalOrigin(-15, -20);
m_dc->SetClippingRegion(-10, -20, 80, 75);
m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
m_dc->Clear();
CheckBox(-10, -20, 40, 35);
}
示例7: DoPrepareDC
void EDA_DRAW_PANEL::DoPrepareDC( wxDC& dc )
{
wxScrolledWindow::DoPrepareDC( dc );
if( GetScreen() != NULL )
{
double scale = GetScreen()->GetScalingFactor();
dc.SetUserScale( scale, scale );
wxPoint pt = GetScreen()->m_DrawOrg;
dc.SetLogicalOrigin( pt.x, pt.y );
}
SetClipBox( dc ); // Reset the clip box to the entire screen.
GRResetPenAndBrush( &dc );
dc.SetBackgroundMode( wxTRANSPARENT );
}
示例8: PrepareDC
void MyFrame::PrepareDC(wxDC& dc) {
dc.SetLogicalOrigin(m_xLogicalOrigin, m_yLogicalOrigin);
dc.SetAxisOrientation(!m_xAxisReversed, m_yAxisReversed);
dc.SetUserScale(m_xUserScale, m_yUserScale);
dc.SetMapMode(m_mapMode);
}