本文整理汇总了C++中TRasterP::getCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ TRasterP::getCenter方法的具体用法?C++ TRasterP::getCenter怎么用?C++ TRasterP::getCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRasterP
的用法示例。
在下文中一共展示了TRasterP::getCenter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 "";
}