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


C++ BBitmap::ImportBits方法代码示例

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


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

示例1: BBitmap

status_t
BitmapHWInterface::Initialize()
{
	status_t ret = HWInterface::Initialize();
	if (ret < B_OK)
		return ret;

	ret = fFrontBuffer->InitCheck();
	if (ret < B_OK)
		return ret;

// TODO: Remove once unnecessary...
	// fall back to double buffered mode until Painter knows how
	// to draw onto non 32-bit surfaces...
	if (fFrontBuffer->ColorSpace() != B_RGB32
		&& fFrontBuffer->ColorSpace() != B_RGBA32) {
		BBitmap* backBitmap = new BBitmap(fFrontBuffer->Bounds(),
			B_BITMAP_NO_SERVER_LINK, B_RGBA32);
		fBackBuffer = new BBitmapBuffer(backBitmap);

		ret = fBackBuffer->InitCheck();
		if (ret < B_OK) {
			delete fBackBuffer;
			fBackBuffer = NULL;
		} else {
			// import the current contents of the bitmap
			// into the back bitmap
			backBitmap->ImportBits(fFrontBuffer->Bits(),
				fFrontBuffer->BitsLength(), fFrontBuffer->BytesPerRow(), 0,
				fFrontBuffer->ColorSpace());
		}
	}

	return ret;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:35,代码来源:BitmapHWInterface.cpp

示例2:

void
copy_bitmap_bits(const Bitmap *bitmap, void *data, int32 length)
{
	BBitmap *bb = (BBitmap*)bitmap;
	if (bb) {
		color_space cs = bb->ColorSpace();
		bb->ImportBits(data, bb->BitsLength(), bb->BytesPerRow(), 0, cs);
	}
}
开发者ID:aljen,项目名称:haiku-opengl,代码行数:9,代码来源:hsp_bitmap_wrapper.cpp

示例3: frame

BBitmap*
Utility::MakeScreenshot(bool includeMouse, bool activeWindow,
	bool includeBorder) const
{
	if (wholeScreen == NULL)
		return NULL;

	BRect bounds = cursorBitmap->Bounds();
	int cursorWidth = bounds.IntegerWidth() + 1;
	int cursorHeight = bounds.IntegerHeight() + 1;

	if (includeMouse && cursorBitmap != NULL) {
		// Import the cursor bitmap into wholeScreen
		wholeScreen->ImportBits(cursorBitmap->Bits(),
			cursorBitmap->BitsLength(), cursorBitmap->BytesPerRow(),
			cursorBitmap->ColorSpace(), BPoint(0, 0), cursorPosition,
			cursorWidth, cursorHeight);

	} else if (cursorAreaBitmap != NULL) {
		// Import the cursor area bitmap into wholeScreen
		wholeScreen->ImportBits(cursorAreaBitmap->Bits(),
			cursorAreaBitmap->BitsLength(), cursorAreaBitmap->BytesPerRow(),
			cursorAreaBitmap->ColorSpace(), BPoint(0, 0), cursorPosition,
			cursorWidth, cursorHeight);
	}

	BBitmap* screenshot = NULL;

	if (activeWindow && activeWindowFrame.IsValid()) {

		BRect frame(activeWindowFrame);	
		if (includeBorder) {
			frame.InsetBy(-borderSize, -borderSize);
			frame.top -= tabFrame.bottom - tabFrame.top;
		}

		screenshot = new BBitmap(frame.OffsetToCopy(B_ORIGIN), B_RGBA32, true);

		if (screenshot->ImportBits(wholeScreen->Bits(),
			wholeScreen->BitsLength(), wholeScreen->BytesPerRow(),
			wholeScreen->ColorSpace(), frame.LeftTop(),
			BPoint(0, 0), frame.IntegerWidth() + 1,
			frame.IntegerHeight() + 1) != B_OK) {
			delete screenshot;
			return NULL;
		}

		if (includeBorder)
			_MakeTabSpaceTransparent(screenshot, frame);
	} else
		screenshot = new BBitmap(wholeScreen);

	return screenshot;
}
开发者ID:mariuz,项目名称:haiku,代码行数:54,代码来源:Utility.cpp


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