当前位置: 首页>>代码示例>>C++>>正文


C++ wxDC::GetLogicalOrigin方法代码示例

本文整理汇总了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);
}
开发者ID:GreekFellows,项目名称:bildmanipulering,代码行数:31,代码来源:bmImage.cpp

示例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;
}
开发者ID:iokto,项目名称:newton-dynamics,代码行数:50,代码来源:winuniv.cpp

示例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;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:44,代码来源:winuniv.cpp


注:本文中的wxDC::GetLogicalOrigin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。