本文整理汇总了C++中wxDC::GetLogicalOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::GetLogicalOrigin方法的具体用法?C++ wxDC::GetLogicalOrigin怎么用?C++ wxDC::GetLogicalOrigin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxDC
的用法示例。
在下文中一共展示了wxDC::GetLogicalOrigin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}