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


C++ BRegion类代码示例

本文整理汇总了C++中BRegion的典型用法代码示例。如果您正苦于以下问题:C++ BRegion类的具体用法?C++ BRegion怎么用?C++ BRegion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: DrawItemColumn

void APListItemDescription::DrawItemColumn(BView *owner, BRect itemColumnRect, int32 columnIndex, bool complete)
{
	BRegion region;
	char *strPtr;

	// Initialize drawing
	owner->SetLowColor(White);
	owner->SetDrawingMode(B_OP_COPY);

	// Draw the background color
	if (complete)
	{
		owner->SetHighColor(White);
		owner->FillRect(itemColumnRect);
	}

	// Draw the item
	region.Include(itemColumnRect);
	owner->ConstrainClippingRegion(&region);

	owner->SetHighColor(Black);
	owner->DrawString((strPtr = columnText.GetString()), BPoint(itemColumnRect.left + 2.0f, itemColumnRect.top + textOffset));
	columnText.FreeBuffer(strPtr);

	owner->ConstrainClippingRegion(NULL);
}
开发者ID:pulkomandy,项目名称:APlayer,代码行数:26,代码来源:APListItemDescription.cpp

示例2: while

BView *BubbleHelper::FindView(BPoint where)
{
    BView *winview=NULL;
    BWindow *win;
    long windex=0;
    while((winview==NULL)&&((win=be_app->WindowAt(windex++))!=NULL))
    {
        if(win!=textwin)
        {
            // lock with timeout, in case somebody has a non-running window around
            // in their app.
            if(win->LockWithTimeout(1E6)==B_OK)
            {
                BRect frame=win->Frame();
                if(frame.Contains(where))
                {
                    BPoint winpoint;
                    winpoint=where-frame.LeftTop();
                    winview=win->FindView(winpoint);
                    if(winview)
                    {
                        BRegion region;
                        BPoint newpoint=where;
                        winview->ConvertFromScreen(&newpoint);
                        winview->GetClippingRegion(&region);
                        if(!region.Contains(newpoint))
                            winview=0;
                    }
                }
                win->Unlock();
            }
        }
    }
    return winview;
}
开发者ID:carriercomm,项目名称:Helios,代码行数:35,代码来源:BubbleHelper.cpp

示例3: Draw

	virtual void Draw(BRect updateRect)
	{
		BRegion region;
		region.Include(BRect(20, 20, 40, 40));
		region.Include(BRect(30, 30, 80, 80));
		ConstrainClippingRegion(&region);

		SetHighColor(55, 255, 128, 255);
		FillRect(BRect(0, 0, 100, 100));

		PushState();
			SetOrigin(15, 15);
	
			ConstrainClippingRegion(&region);
	
			SetHighColor(155, 255, 128, 255);
			FillRect(BRect(0, 0, 100, 100));
	
//			ConstrainClippingRegion(NULL);
	
			SetHighColor(0, 0, 0, 255);
			StrokeLine(BPoint(2, 2), BPoint(80, 80));
			SetHighColor(255, 0, 0, 255);
			StrokeLine(BPoint(2, 2), BPoint(4, 2));
		PopState();

		SetHighColor(0, 0, 0, 255);
		StrokeLine(BPoint(4, 2), BPoint(82, 80));
	}
开发者ID:mmanley,项目名称:Antares,代码行数:29,代码来源:main.cpp

示例4: Bounds

void ObjectView::Draw(BRect region)
{
	BRect	bnd = Bounds();
	BRegion	regi; regi.Include(region);
	ConstrainClippingRegion(&regi);

	if (isSelected) {
		SetDrawingMode(B_OP_OVER);
		SetHighColor(black);
		FillRect(bnd, B_SOLID_HIGH);
		SetViewColor(black);
		SetHighColor(color);
	} else {
		SetDrawingMode(B_OP_OVER);
		SetHighColor(color);
		FillRect(bnd, B_SOLID_HIGH);
		SetViewColor(color);
		SetHighColor(black);
	}
	StrokeRect(bnd, B_SOLID_HIGH);
	if (label) {
		DrawString(label, labelPoint);
		if (container) {
			BRect	cb = container->Bounds();
			int	d = (cb.right-cb.left-30);
			int		llbl;
			for (	llbl = labelPoint.x + (1+(((int32)region.left) / d)) * d;
					llbl < region.right;
					llbl += d) {
				DrawString(label, BPoint(llbl,labelPoint.y));
			}
		}
	}
}
开发者ID:dakyri,项目名称:qua,代码行数:34,代码来源:ObjectView.cpp

示例5: CPPUNIT_ASSERT

void
SimpleTransformTest::TransformRegion()
{
	BRegion region;
	region.Include(BRect( 5.0,  5.0, 20.0, 20.0));
	region.Include(BRect(10.0, 10.0, 30.0, 30.0));
	region.Exclude(BRect(10.0, 20.0, 20.0, 25.0));

	BRegion reference1 = region;
	reference1.OffsetBy(10, 20);

	SimpleTransform specimen;
	specimen.AddOffset(10.0, 20.0);
	specimen.Apply(&region);
	CPPUNIT_ASSERT(region == reference1);

	specimen.SetScale(2.5);

	BRegion reference2;
	reference2.Include(BRect(47.0, 82.0, 87.0, 122.0));
	reference2.Include(BRect(60.0, 95.0, 112.0, 147.0));
	reference2.Exclude(BRect(60.0, 120.0, 86.0, 134.0));

	specimen.Apply(&region);
	CPPUNIT_ASSERT(region == reference2);
}
开发者ID:jessicah,项目名称:haiku-private,代码行数:26,代码来源:SimpleTransformTest.cpp

示例6: DrawItem

void CLVListItem::DrawItem(BView* owner, BRect itemRect, bool complete)
{
	BList* DisplayList = &((ColumnListView*)owner)->fColumnDisplayList;
	int32 NumberOfColumns = DisplayList->CountItems();
	//float PushMax = itemRect.right;
	CLVColumn* ThisColumn;
	BRect ThisColumnRect = itemRect;
	
	BRegion ClippingRegion;
	if(!complete)
		owner->GetClippingRegion(&ClippingRegion);
	else
		ClippingRegion.Set(itemRect);
	float LastColumnEnd = -1.0;

	//Draw the columns
	for(int32 Counter = 0; Counter < NumberOfColumns; Counter++)
	{
		ThisColumn = (CLVColumn*)DisplayList->ItemAt(Counter);
		if(!ThisColumn->IsShown())
			continue;
		ThisColumnRect.left = ThisColumn->fColumnBegin;
		ThisColumnRect.right = LastColumnEnd = ThisColumn->fColumnEnd;
		if(ThisColumnRect.right >= ThisColumnRect.left && ClippingRegion.Intersects(ThisColumnRect))
			DrawItemColumn(owner, ThisColumnRect, ((ColumnListView*)owner)->fColumnList.IndexOf(ThisColumn),complete);
	}
	//Fill the area after all the columns (so the select highlight goes all the way across)
	ThisColumnRect.left = LastColumnEnd + 1.0;
	ThisColumnRect.right = owner->Bounds().right;
	if(ThisColumnRect.left <= ThisColumnRect.right && ClippingRegion.Intersects(ThisColumnRect))
		DrawItemColumn(owner, ThisColumnRect,-1,complete);
}
开发者ID:jwiggins,项目名称:BeOS-Projects,代码行数:32,代码来源:CLVListItem.cpp

示例7: lt

void
DrawState::Transform(BRegion* region) const
{
	if (fCombinedScale == 1.0) {
		region->OffsetBy(fCombinedOrigin.x, fCombinedOrigin.y);
	} else {
		// TODO: optimize some more
		BRegion converted;
		int32 count = region->CountRects();
		for (int32 i = 0; i < count; i++) {
			BRect r = region->RectAt(i);
			BPoint lt(r.LeftTop());
			BPoint rb(r.RightBottom());
			// offset to bottom right corner of pixel before transformation
			rb.x++;
			rb.y++;
			// apply transformation
			Transform(&lt.x, &lt.y);
			Transform(&rb.x, &rb.y);
			// reset bottom right to pixel "index"
			rb.x--;
			rb.y--;
			// add rect to converted region
			// NOTE/TODO: the rect would not have to go
			// through the whole intersection test process,
			// it is guaranteed not to overlap with any rect
			// already contained in the region
			converted.Include(BRect(lt, rb));
		}
		*region = converted;
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:32,代码来源:DrawState.cpp

示例8: MakeFocus

void
MemoryView::MouseDown(BPoint point)
{
	if (!IsFocus())
		MakeFocus(true);

	if (fTargetBlock == NULL)
		return;

	int32 buttons;
	if (Looper()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK)
		buttons = B_PRIMARY_MOUSE_BUTTON;

	if (buttons == B_SECONDARY_MOUSE_BUTTON) {
		_HandleContextMenu(point);
		return;
	}

	int32 offset = _GetOffsetAt(point);
	if (offset < fSelectionStart || offset > fSelectionEnd) {
		BRegion oldSelectionRegion;
		_GetSelectionRegion(oldSelectionRegion);
		fSelectionBase = offset;
		fSelectionStart = fSelectionBase;
		fSelectionEnd = fSelectionBase;
		Invalidate(oldSelectionRegion.Frame());
	}

	SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
	fTrackingMouse = true;
}
开发者ID:dnivra,项目名称:haiku,代码行数:31,代码来源:MemoryView.cpp

示例9: UpdateVisibleDeep

void
View::SetHidden(bool hidden)
{
    if (fHidden != hidden) {
        fHidden = hidden;

        // recurse into children and update their visible flag
        bool oldVisible = fVisible;
        UpdateVisibleDeep(fParent ? fParent->IsVisible() : !fHidden);
        if (oldVisible != fVisible) {
            // Include or exclude us from the parent area, and update the
            // children's clipping as well when the view will be visible
            if (fParent)
                fParent->RebuildClipping(fVisible);
            else
                RebuildClipping(fVisible);

            if (fWindow) {
                // trigger a redraw
                IntRect clippedBounds = Bounds();
                ConvertToVisibleInTopView(&clippedBounds);
                BRegion* dirty = fWindow->GetRegion();
                if (!dirty)
                    return;
                dirty->Set((clipping_rect)clippedBounds);
                fWindow->MarkContentDirty(*dirty);
                fWindow->RecycleRegion(dirty);
            }
        }
    }
}
开发者ID:mmanley,项目名称:Antares,代码行数:31,代码来源:View.cpp

示例10: screenBounds

void
View::AddTokensForViewsInRegion(BPrivate::PortLink& link, BRegion& region,
                                BRegion* windowContentClipping)
{
    if (!fVisible)
        return;

    {
        // NOTE: use scope in order to reduce stack space requirements

        // This check will prevent descending the view hierarchy
        // any further than necessary
        IntRect screenBounds(Bounds());
        ConvertToScreen(&screenBounds);
        if (!region.Intersects((clipping_rect)screenBounds))
            return;

        // Unfortunately, we intersecting another region, but otherwise
        // we couldn't provide the exact update rect to the client
        BRegion localDirty = _ScreenClipping(windowContentClipping);
        localDirty.IntersectWith(&region);
        if (localDirty.CountRects() > 0) {
            link.Attach<int32>(fToken);
            link.Attach<BRect>(localDirty.Frame());
        }
    }

    for (View* child = FirstChild(); child; child = child->NextSibling())
        child->AddTokensForViewsInRegion(link, region, windowContentClipping);
}
开发者ID:mmanley,项目名称:Antares,代码行数:30,代码来源:View.cpp

示例11: IsSelected

void
RemoteFileItem::DrawItemColumn(BView * clv, BRect itemRect, int32 colIdx, bool complete)
{
	bool selected = IsSelected();
	rgb_color color = (selected) ? ((ColumnListView*)clv)->ItemSelectColor()
		: _owner->GetShareWindow()->GetColor(COLOR_BG);
	clv->SetLowColor(color);

	if ((selected) || (complete)) {
		clv->SetHighColor(color);
		clv->FillRect(itemRect);
	}

	if (colIdx > 0) {
		BRegion Region;
		Region.Include(itemRect);
		clv->ConstrainClippingRegion(&Region);
		clv->SetHighColor(_owner->GetShareWindow()->GetColor(COLOR_TEXT));
		const char* text = _owner->GetShareWindow()->GetFileCellText(this, colIdx);

		if (text)
			clv->DrawString(text, BPoint(itemRect.left+2.0,itemRect.top+_textOffset));

		clv->ConstrainClippingRegion(NULL);
	} else if (colIdx == 0) {
		const BBitmap* bmp = _owner->GetShareWindow()->GetBitmap(this, colIdx);

		if (bmp) {
			clv->SetDrawingMode(B_OP_OVER);
			clv->DrawBitmap(bmp, BPoint(itemRect.left + ((itemRect.Width()-bmp->Bounds().Width())/2.0f), itemRect.top+((itemRect.Height()-bmp->Bounds().Height())/2.0f)));
		}
	}
}
开发者ID:HaikuArchives,项目名称:BeShare,代码行数:33,代码来源:RemoteFileItem.cpp

示例12: UpdatePictureCueRegion

void TStageMovieCue::UpdatePictureCueRegion(double theTime)
{
	// Determine channelID
	int32 cueChannelID = m_ChannelCue->GetChannelID();
	
	// Get total channels
	int32 totalChannels = static_cast<MuseumApp *>(be_app)->GetCueSheet()->GetCueSheetView()->GetTotalChannels();
	
	// 	Determine cue layer.  Iterate through all higher layers and determine 
	//	the area to be invalidated.  Construct a region to do this.  Exlude all 
	//	other area rects in higher channels than us.  We wil then break 
	//	the region down into rects and invalidate them.		
	BRegion invalRegion;
	invalRegion.Include(m_ChannelCue->GetArea());
	
	for(int32 index = cueChannelID+1; index <= totalChannels; index++)
	{
		TStageCue *stageCue = ((TStageView *)Parent())->GetStageCueAtTimeandChannel(theTime, index);
		
		if (stageCue)
			invalRegion.Exclude( stageCue->GetChannelCue()->GetArea());							
	} 
	
	// Now call our custom invalidation routine	
	for(int32 index = 0; index < invalRegion.CountRects(); index++)
	{		
		Parent()->Invalidate( invalRegion.RectAt(index));	
		//((TStageView *)Parent())->StageDraw( invalRegion.RectAt(index), theTime);				
	}	
}
开发者ID:ModeenF,项目名称:UltraDV,代码行数:30,代码来源:TStageMovieCue.cpp

示例13: ClearAnts

void CCellView::StartDrag(BPoint where, bool copy)
{
	ClearAnts();
	BMessage msg(B_SIMPLE_DATA);
	msg.AddPointer("container", fContainer);
	msg.AddPointer("cellview", this);
	msg.AddData("range", 'rang', &fSelection, sizeof(range));
	msg.AddBool("dragacopy", copy);
	
	BRegion rgn;
	SelectionToRegion(rgn);
	cell c;
	GetCellHitBy(where, c);
	BRect dragRect = rgn.Frame();
	dragRect.OffsetBy(fCellWidths[c.h] - fCellWidths[fSelection.left],
		fCellHeights[c.v] - fCellHeights[fSelection.top]);
	
	BMallocIO buf;
	CTextConverter conv(buf, fContainer);
	conv.ConvertToText(&fSelection);
	msg.AddData("text/plain", B_MIME_DATA,
		buf.Buffer(), buf.BufferLength());

// and add a nice picture
	BPicture pic;
	BRect r;
	GetPictureOfSelection(&pic, r);
	pic.Archive(&msg);
//	msg.AddData("picture", 'PICT', pic.Data(), pic.DataSize());
	msg.AddData("rect of pict", 'RECT', &r, sizeof(BRect));
	
	fDragIsAcceptable = true;
	DragMessage(&msg, dragRect, this);
} /* CCellView::StartDrag */
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:34,代码来源:CellView.drag.cpp

示例14: _cairo_beos_surface_set_clip_region

static cairo_int_status_t
_cairo_beos_surface_set_clip_region (void              *abstract_surface,
                                     pixman_region16_t *region)
{
    fprintf(stderr, "Setting clip region\n");
    cairo_beos_surface_t *surface = reinterpret_cast<cairo_beos_surface_t*>(
							abstract_surface);
    AutoLockView locker(surface->view);
    if (!locker)
	return CAIRO_INT_STATUS_SUCCESS;

    if (region == NULL) {
	// No clipping
	surface->view->ConstrainClippingRegion(NULL);
	return CAIRO_INT_STATUS_SUCCESS;
    }

    int count = pixman_region_num_rects(region);
    pixman_box16_t* rects = pixman_region_rects(region);
    BRegion bregion;
    for (int i = 0; i < count; ++i) {
	// Have to substract one, because for pixman, the second coordinate
	// lies outside the rectangle.
	bregion.Include(BRect(rects[i].x1, rects[i].y1, rects[i].x2 - 1, rects[i].y2  - 1));
    }
    surface->view->ConstrainClippingRegion(&bregion);
    return CAIRO_INT_STATUS_SUCCESS;
}
开发者ID:hideakihata,项目名称:mozilla-central.fgv,代码行数:28,代码来源:cairo-beos-surface.cpp

示例15: ConvertToScreen

BRegion&
View::_ScreenClipping(BRegion* windowContentClipping, bool force) const
{
    if (!fScreenClippingValid || force) {
        fScreenClipping = fLocalClipping;
        ConvertToScreen(&fScreenClipping);

        // see if parts of our bounds are hidden underneath
        // the parent, the local clipping does not account for this
        IntRect clippedBounds = Bounds();
        ConvertToVisibleInTopView(&clippedBounds);
        if (clippedBounds.Width() < fScreenClipping.Frame().Width()
                || clippedBounds.Height() < fScreenClipping.Frame().Height()) {
            BRegion* temp = fWindow->GetRegion();
            if (temp) {
                temp->Set((clipping_rect)clippedBounds);
                fScreenClipping.IntersectWith(temp);
                fWindow->RecycleRegion(temp);
            }
        }

        fScreenClipping.IntersectWith(windowContentClipping);
        fScreenClippingValid = true;
    }

    return fScreenClipping;
}
开发者ID:mmanley,项目名称:Antares,代码行数:27,代码来源:View.cpp


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