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


C++ View::Draw方法代码示例

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


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

示例1: DrawViews

/** Please be sure to call this should you ever
 * override the default Draw() method.
 */
void Window::DrawViews( Rect frame )
{
    /// \todo Only update the requested frame.
    lock();
    for ( int i = 0; i < CountChildren(); i++ )
    {
        View *view = ChildAt(i);
        view->Draw( view->Bounds() );
        view->DrawChildren( view->Bounds() );
    }
    unlock();
}
开发者ID:AdamRLukaitis,项目名称:spoon,代码行数:15,代码来源:Window.cpp

示例2: DrawChildren

void View::DrawChildren( Rect rect )
{
   if ( GetWindow() == NULL ) return;

   lock();
   for ( int i = 0; i < CountChildren(); i++ ) 
   {
     View *child = ChildAt(i);
           child->Draw( rect );
		   child->DrawChildren( rect );
   }
   unlock();
}
开发者ID:AdamRLukaitis,项目名称:spoon,代码行数:13,代码来源:View.cpp

示例3: ScreenAndUserClipping

void
View::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping,
           BRegion* windowContentClipping, bool deep)
{
    if (!fVisible) {
        // child views cannot be visible either
        return;
    }

    if (fViewBitmap != NULL || fViewColor != B_TRANSPARENT_COLOR) {
        // we can only draw within our own area
        BRegion* redraw;
        if ((fFlags & B_DRAW_ON_CHILDREN) != 0) {
            // The client may actually want to prevent the background to
            // be painted outside the user clipping.
            redraw = fWindow->GetRegion(
                         ScreenAndUserClipping(windowContentClipping));
        } else {
            // Ignore user clipping as in BeOS for painting the background.
            redraw = fWindow->GetRegion(
                         _ScreenClipping(windowContentClipping));
        }
        if (!redraw)
            return;
        // add the current clipping
        redraw->IntersectWith(effectiveClipping);

        Overlay* overlayCookie = _Overlay();

        if (fViewBitmap != NULL && overlayCookie == NULL) {
            // draw view bitmap
            // TODO: support other options!
            BRect rect = fBitmapDestination;
            ConvertToScreenForDrawing(&rect);

            align_rect_to_pixels(&rect);

            if (fBitmapOptions & B_TILE_BITMAP_Y) {
                // move rect up as much as needed
                while (rect.top > redraw->Frame().top)
                    rect.OffsetBy(0.0, -(rect.Height() + 1));
            }
            if (fBitmapOptions & B_TILE_BITMAP_X) {
                // move rect left as much as needed
                while (rect.left > redraw->Frame().left)
                    rect.OffsetBy(-(rect.Width() + 1), 0.0);
            }

// XXX: locking removed because the Window keeps the engine locked
// because it keeps track of syncing right now

            // lock the drawing engine for as long as we need the clipping
            // to be valid
            if (rect.IsValid()/* && drawingEngine->Lock()*/) {
                drawingEngine->ConstrainClippingRegion(redraw);

                drawing_mode oldMode;
                drawingEngine->SetDrawingMode(B_OP_COPY, oldMode);

                if (fBitmapOptions & B_TILE_BITMAP) {
                    // tile across entire view

                    float start = rect.left;
                    while (rect.top < redraw->Frame().bottom) {
                        while (rect.left < redraw->Frame().right) {
                            drawingEngine->DrawBitmap(fViewBitmap,
                                                      fBitmapSource, rect, fBitmapOptions);
                            rect.OffsetBy(rect.Width() + 1, 0.0);
                        }
                        rect.OffsetBy(start - rect.left, rect.Height() + 1);
                    }
                    // nothing left to be drawn
                    redraw->MakeEmpty();
                } else if (fBitmapOptions & B_TILE_BITMAP_X) {
                    // tile in x direction

                    while (rect.left < redraw->Frame().right) {
                        drawingEngine->DrawBitmap(fViewBitmap, fBitmapSource,
                                                  rect, fBitmapOptions);
                        rect.OffsetBy(rect.Width() + 1, 0.0);
                    }
                    // remove horizontal stripe from clipping
                    rect.left = redraw->Frame().left;
                    rect.right = redraw->Frame().right;
                    redraw->Exclude(rect);
                } else if (fBitmapOptions & B_TILE_BITMAP_Y) {
                    // tile in y direction

                    while (rect.top < redraw->Frame().bottom) {
                        drawingEngine->DrawBitmap(fViewBitmap, fBitmapSource,
                                                  rect, fBitmapOptions);
                        rect.OffsetBy(0.0, rect.Height() + 1);
                    }
                    // remove vertical stripe from clipping
                    rect.top = redraw->Frame().top;
                    rect.bottom = redraw->Frame().bottom;
                    redraw->Exclude(rect);
                } else {
                    // no tiling at all

//.........这里部分代码省略.........
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:View.cpp


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