本文整理汇总了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;
}
}