本文整理汇总了C++中Pixmap::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Pixmap::get方法的具体用法?C++ Pixmap::get怎么用?C++ Pixmap::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pixmap
的用法示例。
在下文中一共展示了Pixmap::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyIFS
void CompressedPixmap::applyIFS(Pixmap& pixmap, float ratio)
{
std::vector<Pixmap*> domainRegions;
for (unsigned int i = 0; i < m_domainRegions.size(); ++i)
domainRegions.push_back(pixmap.extract((int)(m_domainRegions[i].x * ratio), (int)(m_domainRegions[i].y * ratio), (int)(m_domainRegions[i].size * ratio)));
//We store each transformation
std::map<unsigned short, std::map<unsigned char, Pixmap*>> transformations;
for (const RangeRegionDescriptor& rangeRegion : m_rangeRegions)
{
int newSize = (int)(rangeRegion.size * ratio);
int newX = (int)(rangeRegion.x * ratio);
int newY = (int)(rangeRegion.y * ratio);
Pixmap* domainInUse;
//If this domainRegion has not been used already
if (!transformations.count(rangeRegion.domainRegionIndex))
{
domainInUse = domainRegions[rangeRegion.domainRegionIndex]->downscale(newSize);
transformations[rangeRegion.domainRegionIndex][0] = domainInUse;
}
else
domainInUse = transformations[rangeRegion.domainRegionIndex][0];
//If it is a true transformation
if (rangeRegion.transformation != NO_ROTATION)
{
//If it hasn't already been done
if (!transformations[rangeRegion.domainRegionIndex].count(rangeRegion.transformation))
{
domainInUse = domainInUse->applyTransformation(rangeRegion.transformation);
transformations[rangeRegion.domainRegionIndex][rangeRegion.transformation] = domainInUse;
}
else
domainInUse = transformations[rangeRegion.domainRegionIndex][rangeRegion.transformation];
}
//Then copy to range region
for (int x = 0; x < newSize; ++x)
{
for (int y = 0; y < newSize; ++y)
{
pixmap.set(newX + x, newY + y, domainInUse->get(x, y));
}
}
//Set first pixel value
if (rangeRegion.x % 4 == 0 && rangeRegion.y % 4 == 0)
pixmap.set(newX, newY, rangeRegion.firstPixelValue);
}
std::cout << transformations.size() * 100 / domainRegions.size() << std::endl;
for (const Pixmap* domainRegion : domainRegions)
delete domainRegion;
for (const std::pair<unsigned short, std::map<unsigned char, Pixmap*>>& transformedDomain : transformations)
{
for (const std::pair<unsigned char, Pixmap*>& transformationResult : transformedDomain.second)
delete transformationResult.second;
}
}