本文整理汇总了C++中CBaseTexture::HasAlpha方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseTexture::HasAlpha方法的具体用法?C++ CBaseTexture::HasAlpha怎么用?C++ CBaseTexture::HasAlpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseTexture
的用法示例。
在下文中一共展示了CBaseTexture::HasAlpha方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CacheTexture
bool CTextureCacheJob::CacheTexture(CBaseTexture **out_texture)
{
// unwrap the URL as required
std::string additional_info;
unsigned int width, height;
CPictureScalingAlgorithm::Algorithm scalingAlgorithm;
std::string image = DecodeImageURL(m_url, width, height, scalingAlgorithm, additional_info);
m_details.updateable = additional_info != "music" && UpdateableURL(image);
// generate the hash
m_details.hash = GetImageHash(image);
if (m_details.hash.empty())
return false;
else if (m_details.hash == m_oldHash)
return true;
#if defined(HAS_OMXPLAYER)
if (COMXImage::CreateThumb(image, width, height, additional_info, CTextureCache::GetCachedPath(m_cachePath + ".jpg")))
{
m_details.width = width;
m_details.height = height;
m_details.file = m_cachePath + ".jpg";
if (out_texture)
*out_texture = LoadImage(CTextureCache::GetCachedPath(m_details.file), width, height, "" /* already flipped */);
CLog::Log(LOGDEBUG, "Fast %s image '%s' to '%s': %p", m_oldHash.empty() ? "Caching" : "Recaching", CURL::GetRedacted(image).c_str(), m_details.file.c_str(), out_texture);
return true;
}
#endif
CBaseTexture *texture = LoadImage(image, width, height, additional_info, true);
if (texture)
{
if (texture->HasAlpha())
m_details.file = m_cachePath + ".png";
else
m_details.file = m_cachePath + ".jpg";
CLog::Log(LOGDEBUG, "%s image '%s' to '%s':", m_oldHash.empty() ? "Caching" : "Recaching", CURL::GetRedacted(image).c_str(), m_details.file.c_str());
if (CPicture::CacheTexture(texture, width, height, CTextureCache::GetCachedPath(m_details.file), scalingAlgorithm))
{
m_details.width = width;
m_details.height = height;
if (out_texture) // caller wants the texture
*out_texture = texture;
else
delete texture;
return true;
}
}
delete texture;
return false;
}
示例2: CacheTexture
bool CTextureCacheJob::CacheTexture(CBaseTexture **out_texture)
{
// unwrap the URL as required
bool flipped;
unsigned int width, height;
CStdString image = DecodeImageURL(m_url, width, height, flipped);
m_details.updateable = UpdateableURL(image);
// generate the hash
m_details.hash = GetImageHash(image);
if (m_details.hash.empty())
return false;
else if (m_details.hash == m_oldHash)
return true;
CBaseTexture *texture = LoadImage(image, width, height, flipped);
if (texture)
{
if (texture->HasAlpha())
m_details.file = m_cachePath + ".png";
else
m_details.file = m_cachePath + ".jpg";
if (width > 0 && height > 0)
CLog::Log(LOGDEBUG, "%s image '%s' at %dx%d with orientation %d as '%s'", m_oldHash.IsEmpty() ? "Caching" : "Recaching", image.c_str(),
width, height, texture->GetOrientation(), m_details.file.c_str());
else
CLog::Log(LOGDEBUG, "%s image '%s' fullsize with orientation %d as '%s'", m_oldHash.IsEmpty() ? "Caching" : "Recaching", image.c_str(),
texture->GetOrientation(), m_details.file.c_str());
if (CPicture::CacheTexture(texture, width, height, CTextureCache::GetCachedPath(m_details.file)))
{
m_details.width = width;
m_details.height = height;
if (out_texture) // caller wants the texture
*out_texture = texture;
else
delete texture;
return true;
}
}
delete texture;
return false;
}
示例3: CacheTexture
bool CEdenVideoArtUpdater::CacheTexture(std::string &originalUrl, const std::string &cachedFile, const std::string &label, std::string &type)
{
if (!CFile::Exists(cachedFile))
{
CLog::Log(LOGERROR, "%s No cached art for item %s (should be %s)", __FUNCTION__, label.c_str(), cachedFile.c_str());
return false;
}
if (originalUrl.empty())
{
originalUrl = GetThumb(cachedFile, "http://unknown/video/", true);
CLog::Log(LOGERROR, "%s No original url for item %s, but cached art exists, using %s", __FUNCTION__, label.c_str(), originalUrl.c_str());
}
CTextureDetails details;
details.updateable = false;
details.hash = "NOHASH";
type = "thumb"; // unknown art type
CBaseTexture *texture = CTextureCacheJob::LoadImage(cachedFile, 0, 0, "");
if (texture)
{
if (texture->HasAlpha())
details.file = CTextureCache::GetCacheFile(originalUrl) + ".png";
else
details.file = CTextureCache::GetCacheFile(originalUrl) + ".jpg";
CLog::Log(LOGDEBUG, "Caching image '%s' ('%s') to '%s' for item '%s'", originalUrl.c_str(), cachedFile.c_str(), details.file.c_str(), label.c_str());
uint32_t width = 0, height = 0;
if (CPicture::CacheTexture(texture, width, height, CTextureCache::GetCachedPath(details.file)))
{
details.width = width;
details.height = height;
type = CVideoInfoScanner::GetArtTypeFromSize(details.width, details.height);
delete texture;
m_textureDB.AddCachedTexture(originalUrl, details);
return true;
}
}
CLog::Log(LOGERROR, "Can't cache image '%s' ('%s') for item '%s'", originalUrl.c_str(), cachedFile.c_str(), label.c_str());
return false;
}
示例4: CacheTexture
bool CTextureCacheJob::CacheTexture(CBaseTexture **out_texture)
{
// unwrap the URL as required
std::string additional_info;
unsigned int width, height;
CStdString image = DecodeImageURL(m_url, width, height, additional_info);
m_details.updateable = additional_info != "music" && UpdateableURL(image);
// generate the hash
m_details.hash = GetImageHash(image);
if (m_details.hash.empty())
return false;
else if (m_details.hash == m_oldHash)
return true;
CBaseTexture *texture = LoadImage(image, width, height, additional_info);
if (texture)
{
if (texture->HasAlpha())
m_details.file = m_cachePath + ".png";
else
m_details.file = m_cachePath + ".jpg";
CLog::Log(LOGDEBUG, "%s image '%s' to '%s':", m_oldHash.IsEmpty() ? "Caching" : "Recaching", image.c_str(), m_details.file.c_str());
if (CPicture::CacheTexture(texture, width, height, CTextureCache::GetCachedPath(m_details.file)))
{
m_details.width = width;
m_details.height = height;
if (out_texture) // caller wants the texture
*out_texture = texture;
else
delete texture;
return true;
}
}
delete texture;
return false;
}