本文整理汇总了C++中ImageLoader::load方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLoader::load方法的具体用法?C++ ImageLoader::load怎么用?C++ ImageLoader::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLoader
的用法示例。
在下文中一共展示了ImageLoader::load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readEffectData
void OverlayEffect::readEffectData() {
if (workOverlay!="") {
if (workOverlay!=readOverlay) {
img.load(workOverlay.c_str());
printf("overlay size %dx%d\n", img.width(), img.height());
readOverlay = workOverlay;
}
}
}
示例2: mess
void
Image::load( const std::string &filename )
{
using namespace std;
size_t pos = filename.find_last_of('.');
if ( pos == string::npos ) {
std::string mess("Image::load: Can't load image ");
mess.append(filename);
throw new Exception(mess);
}
const string ext = filename.substr(pos+1);
ImageLoader *imgLoader = ImageLoader::getImageLoader(ext);
imgData = imgLoader->load(filename);
}
示例3: loadMoreImages
void ImageGridDataProvider::loadMoreImages()
{
int count = 0;
int s = this->m_imageFilePaths.size();
qDebug() << "[ImageGridDataProvider::loadMoreImages] m_loadedItems: " << m_loadedItems << ", s: " << s << ", m_loadingCount: " << m_loadingCount;
// Make sure the model never loads more images than it should at the same time or more than it should
if(m_loadingCount == 0 && m_loadedItems < s){
ImageLoader *loader = NULL;
while( count < ImageGridDataProvider::MAX_ITENS && s > (count + m_loadedItems) ){
// don't forget to set the Parent Object or else is memory leak!
loader = new ImageLoader( m_imageFilePaths.at(m_loadedItems + count), this);
bool ok = connect(loader,
SIGNAL(imageChanged()), this,
SLOT(onImageChanged()));
Q_UNUSED(ok);
Q_ASSERT_X(ok,"[ImageGridDataProvider::loadMoreImages]", "connect imageChanged failed");
m_dataModel->append( loader );
loader->load();
// Don't start loading images while ImageLoader instances are created on this while loop or else we have a race condition!
// m_loadedItems is incremented on onImageChanged and it's possible that an image is finished loading before the while is done.
++count;
++m_loadingCount;
Q_ASSERT_X(m_loadingCount <= ImageGridDataProvider::MAX_ITENS,"[ImageGridDataProvider::loadMoreImages]", "loading count max exceed!");
}
// Start loading the images only after the loop is done! This a very simple way of preventing the race condition.
/*for(int i = 0; i < count; i++){
loader = m_dataModel->value(m_loadedItems + i);
loader->load();
}*/
loader = NULL;
}
else{
qDebug() << "[ImageGridDataProvider::loadMoreImages] maximum loading reached! Must wait until all images finish loading or must add new images to load.";
}
}