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


C++ BRect::OffsetByCopy方法代码示例

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


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

示例1: CopyPixelsIn

status_t MesaDriver::CopyPixelsIn(BBitmap *bitmap, BPoint location)
{
	color_space scs = bitmap->ColorSpace();
	color_space dcs = m_bitmap->ColorSpace();

	if (scs != dcs && (dcs != B_RGBA32 || scs != B_RGB32)) {
		printf("CopyPixelsIn(): incompatible color space: %s != %s\n",
			color_space_name(scs),
			color_space_name(dcs));
		return B_BAD_TYPE;
	}
	
	// debugger("CopyPixelsIn()");

	BRect sr = bitmap->Bounds();
	BRect dr = m_bitmap->Bounds();

	sr = sr & dr.OffsetBySelf(location);
	dr = sr.OffsetByCopy(-location.x, -location.y); 
	
	uint8 *ps = (uint8 *) bitmap->Bits();
	uint8 *pd = (uint8 *) m_bitmap->Bits();
	uint32 *s, *d;
	uint32 y;
	for (y = (uint32) sr.top; y <= (uint32) sr.bottom; y++) {
		s = (uint32 *) (ps + y * bitmap->BytesPerRow());
		s += (uint32) sr.left;
		
		d = (uint32 *) (pd + (y + (uint32) (dr.top - sr.top)) * m_bitmap->BytesPerRow());
		d += (uint32) dr.left;
		
		memcpy(d, s, dr.IntegerWidth() * 4);
	}
	return B_OK;
}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:35,代码来源:GLView.cpp

示例2:

status_t
IntelRenderer::CopyPixelsIn(BBitmap *bitmap, BPoint location)
{
	CALLED();

	color_space sourceCS = bitmap->ColorSpace();
	color_space destinationCS = fBitmap->ColorSpace();

	if (sourceCS != destinationCS
		&& (sourceCS != B_RGB32 || destinationCS != B_RGBA32)) {
		ERROR("%s::CopyPixelsIn(): incompatible color space: %s != %s\n",
			__PRETTY_FUNCTION__, color_space_name(sourceCS),
			color_space_name(destinationCS));
		return B_BAD_TYPE;
	}

	BRect sr = bitmap->Bounds();
	BRect dr = fBitmap->Bounds();

	sr = sr & dr.OffsetBySelf(location);
	dr = sr.OffsetByCopy(-location.x, -location.y);

	uint8 *ps = (uint8 *) bitmap->Bits();
	uint8 *pd = (uint8 *) fBitmap->Bits();
	uint32 *s, *d;
	uint32 y;

	for (y = (uint32) sr.top; y <= (uint32) sr.bottom; y++) {
		s = (uint32 *)(ps + y * bitmap->BytesPerRow());
		s += (uint32) sr.left;

		d = (uint32 *)(pd + (y + (uint32)(dr.top - sr.top))
			* fBitmap->BytesPerRow());
		d += (uint32) dr.left;

		memcpy(d, s, dr.IntegerWidth() * 4);
	}

	return B_OK;
}
开发者ID:kallisti5,项目名称:mesa_intel,代码行数:40,代码来源:IntelRenderer.cpp

示例3:

status_t
SoftwareRenderer::CopyPixelsOut(BPoint location, BBitmap *bitmap)
{
	CALLED();
	color_space scs = fBitmap->ColorSpace();
	color_space dcs = bitmap->ColorSpace();

	if (scs != dcs && (scs != B_RGBA32 || dcs != B_RGB32)) {
		ERROR("%s::CopyPixelsOut(): incompatible color space: %s != %s\n",
			__PRETTY_FUNCTION__, color_space_name(scs), color_space_name(dcs));
		return B_BAD_TYPE;
	}

	BRect sr = fBitmap->Bounds();
	BRect dr = bitmap->Bounds();

//	int32 w1 = sr.IntegerWidth();
//	int32 h1 = sr.IntegerHeight();
//	int32 w2 = dr.IntegerWidth();
//	int32 h2 = dr.IntegerHeight();

	sr = sr & dr.OffsetBySelf(location);
	dr = sr.OffsetByCopy(-location.x, -location.y);

	uint8 *ps = (uint8 *) fBitmap->Bits();
	uint8 *pd = (uint8 *) bitmap->Bits();
	uint32 *s, *d;
	uint32 y;
	for (y = (uint32) sr.top; y <= (uint32) sr.bottom; y++) {
		s = (uint32 *)(ps + y * fBitmap->BytesPerRow());
		s += (uint32) sr.left;

		d = (uint32 *)(pd + (y + (uint32)(dr.top - sr.top))
			* bitmap->BytesPerRow());
		d += (uint32) dr.left;
		memcpy(d, s, dr.IntegerWidth() * 4);
	}

	return B_OK;
}
开发者ID:DirectFB,项目名称:mesa,代码行数:40,代码来源:SoftwareRenderer.cpp

示例4: reply


//.........这里部分代码省略.........
					continue;

				Invalidate(&region);
				continue;
			}

			case RP_FILL_REGION_COLOR_NO_CLIPPING:
			{
				BRegion region;
				rgb_color color;

				message.ReadRegion(region);
				if (message.Read(color) != B_OK)
					continue;

				fOffscreen->LockLooper();
				fOffscreen->SetHighColor(color);
				fOffscreen->FillRegion(&region);
				fOffscreen->UnlockLooper();
				Invalidate(&region);
				continue;
			}

			case RP_COPY_RECT_NO_CLIPPING:
			{
				int32 xOffset, yOffset;
				BRect rect;

				message.Read(xOffset);
				message.Read(yOffset);
				if (message.Read(rect) != B_OK)
					continue;

				BRect dest = rect.OffsetByCopy(xOffset, yOffset);
				fOffscreen->LockLooper();
				fOffscreen->CopyBits(rect, dest);
				fOffscreen->UnlockLooper();
				continue;
			}
		}

		uint32 token;
		message.Read(token);

		engine_state *state = _FindState(token);
		if (state == NULL) {
			TRACE_ERROR("didn't find state for token %lu\n", token);
			continue;
		}

		BView *offscreen = state->view;
		::pattern &pattern = state->pattern;
		BRegion &clippingRegion = state->clipping_region;
		float &penSize = state->pen_size;
		bool &syncDrawing = state->sync_drawing;
		BRegion invalidRegion;

		BAutolock offscreenLocker(offscreen->Looper());
		if (!offscreenLocker.IsLocked())
			break;

		switch (code) {
			case RP_ENABLE_SYNC_DRAWING:
				syncDrawing = true;
				continue;
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:66,代码来源:RemoteView.cpp

示例5: OpenWindow

void
DiskProbe::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kMsgOpenOpenWindow:
			if (fOpenWindow == NULL) {
				fOpenWindow = new OpenWindow();
				fOpenWindow->Show();
				fWindowCount++;
			} else
				fOpenWindow->Activate(true);
			break;

		case kMsgOpenWindowClosed:
			fOpenWindow = NULL;
			// supposed to fall through
		case kMsgWindowClosed:
			if (--fWindowCount == 0 && !fFilePanel->IsShowing())
				PostMessage(B_QUIT_REQUESTED);
			break;

		case kMsgSettingsChanged:
			fSettings.UpdateFrom(message);
			break;

		case kMsgFindWindowClosed:
			fFindWindow = NULL;
			break;
		case kMsgFindTarget:
		{
			BMessenger target;
			if (message->FindMessenger("target", &target) != B_OK)
				break;

			if (fFindWindow != NULL && fFindWindow->Lock()) {
				fFindWindow->SetTarget(target);
				fFindWindow->Unlock();
			}
			break;
		}
		case kMsgOpenFindWindow:
		{
			BMessenger target;
			if (message->FindMessenger("target", &target) != B_OK)
				break;

			if (fFindWindow == NULL) {
				// open it!
				fFindWindow = new FindWindow(fWindowFrame.OffsetByCopy(80, 80),
					*message, target, &fSettings.Message());
				fFindWindow->Show();
			} else
				fFindWindow->Activate();
			break;
		}

		case kMsgOpenFilePanel:
			fFilePanel->Show();
			break;
		case B_CANCEL:
			if (fWindowCount == 0)
				PostMessage(B_QUIT_REQUESTED);
			break;

		default:
			BApplication::MessageReceived(message);
			break;
	}
}
开发者ID:looncraz,项目名称:haiku,代码行数:69,代码来源:DiskProbe.cpp

示例6: msgr


//.........这里部分代码省略.........
	fIncludeList = new IncludeList(r,fProject->GetPath().GetFolder());
	BScrollView *scrollView = new BScrollView("scrollview",fIncludeList,
											B_FOLLOW_ALL,0, true, true);
	scrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fGeneralView->AddChild(scrollView);
	
	float width = 0.0;
	for (int32 i = 0; i < fProject->CountLocalIncludes(); i++)
	{
		BStringItem *item = new BStringItem(fProject->LocalIncludeAt(i).Relative().String());
		float strwidth = fIncludeList->StringWidth(item->Text());
		width = MAX(width, strwidth);
		fIncludeList->AddItem(item);
	}
	
	if (width > fIncludeList->Bounds().Width())
	{
		BScrollBar *hbar = scrollView->ScrollBar(B_HORIZONTAL);
		hbar->SetRange(0.0, width - fIncludeList->Bounds().Width());
	}
	
	SetToolTip(fIncludeList,TR("The folders you want Paladin to search for header files"));
	
	fGeneralView->AddChild(add);
	
	BButton *remove = new BButton(BRect(0,0,1,1),"removebutton",TR("Remove"),
								new BMessage(M_REMOVE_PATH), 
								B_FOLLOW_LEFT | B_FOLLOW_BOTTOM);
	remove->ResizeToPreferred();
	remove->MoveTo(add->Frame().right + 10.0, add->Frame().top);
	fGeneralView->AddChild(remove);
	
	r = bounds;
	fBuildView = new BView(bounds.OffsetByCopy(5,5),TR("Build"),B_FOLLOW_ALL,B_WILL_DRAW);
	fBuildView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fTabView->AddTab(fBuildView);
	
	menu = new BMenu(TR("Optimization"));
	menu->AddItem(new BMenuItem(TR("None"),new BMessage(M_SET_OP_VALUE)));
	menu->AddItem(new BMenuItem(TR("Some"),new BMessage(M_SET_OP_VALUE)));
	menu->AddItem(new BMenuItem(TR("More"),new BMessage(M_SET_OP_VALUE)));
	menu->AddItem(new BMenuItem(TR("Full"),new BMessage(M_SET_OP_VALUE)));
	
	r.right = (bounds.right - 5.0) / 2.0;
	r.bottom = r.top + 25;
	fOpField = new BMenuField(r,"optimize",TR("Optimize"),menu);
	fBuildView->AddChild(fOpField);
	fOpField->SetDivider(fOpField->StringWidth(TR("Optimize")) + 5.0);
	
	SetToolTip(fOpField,TR("Compiler optimization level. Disabled when debugging info is checked."));
	
	menu->SetTargetForItems(this);
	menu->SetLabelFromMarked(true);
	
	item = menu->ItemAt(fProject->OpLevel());
	if (item)
		item->SetMarked(true);
	
	r.right = bounds.right - 10.0;
	r.OffsetTo(5, fOpField->Frame().bottom + 5);
	fOpSizeBox = new BCheckBox(r,"opsizebox",TR("Optimize for size over speed"),
								new BMessage(M_TOGGLE_OPSIZE));
	fOpSizeBox->ResizeToPreferred();
	fBuildView->AddChild(fOpSizeBox);
	r = fOpSizeBox->Frame();
	if (fProject->OpForSize())
开发者ID:passick,项目名称:Paladin,代码行数:67,代码来源:ProjectSettingsWindow.cpp


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