本文整理汇总了C++中QPixmap::bits方法的典型用法代码示例。如果您正苦于以下问题:C++ QPixmap::bits方法的具体用法?C++ QPixmap::bits怎么用?C++ QPixmap::bits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPixmap
的用法示例。
在下文中一共展示了QPixmap::bits方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clear
void AdobeSurfacePrivate::clear( const QRect & area )
{
#ifndef USE_PIXMAP
int stride = image_.bytesPerLine();
#else
qDebug("AdobeSurfacePrivate::clear %d", image_.qwsBytesPerLine());
int stride = image_.qwsBytesPerLine();
#endif
int bytes_per_pixel = image_.depth() / 8;
if (bytes_per_pixel < 1)
{
bytes_per_pixel = 1;
}
// get the overlap area to prevent out-of-bounding accessing
QRect actual_area = image_.rect().intersect( area );
#ifndef USE_PIXMAP
const uchar * buf = image_.bits();
#else
const uchar * buf = image_.qwsBits();
#endif
unsigned char * data = (uchar*)buf + stride * actual_area.top() +
bytes_per_pixel * actual_area.left();
for ( int y = actual_area.top(); y < actual_area.bottom(); ++y )
{
memset( data, 255, actual_area.width() * bytes_per_pixel );
data = (uchar*)buf + stride * (y + 1) + bytes_per_pixel * actual_area.left();
}
}
示例2: checkOut
unsigned char* AdobeSurfacePrivate::checkOut( int xMin, int yMin, int xMax, int yMax, size_t * stride )
{
#ifndef USE_PIXMAP
*stride = image_.bytesPerLine();
#else
*stride = image_.qwsBytesPerLine();
#endif
int bytes_per_pixel = image_.depth() / 8;
if (bytes_per_pixel < 1)
{
bytes_per_pixel = 1;
}
#ifndef USE_PIXMAP
const uchar * buf = image_.bits();
#else
const uchar * buf = image_.qwsBits();
#endif
return (uchar*)buf + (*stride) * yMin + bytes_per_pixel * xMin;
}