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


C++ rectangle::getHeight方法代码示例

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


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

示例1: createImage

//! Creates a software image from part of a texture.
IImage* CNullDriver::createImage(ITexture* texture, const position2d<s32>& pos, const dimension2d<u32>& size)
{
	if ((pos==position2di(0,0)) && (size == texture->getSize()))
	{
		IImage* image = new CImage(texture->getColorFormat(), size, texture->lock(ETLM_READ_ONLY), false);
		texture->unlock();
		return image;
	}
	else
	{
		// make sure to avoid buffer overruns
		// make the vector a separate variable for g++ 3.x
		const vector2d<u32> leftUpper(clamp(static_cast<u32>(pos.X), 0u, texture->getSize().Width),
					clamp(static_cast<u32>(pos.Y), 0u, texture->getSize().Height));
		const rectangle<u32> clamped(leftUpper,
					dimension2du(clamp(static_cast<u32>(size.Width), 0u, texture->getSize().Width),
					clamp(static_cast<u32>(size.Height), 0u, texture->getSize().Height)));
		if (!clamped.isValid())
			return 0;
		u8* src = static_cast<u8*>(texture->lock(ETLM_READ_ONLY));
		if (!src)
			return 0;
		IImage* image = new CImage(texture->getColorFormat(), clamped.getSize());
		u8* dst = static_cast<u8*>(image->lock());
		src += clamped.UpperLeftCorner.Y * texture->getPitch() + image->getBytesPerPixel() * clamped.UpperLeftCorner.X;
		for (u32 i=0; i<clamped.getHeight(); ++i)
		{
			CColorConverter::convert_viaFormat(src, texture->getColorFormat(), clamped.getWidth(), dst, image->getColorFormat());
			src += texture->getPitch();
			dst += image->getPitch();
		}
		image->unlock();
		texture->unlock();
		return image;
	}
}
开发者ID:ChangerR,项目名称:dream,代码行数:37,代码来源:CNullDriver.cpp


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