本文整理汇总了C++中TRasterP::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ TRasterP::clear方法的具体用法?C++ TRasterP::clear怎么用?C++ TRasterP::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRasterP
的用法示例。
在下文中一共展示了TRasterP::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRaster
//! Returns for the first not-busy raster
TRasterP RasterPool::getRaster() {
QMutexLocker sl(&m_repositoryLock);
RasterRepository::iterator it = m_rasterRepository.begin();
while (it != m_rasterRepository.end()) {
RasterItem *rasItem = *it;
if (rasItem->m_busy == false) {
TRasterP raster = rasItem->getRaster();
if (!raster) {
delete rasItem;
m_rasterRepository.erase(it++);
continue;
}
rasItem->m_busy = true;
raster->clear();
return raster;
}
++it;
}
RasterItem *rasItem = new RasterItem(m_size, m_bpp, true);
m_rasterRepository.push_back(rasItem);
return rasItem->getRaster();
}
示例2: eraseRect
TRect TRasterImageUtils::eraseRect(const TRasterImageP &ri, const TRectD &area)
{
TRasterP ras = ri->getRaster();
TRect rect = convertWorldToRaster(area, ri) * ras->getBounds();
if (rect.isEmpty())
return rect;
ras->lock();
TRasterP workRas = ras->extract(rect);
if (workRas->getPixelSize() == 4)
workRas->clear();
else {
TRasterGR8P rasGR8(workRas);
if (rasGR8)
rasGR8->fill(TPixelGR8::White);
}
ras->unlock();
return rect;
}
示例3: add
QString ImageBuilder::add(const TImageP &img, const TAffine &aff) {
if (fabs(aff.det()) < 0.001) return "";
if (m_img && (m_img->getType() != img->getType()))
return "Image type mismatch";
if (!m_img && img->getType() != TImage::VECTOR && m_width > 0 &&
m_height > 0) {
TRasterP ras = img->raster()->create(m_width, m_height);
if (img->getType() == TImage::RASTER)
m_img = TRasterImageP(ras);
else if (img->getType() == TImage::TOONZ_RASTER) {
m_img = TToonzImageP(ras, ras->getBounds());
m_img->setPalette(img->getPalette());
} else
return "Bad image type";
}
if (!m_img && aff.isIdentity()) {
m_img = img->cloneImage();
} else if (img->getType() == TImage::VECTOR) {
// vector image
if (!m_img) {
// transform
TVectorImageP vi = img->cloneImage();
vi->transform(aff);
m_img = vi;
} else {
// merge
TVectorImageP up = img;
TVectorImageP dn = m_img;
dn->mergeImage(up, aff);
}
} else {
if (img->getType() != TImage::TOONZ_RASTER &&
img->getType() != TImage::RASTER) {
// this should not ever happen
return "Bad image type";
}
TRasterP up = img->raster();
if (!m_img) {
// create an empty bg
TRasterP ras = up->create();
ras->clear();
if (img->getType() == TImage::TOONZ_RASTER) {
TRasterCM32P rasCm = ras;
m_img = TToonzImageP(rasCm,
TRect(0, 0, ras->getLx() - 1, ras->getLy() - 1));
m_img->setPalette(img->getPalette());
} else {
m_img = TRasterImageP(ras);
}
}
TRasterP dn = m_img->raster();
if (aff.isTranslation() && aff.a13 == floor(aff.a13) &&
aff.a23 == floor(aff.a23)) {
// just a integer coord translation
TPoint delta = -up->getCenter() + dn->getCenter() +
TPoint((int)aff.a13, (int)aff.a23);
TRop::over(dn, up, delta);
} else {
TAffine aff1 = TTranslation(dn->getCenterD()) * aff *
TTranslation(-up->getCenterD());
TRop::over(dn, up, aff1, TRop::Mitchell);
}
}
return "";
}