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


C++ wxRect::Intersect方法代码示例

本文整理汇总了C++中wxRect::Intersect方法的典型用法代码示例。如果您正苦于以下问题:C++ wxRect::Intersect方法的具体用法?C++ wxRect::Intersect怎么用?C++ wxRect::Intersect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxRect的用法示例。


在下文中一共展示了wxRect::Intersect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update_region_in_enlarged

wxBitmap Canvas::zoomed_bitmap_for_canvas_region
    ( const wxRect& unclipped_rect )
{
    wxRect image_area = wxRect( wxSize(contents->GetWidth(),
                                       contents->GetHeight()) );
    wxRect rect = unclipped_rect.Intersect( canvas_coords( image_area ) );

    wxRect subimage = image_coords( rect );
    wxRect smoothing_region_in_image = subimage,
            smoothing_region_in_canvas;

    smoothing_region_in_image.Inflate( Overlap * zoom_out_level )
        .Intersect( image_area );

    smoothing_region_in_canvas = 
        canvas_coords( smoothing_region_in_image );

    wxImage toScale = contents->GetSubImage( smoothing_region_in_image );
    toScale.Rescale( smoothing_region_in_canvas.GetWidth(), 
                        smoothing_region_in_canvas.GetHeight() );
    wxRect update_region_in_enlarged( rect );
    update_region_in_enlarged.Offset( 
        - smoothing_region_in_canvas.GetTopLeft() );
    wxImage toDraw = toScale.GetSubImage( update_region_in_enlarged );
    
    return wxBitmap( toDraw );
}
开发者ID:stevewolter,项目名称:rapidSTORM,代码行数:27,代码来源:Canvas.cpp

示例2: InvalidateRect

void Stage::InvalidateRect(const wxRect &inRect) {
    wxLogTrace(TRACE_STAGE_DRAWING, wxT("Invalidating: %d %d %d %d"),
               inRect.x, inRect.y, inRect.GetRight(), inRect.GetBottom());

    // We want to make sure that we never try to do any drawing off
    // the edges of the screen. Certain platforms, (like wxMac) get
    // very upset when you try to draw from or to rects that lie off
    // the screen. Since this is how all of the dirty regions enter
    // the system, we clip our dirty rect to the screen and make sure
    // we have something left before continuing.
    wxRect r(inRect.Intersect(wxRect(wxPoint(0, 0), GetSize())));
    if (r.IsEmpty())
        return;

    // It's a little bit inelegant to maintain two different dirty lists,
    // but they get cleared by different actions.
    mRectsToComposite.MergeRect(r);

    // Trigger screen repaint events--and update our manual refresh
    // list--but only if Quake 2 is not being displayed.  (Quake 2 covers
    // the entire stage, and if we repaint the screen, it will flicker.)
    // The entire screen will automatically be refreshed when Quake 2
    // is hidden.
    if (!GameEngineIsDisplayed()) {
        mRectsToRefresh.MergeRect(r);
        Refresh(FALSE, &r);
    }
}
开发者ID:colonelqubit,项目名称:halyard,代码行数:28,代码来源:Stage.cpp

示例3: clippedViewport

vector< wxRect > GetCoverage( const wxRect& viewport, const wxRect& canvas, const wxSize& gridSize )
{
    const wxRect clippedViewport( canvas.Intersect( viewport ) );

    vector< wxRect > coverage;
    const int top    = clippedViewport.GetTop()    / gridSize.y;
    const int bottom = clippedViewport.GetBottom() / gridSize.y;
    const int left   = clippedViewport.GetLeft()   / gridSize.x;
    const int right  = clippedViewport.GetRight()  / gridSize.x;
    for( int y = top; y <= bottom; ++y )
    {
        for( int x = left; x <= right; ++x )
        {
            const wxRect candidate( x * gridSize.x, y * gridSize.y, gridSize.x, gridSize.y );
            const wxRect clipped( canvas.Intersect( candidate ) );
            coverage.push_back( clipped );
        }
    }
    return coverage;
}
开发者ID:rsaxvc,项目名称:qanddview,代码行数:20,代码来源:ImagePanel.cpp

示例4: r

wxMatrix2D wxMatrix2D::SubMatrix(const wxRect& rect) const
{
    wxMatrix2D temp;
    wxCHECK_MSG(Ok(), temp, wxT("Invalid wxMatrix2D"));
    wxCHECK_MSG((rect.width > 0) && (rect.height > 0), temp, wxT("Invalid sub matrix rect"));

    int width = M_MATRIXDATA->m_width, height = M_MATRIXDATA->m_height;
    const wxRect r(0, 0, width, height);
    wxCHECK_MSG(r.Intersect(rect) == rect, temp, wxT("Invalid sub matrix"));

    if (!temp.Create(rect.width, rect.height, false))
        return temp;

    double *data      = GetData();
    double *temp_data = temp.GetData();

    int j, data_size = rect.width*sizeof(double);
    for (j = 0; j < rect.height; j++)
    {
        memcpy(&temp_data[j*rect.width], &data[rect.x + (j+rect.y)*width], data_size);
    }

    return temp;
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:24,代码来源:matrix2d.cpp


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