本文整理汇总了C++中DImg::bytesDepth方法的典型用法代码示例。如果您正苦于以下问题:C++ DImg::bytesDepth方法的具体用法?C++ DImg::bytesDepth怎么用?C++ DImg::bytesDepth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DImg
的用法示例。
在下文中一共展示了DImg::bytesDepth方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transform
void IccTransform::transform(DImg& image, const TransformDescription& description, DImgLoaderObserver* const observer)
{
const int bytesDepth = image.bytesDepth();
const int pixels = image.width() * image.height();
// convert ten scanlines in a batch
const int pixelsPerStep = image.width() * 10;
uchar* data = image.bits();
// see dimgloader.cpp, granularity().
int granularity = 1;
if (observer)
{
granularity = (int)((pixels / (20 * 0.9)) / observer->granularity());
}
int checkPoint = pixels;
// it is safe to use the same input and output buffer if the format is the same
if (description.inputFormat == description.outputFormat)
{
for (int p = pixels; p > 0; p -= pixelsPerStep)
{
int pixelsThisStep = qMin(p, pixelsPerStep);
int size = pixelsThisStep * bytesDepth;
LcmsLock lock;
dkCmsDoTransform(d->handle, data, data, pixelsThisStep);
data += size;
if (observer && p <= checkPoint)
{
checkPoint -= granularity;
observer->progressInfo(&image, 0.1 + 0.9 * (1.0 - float(p) / float(pixels)));
}
}
}
else
{
QVarLengthArray<uchar> buffer(pixelsPerStep * bytesDepth);
for (int p = pixels; p > 0; p -= pixelsPerStep)
{
int pixelsThisStep = qMin(p, pixelsPerStep);
int size = pixelsThisStep * bytesDepth;
LcmsLock lock;
memcpy(buffer.data(), data, size);
dkCmsDoTransform(d->handle, buffer.data(), data, pixelsThisStep);
data += size;
if (observer && p <= checkPoint)
{
checkPoint -= granularity;
observer->progressInfo(&image, 0.1 + 0.9 * (1.0 - float(p) / float(pixels)));
}
}
}
}