本文整理汇总了C++中ImageManager::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageManager::remove方法的具体用法?C++ ImageManager::remove怎么用?C++ ImageManager::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageManager
的用法示例。
在下文中一共展示了ImageManager::remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
fcn::Image* GuiImageLoader::load(const std::string& filename, bool convertToDisplayFormat) {
ImageManager* imgManager = ImageManager::instance();
if(imgManager->exists(filename)) {
return new GuiImage(imgManager->get(filename));
}
// load demanded image
ImagePtr tmpimg = imgManager->load(filename);
if(tmpimg->getWidth() >= ATLAS_SIZE || tmpimg->getHeight() >= ATLAS_SIZE) {
return new GuiImage(tmpimg);
}
// look for a place for an image of given size
AtlasBlock* block = m_atlasbook->getBlock(tmpimg->getWidth(), tmpimg->getHeight());
// if it can't fit, we need to add new 'page'
if(block->page >= m_atlases.size()) {
m_atlases.push_back(imgManager->loadBlank(ATLAS_SIZE, ATLAS_SIZE));
// because we gonna update texture on-the fly (via TexSubImage)
// we cant really use compressed texture
RenderBackend* rb = RenderBackend::instance();
bool prev = rb->isImageCompressingEnabled();
rb->setImageCompressingEnabled(false);
m_atlases[block->page]->forceLoadInternal();
rb->setImageCompressingEnabled(prev);
}
// update atlas page with given image
m_atlases[block->page]->copySubimage(block->left, block->top, tmpimg);
// we dont really need this image anymore
tmpimg->free();
imgManager->remove(tmpimg);
// create shared image and return it
ImagePtr img = imgManager->create(filename);
Rect region(block->left, block->top, block->getWidth(), block->getHeight());
img->useSharedImage(m_atlases[block->page], region);
return new GuiImage(img);
}