本文整理汇总了C++中CTexture::LoadFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ CTexture::LoadFromFile方法的具体用法?C++ CTexture::LoadFromFile怎么用?C++ CTexture::LoadFromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTexture
的用法示例。
在下文中一共展示了CTexture::LoadFromFile方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool CWinSystemX11::CreateNewWindow(const CStdString& name, bool fullScreen, RESOLUTION_INFO& res, PHANDLE_EVENT_FUNC userFunction)
{
RESOLUTION_INFO& desktop = g_settings.m_ResInfo[RES_DESKTOP];
if (fullScreen &&
(res.iWidth != desktop.iWidth || res.iHeight != desktop.iHeight ||
res.fRefreshRate != desktop.fRefreshRate || res.iScreen != desktop.iScreen))
{
//on the first call to SDL_SetVideoMode, SDL stores the current displaymode
//SDL restores the displaymode on SDL_QUIT(), if we change the displaymode
//before the first call to SDL_SetVideoMode, SDL changes the displaymode back
//to the wrong mode on exit
CLog::Log(LOGINFO, "CWinSystemX11::CreateNewWindow initializing to desktop resolution first");
if (!SetFullScreen(true, desktop, false))
return false;
}
if(!SetFullScreen(fullScreen, res, false))
return false;
CTexture iconTexture;
iconTexture.LoadFromFile("special://xbmc/media/icon.png");
SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom(iconTexture.GetPixels(), iconTexture.GetWidth(), iconTexture.GetHeight(), 32, iconTexture.GetPitch(), 0xff0000, 0x00ff00, 0x0000ff, 0xff000000L), NULL);
SDL_WM_SetCaption("XBMC Media Center", NULL);
m_bWindowCreated = true;
return true;
}
示例2: url
CBaseTexture *CBaseTexture::LoadFromFile(const CStdString& texturePath, unsigned int idealWidth, unsigned int idealHeight, bool autoRotate)
{
#if defined(TARGET_ANDROID)
CURL url(texturePath);
if (url.GetProtocol() == "androidapp")
{
XFILE::CFileAndroidApp file;
if (file.Open(url))
{
unsigned int imgsize = (unsigned int)file.GetLength();
unsigned char* inputBuff = new unsigned char[imgsize];
unsigned int inputBuffSize = file.Read(inputBuff, imgsize);
file.Close();
if (inputBuffSize != imgsize)
{
delete [] inputBuff;
return NULL;
}
CTexture *texture = new CTexture();
unsigned int width = file.GetIconWidth();
unsigned int height = file.GetIconHeight();
texture->LoadFromMemory(width, height, width*4, XB_FMT_RGBA8, true, inputBuff);
delete [] inputBuff;
return texture;
}
}
#endif
CTexture *texture = new CTexture();
if (texture->LoadFromFile(texturePath, idealWidth, idealHeight, autoRotate, NULL, NULL))
return texture;
delete texture;
return NULL;
}
示例3: CTexture
CBaseTexture *CBaseTexture::LoadFromFile(const CStdString& texturePath, unsigned int idealWidth, unsigned int idealHeight, bool autoRotate)
{
CTexture *texture = new CTexture();
if (texture->LoadFromFile(texturePath, idealWidth, idealHeight, autoRotate, NULL, NULL))
return texture;
delete texture;
return NULL;
}
示例4: DoWork
bool CTextureDDSJob::DoWork()
{
CTexture texture;
if (URIUtils::GetExtension(m_original).Equals(".dds"))
return false;
if (texture.LoadFromFile(m_original))
{ // convert to DDS
CDDSImage dds;
CLog::Log(LOGDEBUG, "Creating DDS version of: %s", m_original.c_str());
return dds.Create(URIUtils::ReplaceExtension(m_original, ".dds"), texture.GetWidth(), texture.GetHeight(), texture.GetPitch(), texture.GetPixels(), 40);
}
return false;
}
示例5: CreateNewWindow
bool CWinSystemEGL::CreateNewWindow(const CStdString& name, bool fullScreen, RESOLUTION_INFO& res, PHANDLE_EVENT_FUNC userFunction)
{
if(!SetFullScreen(fullScreen, res, false))
return false;
CTexture iconTexture;
iconTexture.LoadFromFile("special://xbmc/media/icon.png");
SDL_WM_SetIcon(SDL_CreateRGBSurfaceFrom(iconTexture.GetPixels(), iconTexture.GetWidth(), iconTexture.GetHeight(), BPP, iconTexture.GetPitch(), 0xff0000, 0x00ff00, 0x0000ff, 0xff000000L), NULL);
SDL_WM_SetCaption("XBMC Media Center", NULL);
m_bWindowCreated = true;
m_eglext = " ";
m_eglext += eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
m_eglext += " ";
CLog::Log(LOGDEBUG, "EGL_EXTENSIONS:%s", m_eglext.c_str());
return true;
}
示例6: file
CBaseTexture *CTextureCacheJob::LoadImage(const CStdString &image, unsigned int width, unsigned int height, bool flipped)
{
// Validate file URL to see if it is an image
CFileItem file(image, false);
if (!(file.IsPicture() && !(file.IsZIP() || file.IsRAR() || file.IsCBR() || file.IsCBZ() ))
&& !file.GetMimeType().Left(6).Equals("image/")) // ignore non-pictures
return NULL;
CTexture *texture = new CTexture();
if (!texture->LoadFromFile(image, width, height, g_guiSettings.GetBool("pictures.useexifrotation")))
{
delete texture;
return NULL;
}
// EXIF bits are interpreted as: <flipXY><flipY*flipX><flipX>
// where to undo the operation we apply them in reverse order <flipX>*<flipY*flipX>*<flipXY>
// When flipped = true we have an additional <flipX> on the left, which is equivalent to toggling the last bit
if (flipped)
texture->SetOrientation(texture->GetOrientation() ^ 1);
return texture;
}