本文整理汇总了C++中BitmapInfo::height方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapInfo::height方法的具体用法?C++ BitmapInfo::height怎么用?C++ BitmapInfo::height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapInfo
的用法示例。
在下文中一共展示了BitmapInfo::height方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adoptArrayPtr
bool SharedBitmap::to16bit()
{
if (m_locked)
return false;
if (is16bit())
return true;
BitmapInfo newBmpInfo = BitmapInfo::create(m_bmpInfo.size(), BitmapInfo::BitCount16);
int width = newBmpInfo.width();
int paddedWidth = newBmpInfo.paddedWidth();
int bufferSize = paddedWidth * newBmpInfo.height();
OwnArrayPtr<unsigned> newPixelData = adoptArrayPtr(new unsigned[bufferSize / 2]);
void* newPixels = newPixelData.get();
if (!newPixels)
return false;
unsigned short* p16 = static_cast<unsigned short*>(newPixels);
const unsigned* p32 = static_cast<const unsigned*>(m_pixels);
bool skips = paddedWidth != width;
const unsigned short* p16end = p16 + bufferSize;
while (p16 < p16end) {
for (unsigned short* p16lineEnd = p16 + width; p16 < p16lineEnd; )
*p16++ = convert32To16(*p32++);
if (skips)
*p16++ = 0;
}
if (m_hbitmap)
m_hbitmap = nullptr;
else
m_pixelData = newPixelData.release();
m_pixels = newPixels;
m_bmpInfo = newBmpInfo;
setHasAlpha(false);
return true;
}