本文整理汇总了C++中DImg::bits方法的典型用法代码示例。如果您正苦于以下问题:C++ DImg::bits方法的具体用法?C++ DImg::bits怎么用?C++ DImg::bits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DImg
的用法示例。
在下文中一共展示了DImg::bits方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: putData
bool UndoCache::putData(int level, const DImg& img) const
{
QFile file(d->cacheFile(level));
KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(d->cacheDir);
unsigned long fspace = (unsigned long)(info.available()/1024.0/1024.0);
kDebug() << "Free space available in Editor cache [" << d->cacheDir << "] in Mbytes: " << fspace;
if (file.exists() ||
!file.open(QIODevice::WriteOnly) ||
fspace < 1024) // Check if free space is over 1 Gb to put data in cache.
{
return false;
}
QDataStream ds(&file);
ds << img.width();
ds << img.height();
ds << img.sixteenBit();
ds << img.hasAlpha();
QByteArray ba((const char*)img.bits(), img.numBytes());
ds << ba;
file.close();
d->cachedLevels << level;
return true;
}
示例2: putPreviewData
void RainDropTool::putPreviewData()
{
ImageIface* iface = d->previewWidget->imageIface();
DImg imDest = filter()->getTargetImage().smoothScale(iface->previewWidth(), iface->previewHeight());
iface->putPreviewImage(imDest.bits());
d->previewWidget->updatePreview();
}
示例3: putFinalData
void ResizeTool::putFinalData()
{
ImageIface iface(0, 0);
DImg targetImage = filter()->getTargetImage();
iface.putOriginalImage(i18n("Resize"),
filter()->filterAction(),
targetImage.bits(),
targetImage.width(), targetImage.height());
}
示例4: applyBCG
void BCGFilter::applyBCG(DImg& image)
{
if (image.isNull())
{
return;
}
applyBCG(image.bits(), image.width(), image.height(), image.sixteenBit());
}
示例5: 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)));
}
}
}
}
示例6: DImgThreadedFilter
SharpenFilter::SharpenFilter(DImgThreadedFilter* const parentFilter,
const DImg& orgImage, const DImg& destImage,
int progressBegin, int progressEnd, double radius, double sigma)
: DImgThreadedFilter(parentFilter, orgImage, destImage, progressBegin, progressEnd,
parentFilter->filterName() + QLatin1String(": Sharpen"))
{
m_radius = radius;
m_sigma = sigma;
// We need to provide support for orgImage == destImage.
// The algorithm does not support this out of the box, so use a temporary.
if (orgImage.bits() == destImage.bits())
{
m_destImage = DImg(destImage.width(), destImage.height(), destImage.sixteenBit());
}
filterImage();
if (orgImage.bits() == destImage.bits())
{
memcpy(destImage.bits(), m_destImage.bits(), m_destImage.numBytes());
}
}
示例7: setPreview
void ImageIface::setPreview(const DImg& img)
{
if (img.hasAlpha() != previewHasAlpha() ||
img.sixteenBit() != previewSixteenBit()
)
{
kDebug() << "Properties of image differs than preview";
return;
}
uchar* const data = img.bits();
if (!data)
{
kDebug() << "No preview image data to handle";
return;
}
d->targetPreviewImage.detach();
d->targetPreviewImage.putImageData(data);
}
示例8: applyHSL
void HSLFilter::applyHSL(DImg& image)
{
if (image.isNull())
{
return;
}
bool sixteenBit = image.sixteenBit();
uint numberOfPixels = image.numPixels();
int progress;
int hue, sat, lig;
double vib = d->settings.vibrance;
DColor color;
if (sixteenBit) // 16 bits image.
{
unsigned short* data = (unsigned short*) image.bits();
for (uint i=0; runningFlag() && (i<numberOfPixels); ++i)
{
color = DColor(data[2], data[1], data[0], 0, sixteenBit);
// convert RGB to HSL
color.getHSL(&hue, &sat, &lig);
// convert HSL to RGB
color.setHSL(d->htransfer16[hue], vibranceBias(d->stransfer16[sat], hue, vib, sixteenBit), d->ltransfer16[lig], sixteenBit);
data[2] = color.red();
data[1] = color.green();
data[0] = color.blue();
data += 4;
progress = (int)(((double)i * 100.0) / numberOfPixels);
if ( progress%5 == 0 )
{
postProgress( progress );
}
}
}
else // 8 bits image.
{
uchar* data = image.bits();
for (uint i=0; runningFlag() && (i<numberOfPixels); ++i)
{
color = DColor(data[2], data[1], data[0], 0, sixteenBit);
// convert RGB to HSL
color.getHSL(&hue, &sat, &lig);
// convert HSL to RGB
color.setHSL(d->htransfer[hue], vibranceBias(d->stransfer[sat],hue,vib,sixteenBit), d->ltransfer[lig], sixteenBit);
data[2] = color.red();
data[1] = color.green();
data[0] = color.blue();
data += 4;
progress = (int)(((double)i * 100.0) / numberOfPixels);
if ( progress%5 == 0 )
{
postProgress( progress );
}
}
}
}
示例9: getSnapshot
void UndoManager::getSnapshot(int index, DImg* const img) const
{
DImg data = d->undoCache->getData(index);
// Pass ownership of buffer. If data is null, img will be null
img->putImageData(data.width(), data.height(), data.sixteenBit(), data.hasAlpha(), data.bits(), true);
}
示例10: setPostProcessedImage
void RawSettingsBox::setPostProcessedImage(DImg& img)
{
histogramBox()->histogram()->stopHistogramComputation();
histogramBox()->histogram()->updateData(img.bits(), img.width(), img.height(), img.sixteenBit());
}
示例11: setDemosaicedImage
void RawSettingsBox::setDemosaicedImage(DImg& img)
{
d->curveWidget->stopHistogramComputation();
d->curveWidget->updateData(img.bits(), img.width(), img.height(), img.sixteenBit());
}