本文整理汇总了C++中CGUIImage::SetAspectRatio方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIImage::SetAspectRatio方法的具体用法?C++ CGUIImage::SetAspectRatio怎么用?C++ CGUIImage::SetAspectRatio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIImage
的用法示例。
在下文中一共展示了CGUIImage::SetAspectRatio方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateListControlLayouts
//#ifdef PRE_SKIN_VERSION_9_10_COMPATIBILITY
void CGUIListItemLayout::CreateListControlLayouts(float width, float height, bool focused, const CLabelInfo &labelInfo, const CLabelInfo &labelInfo2, const CTextureInfo &texture, const CTextureInfo &textureFocus, float texHeight, float iconWidth, float iconHeight, int nofocusCondition, int focusCondition)
{
m_width = width;
m_height = height;
m_focused = focused;
CGUIImage *tex = new CGUIImage(0, 0, 0, 0, width, texHeight, texture);
tex->SetVisibleCondition(nofocusCondition, false);
m_group.AddControl(tex);
if (focused)
{
CGUIImage *tex = new CGUIImage(0, 0, 0, 0, width, texHeight, textureFocus);
tex->SetVisibleCondition(focusCondition, false);
m_group.AddControl(tex);
}
CGUIImage *image = new CGUIImage(0, 0, 8, 0, iconWidth, texHeight, CTextureInfo(""));
image->SetInfo(CGUIInfoLabel("$INFO[ListItem.Icon]"));
image->SetAspectRatio(CAspectRatio::AR_KEEP);
m_group.AddControl(image);
float x = iconWidth + labelInfo.offsetX + 10;
CGUIListLabel *label = new CGUIListLabel(0, 0, x, labelInfo.offsetY, width - x - 18, height, labelInfo, CGUIInfoLabel("$INFO[ListItem.Label]"), false);
m_group.AddControl(label);
x = labelInfo2.offsetX ? labelInfo2.offsetX : m_width - 16;
label = new CGUIListLabel(0, 0, x, labelInfo2.offsetY, x - iconWidth - 20, height, labelInfo2, CGUIInfoLabel("$INFO[ListItem.Label2]"), false);
m_group.AddControl(label);
}
示例2: CreateListControlLayouts
//#ifdef GUILIB_PYTHON_COMPATIBILITY
void CGUIListItemLayout::CreateListControlLayouts(float width, float height, bool focused, const CLabelInfo &labelInfo, const CLabelInfo &labelInfo2, const CTextureInfo &texture, const CTextureInfo &textureFocus, float texHeight, float iconWidth, float iconHeight, const std::string &nofocusCondition, const std::string &focusCondition)
{
m_width = width;
m_height = height;
m_focused = focused;
m_isPlaying.Parse("listitem.isplaying", 0);
CGUIImage *tex = new CGUIImage(0, 0, 0, 0, width, texHeight, texture);
tex->SetVisibleCondition(nofocusCondition);
m_group.AddControl(tex);
if (focused)
{
CGUIImage *tex = new CGUIImage(0, 0, 0, 0, width, texHeight, textureFocus);
tex->SetVisibleCondition(focusCondition);
m_group.AddControl(tex);
}
CGUIImage *image = new CGUIImage(0, 0, 8, 0, iconWidth, texHeight, CTextureInfo(""));
image->SetInfo(CGUIInfoLabel("$INFO[ListItem.Icon]", "", m_group.GetParentID()));
image->SetAspectRatio(CAspectRatio::AR_KEEP);
m_group.AddControl(image);
float x = iconWidth + labelInfo.offsetX + 10;
CGUIListLabel *label = new CGUIListLabel(0, 0, x, labelInfo.offsetY, width - x - 18, height, labelInfo, CGUIInfoLabel("$INFO[ListItem.Label]", "", m_group.GetParentID()), CGUIControl::FOCUS);
m_group.AddControl(label);
x = labelInfo2.offsetX ? labelInfo2.offsetX : m_width - 16;
label = new CGUIListLabel(0, 0, x, labelInfo2.offsetY, x - iconWidth - 20, height, labelInfo2, CGUIInfoLabel("$INFO[ListItem.Label2]", "", m_group.GetParentID()), CGUIControl::FOCUS);
m_group.AddControl(label);
}
示例3: Show
void CSplash::Show()
{
g_graphicsContext.Lock();
g_graphicsContext.Clear();
g_graphicsContext.Flip();
#ifndef _WIN32
g_graphicsContext.Clear();
g_graphicsContext.Flip();
g_graphicsContext.Clear();
g_graphicsContext.Flip();
#endif
float w = g_graphicsContext.GetWidth();
float h = g_graphicsContext.GetHeight();
if(g_graphicsContext.GetRenderLowresGraphics())
{
RESOLUTION res = g_graphicsContext.GetGraphicsResolution();
w = g_settings.m_ResInfo[res].iWidth;
h = g_settings.m_ResInfo[res].iHeight;
}
CGUIImage* image = new CGUIImage(0, 0, 0, 0, w, h, m_ImageName);
image->SetAspectRatio(CAspectRatio::AR_KEEP);
image->AllocResources();
//render splash image
g_Windowing.BeginRender();
image->Render();
image->FreeResources();
delete image;
//show it on screen
g_Windowing.EndRender();
g_graphicsContext.Flip();
g_graphicsContext.Unlock();
}
示例4: Process
void CSplash::Process()
{
D3DGAMMARAMP newRamp;
D3DGAMMARAMP oldRamp;
g_graphicsContext.Lock();
g_graphicsContext.Get3DDevice()->Clear(0, NULL, D3DCLEAR_TARGET, 0, 0, 0);
g_graphicsContext.SetCameraPosition(CPoint(0, 0));
float w = g_graphicsContext.GetWidth();
float h = g_graphicsContext.GetHeight();
CGUIImage* image = new CGUIImage(0, 0, 0, 0, w, h, m_ImageName);
CGUIImage* image2 = new CGUIImage(0, 0, 0, 0, w, h, m_ImageName2);
image->SetAspectRatio(CAspectRatio::AR_STRETCH);
image2->SetAspectRatio(CAspectRatio::AR_STRETCH);
image->AllocResources();
image2->AllocResources();
// Store the old gamma ramp
g_graphicsContext.Get3DDevice()->GetGammaRamp(&oldRamp);
float fade = 0.5f;
for (int i = 0; i < 256; i++)
{
newRamp.red[i] = (int)((float)oldRamp.red[i] * fade);
newRamp.green[i] = (int)((float)oldRamp.red[i] * fade);
newRamp.blue[i] = (int)((float)oldRamp.red[i] * fade);
}
g_graphicsContext.Get3DDevice()->SetGammaRamp(GAMMA_RAMP_FLAG, &newRamp);
//render splash image
#ifndef HAS_XBOX_D3D
g_graphicsContext.Get3DDevice()->BeginScene();
#endif
image->Render();
image2->Render();
image->FreeResources();
image2->FreeResources();
delete image;
delete image2;
//show it on screen
#ifdef HAS_XBOX_D3D
g_graphicsContext.Get3DDevice()->BlockUntilVerticalBlank();
#else
g_graphicsContext.Get3DDevice()->EndScene();
#endif
g_graphicsContext.Get3DDevice()->Present( NULL, NULL, NULL, NULL );
g_graphicsContext.Unlock();
//fade in and wait untill the thread is stopped
while (!m_bStop)
{
if (fade <= 1.f)
{
for (int i = 0; i < 256; i++)
{
newRamp.red[i] = (int)((float)oldRamp.red[i] * fade);
newRamp.green[i] = (int)((float)oldRamp.green[i] * fade);
newRamp.blue[i] = (int)((float)oldRamp.blue[i] * fade);
}
g_graphicsContext.Lock();
Sleep(3);
g_graphicsContext.Get3DDevice()->SetGammaRamp(GAMMA_RAMP_FLAG, &newRamp);
g_graphicsContext.Unlock();
fade += 0.01f;
}
else
{
Sleep(10);
}
}
g_graphicsContext.Lock();
// fade out
for (float fadeout = fade - 0.01f; fadeout >= 0.f; fadeout -= 0.01f)
{
for (int i = 0; i < 256; i++)
{
newRamp.red[i] = (int)((float)oldRamp.red[i] * fadeout);
newRamp.green[i] = (int)((float)oldRamp.green[i] * fadeout);
newRamp.blue[i] = (int)((float)oldRamp.blue[i] * fadeout);
}
Sleep(3);
g_graphicsContext.Get3DDevice()->SetGammaRamp(GAMMA_RAMP_FLAG, &newRamp);
}
//restore original gamma ramp
g_graphicsContext.Get3DDevice()->Clear(0, NULL, D3DCLEAR_TARGET, 0, 0, 0);
g_graphicsContext.Get3DDevice()->SetGammaRamp(0, &oldRamp);
g_graphicsContext.Get3DDevice()->Present( NULL, NULL, NULL, NULL );
g_graphicsContext.Unlock();
}