本文整理汇总了C++中nux::GraphicsEngine::QRP_Color方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsEngine::QRP_Color方法的具体用法?C++ GraphicsEngine::QRP_Color怎么用?C++ GraphicsEngine::QRP_Color使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nux::GraphicsEngine
的用法示例。
在下文中一共展示了GraphicsEngine::QRP_Color方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void HudButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
if (skip_draw_)
return;
nux::Geometry const& geo = GetGeometry();
GfxContext.PushClippingRectangle(geo);
gPainter.PaintBackground(GfxContext, geo);
// set up our texture mode
nux::TexCoordXForm texxform;
texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP);
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
// clear what is behind us
unsigned int alpha = 0, src = 0, dest = 0;
GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
GfxContext.GetRenderStates().SetPremultipliedBlend(nux::SRC_OVER);
GfxContext.GetRenderStates().SetBlend(true);
nux::Color col(nux::color::Black);
col.alpha = 0;
GfxContext.QRP_Color(geo.x,
geo.y,
geo.width,
geo.height,
col);
nux::BaseTexture* texture = normal_->GetTexture();
if (HasKeyFocus() || fake_focused())
texture = active_->GetTexture();
else if (HasKeyFocus())
texture = prelight_->GetTexture();
else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
texture = active_->GetTexture();
GfxContext.QRP_1Tex(geo.x,
geo.y,
texture->GetWidth(),
texture->GetHeight(),
texture->GetDeviceTexture(),
texxform,
nux::color::White);
GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
GfxContext.PopClippingRectangle();
}
示例2: Draw
void RatingsButton::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
int rating = static_cast<int>(GetRating() * NUM_STARS);
// FIXME: 9/26/2011
// We should probably support an API for saying whether the ratings
// should or shouldn't support half stars...but our only consumer at
// the moment is the applications scope which according to design
// (Bug #839759) shouldn't. So for now just force rounding.
// int total_half_stars = rating % 2;
// int total_full_stars = rating / 2;
int total_full_stars = rating;
nux::Geometry const& geo = GetGeometry();
nux::Geometry geo_star(geo);
geo_star.width = star_size_.CP(scale);
geo_star.height = star_size_.CP(scale);
gPainter.PaintBackground(GfxContext, geo);
// set up our texture mode
nux::TexCoordXForm texxform;
texxform.SetWrap(nux::TEXWRAP_CLAMP_TO_BORDER, nux::TEXWRAP_CLAMP_TO_BORDER);
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_SCALE_COORD);
texxform.SetFilter(nux::TEXFILTER_LINEAR, nux::TEXFILTER_LINEAR);
// clear what is behind us
unsigned int alpha = 0, src = 0, dest = 0;
GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
nux::Color col = nux::color::Black;
col.alpha = 0;
GfxContext.QRP_Color(geo.x,
geo.y,
geo.width,
geo.height,
col);
for (int index = 0; index < NUM_STARS; ++index)
{
dash::Style& style = dash::Style::Instance();
auto texture = style.GetStarSelectedIcon();
if (index < total_full_stars)
{
if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL)
texture = style.GetStarSelectedIcon();
else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
texture = style.GetStarSelectedIcon();
else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
texture = style.GetStarSelectedIcon();
}
else
{
if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_NORMAL)
texture = style.GetStarDeselectedIcon();
else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRELIGHT)
texture = style.GetStarDeselectedIcon();
else if (GetVisualState() == nux::ButtonVisualState::VISUAL_STATE_PRESSED)
texture = style.GetStarDeselectedIcon();
}
GfxContext.QRP_1Tex(geo_star.x,
geo_star.y,
geo_star.width,
geo_star.height,
texture->GetDeviceTexture(),
texxform,
nux::Color(1.0f, 1.0f, 1.0f, 1.0f));
if (focused_star_ == index)
{
GfxContext.QRP_1Tex(geo_star.x,
geo_star.y,
geo_star.width,
geo_star.height,
style.GetStarHighlightIcon()->GetDeviceTexture(),
texxform,
nux::Color(1.0f, 1.0f, 1.0f, 0.5f));
}
geo_star.x += geo_star.width + star_gap_.CP(scale);
}
GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
}