本文整理汇总了C++中nux::GraphicsEngine类的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsEngine类的具体用法?C++ GraphicsEngine怎么用?C++ GraphicsEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GraphicsEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void HSeparator::Draw(nux::GraphicsEngine &GfxContext, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
int y0 = base.y + base.GetHeight() / 2;
unsigned int alpha = 0, src = 0, dest = 0;
GfxContext.GetRenderStates().GetBlend(alpha, src, dest);
nux::GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
if (base.GetWidth() - 2 * border_size_ > 0)
{
nux::Color color0 = color_ * alpha0_;
nux::Color color1 = color_ * alpha1_;
nux::GetPainter().Draw2DLine(GfxContext, base.x, y0, base.x + border_size_, y0, color0, color1);
nux::GetPainter().Draw2DLine(GfxContext, base.x + border_size_, y0, base.x + base.GetWidth() - border_size_, y0, color1, color1);
nux::GetPainter().Draw2DLine(GfxContext, base.x + base.GetWidth() - border_size_, y0, base.x + base.GetWidth(), y0, color1, color0);
}
else
{
nux::Color color1 = color_ * alpha1_;
nux::GetPainter().Draw2DLine(GfxContext, base.x, y0, base.x + base.GetWidth(), y0, color1, color1);
}
GfxContext.GetRenderStates().SetBlend(alpha, src, dest);
}
示例2: DrawContent
void UserPromptView::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& geo = GetGeometry();
graphics_engine.PushClippingRectangle(geo);
if (!IsFullRedraw())
{
bg_layer_.reset(CrateBackgroundLayer(geo.width, geo.height));
nux::GetPainter().PushLayer(graphics_engine, geo, bg_layer_.get());
}
if (caps_lock_on_)
{
for (auto const& text_entry : focus_queue_)
PaintWarningIcon(graphics_engine, text_entry->GetGeometry());
if (focus_queue_.empty())
PaintWarningIcon(graphics_engine, cached_focused_geo_);
}
if (GetLayout())
GetLayout()->ProcessDraw(graphics_engine, force_draw);
if (!IsFullRedraw())
nux::GetPainter().PopBackground();
graphics_engine.PopClippingRectangle();
}
示例3: Draw
void ApplicationPreview::Draw(nux::GraphicsEngine& gfx_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
gfx_engine.PushClippingRectangle(base);
nux::GetPainter().PaintBackground(gfx_engine, base);
gfx_engine.PopClippingRectangle();
}
示例4: DrawContent
void PreviewRatingsWidget::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
gfx_engine.PushClippingRectangle(base);
if (GetCompositionLayout())
GetCompositionLayout()->ProcessDraw(gfx_engine, force_draw);
gfx_engine.PopClippingRectangle();
}
示例5: Draw
void OverlaySpinner::Draw(nux::GraphicsEngine& GfxContext, bool force_draw)
{
nux::Geometry const& geo = GetGeometry();
nux::TexCoordXForm texxform;
GfxContext.PushClippingRectangle(geo);
nux::GetPainter().PaintBackground(GfxContext, geo);
texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD);
texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_REPEAT);
texxform.min_filter = nux::TEXFILTER_LINEAR;
texxform.mag_filter = nux::TEXFILTER_LINEAR;
unsigned int current_alpha_blend;
unsigned int current_src_blend_factor;
unsigned int current_dest_blend_factor;
GfxContext.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
nux::Geometry spin_geo(geo.x + ((geo.width - spin_->GetWidth()) / 2),
geo.y + ((geo.height - spin_->GetHeight()) / 2),
spin_->GetWidth(),
spin_->GetHeight());
// Geometry (== Rect) uses integers which were rounded above,
// hence an extra 0.5 offset for odd sizes is needed
// because pure floating point is not being used.
int spin_offset_w = !(geo.width % 2) ? 0 : 1;
int spin_offset_h = !(geo.height % 2) ? 0 : 1;
nux::Matrix4 matrix_texture;
matrix_texture = nux::Matrix4::TRANSLATE(-spin_geo.x - (spin_geo.width + spin_offset_w) / 2.0f,
-spin_geo.y - (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;
matrix_texture = rotate_ * matrix_texture;
matrix_texture = nux::Matrix4::TRANSLATE(spin_geo.x + (spin_geo.width + spin_offset_w) / 2.0f,
spin_geo.y + (spin_geo.height + spin_offset_h) / 2.0f, 0) * matrix_texture;
GfxContext.SetModelViewMatrix(GfxContext.GetModelViewMatrix() * matrix_texture);
GfxContext.QRP_1Tex(spin_geo.x,
spin_geo.y,
spin_geo.width,
spin_geo.height,
spin_->GetDeviceTexture(),
texxform,
nux::color::White);
// revert to model view matrix stack
GfxContext.ApplyModelViewMatrix();
GfxContext.PopClippingRectangle();
GfxContext.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
if (!frame_timeout_)
{
frame_timeout_.reset(new glib::Timeout(22, sigc::mem_fun(this, &OverlaySpinner::OnFrameTimeout)));
}
}
示例6: DrawContent
void HudButton::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw)
{
if (skip_draw_)
return;
if (IsFullRedraw())
{
GfxContext.PushClippingRectangle(GetGeometry());
hlayout_->ProcessDraw(GfxContext, force_draw);
GfxContext.PopClippingRectangle();
}
}
示例7: Draw
void UserPromptView::Draw(nux::GraphicsEngine& graphics_engine, bool /* force_draw */)
{
nux::Geometry const& geo = GetGeometry();
graphics_engine.PushClippingRectangle(geo);
nux::GetPainter().PaintBackground(graphics_engine, geo);
EnsureBGLayer();
nux::GetPainter().PushDrawLayer(graphics_engine, geo, bg_layer_.get());
nux::GetPainter().PopBackground();
graphics_engine.PopClippingRectangle();
}
示例8: DrawContent
void ApplicationPreview::DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
gfx_engine.PushClippingRectangle(base);
unsigned int alpha, src, dest = 0;
gfx_engine.GetRenderStates().GetBlend(alpha, src, dest);
gfx_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
if (GetCompositionLayout())
GetCompositionLayout()->ProcessDraw(gfx_engine, force_draw);
gfx_engine.GetRenderStates().SetBlend(alpha, src, dest);
gfx_engine.PopClippingRectangle();
}
示例9: DrawContent
virtual void DrawContent(nux::GraphicsEngine& gfx_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
gfx_engine.PushClippingRectangle(base);
if (!IsFullRedraw())
nux::GetPainter().PushLayer(gfx_engine, GetGeometry(), bg_layer_.get());
if (GetCompositionLayout())
GetCompositionLayout()->ProcessDraw(gfx_engine, force_draw);
if (!IsFullRedraw())
nux::GetPainter().PopBackground();
gfx_engine.PopClippingRectangle();
}
示例10: Draw
void PlacesOverlayVScrollBar::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
PlacesVScrollBar::Draw(graphics_engine, force_draw);
if (connector_height_ > 0 && connector_texture_.IsValid())
{
int const connector_width = GetBaseWidth();
int offset_y = 0;
if (thumb_above_slider_)
{
offset_y = _slider->GetBaseY() - connector_height_;
}
else
{
offset_y = _slider->GetBaseY() + _slider->GetBaseHeight();
}
nux::Geometry base(_track->GetBaseX(), offset_y - 4, connector_width, connector_height_ + 5);
nux::TexCoordXForm texxform;
graphics_engine.QRP_1Tex(base.x,
base.y,
base.width,
base.height,
connector_texture_->GetDeviceTexture(),
texxform,
nux::color::White);
}
}
示例11: DrawContent
void FilterBar::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
graphics_engine.PushClippingRectangle(GetGeometry());
if (!IsFullRedraw() && RedirectedAncestor())
{
for (auto iter: filter_map_)
{
FilterExpanderLabel* filter_view = iter.second;
if (filter_view && filter_view->IsVisible() && filter_view->IsRedrawNeeded())
graphics::ClearGeometry(filter_view->GetGeometry());
}
}
GetLayout()->ProcessDraw(graphics_engine, force_draw);
graphics_engine.PopClippingRectangle();
}
示例12: Draw
virtual void Draw(nux::GraphicsEngine& gfx_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
gfx_engine.PushClippingRectangle(base);
nux::GetPainter().PaintBackground(gfx_engine, base);
unsigned int alpha, src, dest = 0;
gfx_engine.GetRenderStates().GetBlend(alpha, src, dest);
gfx_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
bg_layer_->SetGeometry(GetGeometry());
nux::GetPainter().RenderSinglePaintLayer(gfx_engine, GetGeometry(), bg_layer_.get());
gfx_engine.GetRenderStates().SetBlend(alpha, src, dest);
gfx_engine.PopClippingRectangle();
}
示例13: DrawContent
void FilterExpanderLabel::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
graphics_engine.PushClippingRectangle(GetGeometry());
int pushed_paint_layers = 0;
if (!IsFullRedraw())
{
if (RedirectedAncestor())
{
if (cairo_label_->IsRedrawNeeded())
graphics::ClearGeometry(cairo_label_->GetGeometry());
if (expand_icon_->IsRedrawNeeded())
graphics::ClearGeometry(expand_icon_->GetGeometry());
if (right_hand_contents_ && right_hand_contents_->IsRedrawNeeded())
graphics::ClearGeometry(right_hand_contents_->GetGeometry());
if (expanded())
ClearRedirectedRenderChildArea();
}
if (focus_layer_ && ShouldBeHighlighted())
{
++pushed_paint_layers;
nux::GetPainter().PushLayer(graphics_engine, focus_layer_->GetGeometry(), focus_layer_.get());
}
}
else
{
nux::GetPainter().PushPaintLayerStack();
}
GetLayout()->ProcessDraw(graphics_engine, force_draw);
if (IsFullRedraw())
{
nux::GetPainter().PopPaintLayerStack();
}
else if (pushed_paint_layers > 0)
{
nux::GetPainter().PopBackground(pushed_paint_layers);
}
graphics_engine.PopClippingRectangle();
}
示例14: DrawContent
void UserPromptView::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& geo = GetGeometry();
graphics_engine.PushClippingRectangle(geo);
if (!IsFullRedraw())
{
EnsureBGLayer();
nux::GetPainter().PushLayer(graphics_engine, geo, bg_layer_.get());
}
if (GetLayout())
GetLayout()->ProcessDraw(graphics_engine, force_draw);
if (!IsFullRedraw())
nux::GetPainter().PopBackground();
graphics_engine.PopClippingRectangle();
}
示例15: Draw
void FilterExpanderLabel::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
{
nux::Geometry const& base = GetGeometry();
graphics_engine.PushClippingRectangle(base);
if (ShouldBeHighlighted())
{
nux::Geometry geo(top_bar_layout_->GetGeometry());
geo.x = base.x;
geo.width = base.width;
if (!focus_layer_)
focus_layer_.reset(dash::Style::Instance().FocusOverlay(geo.width, geo.height));
focus_layer_->SetGeometry(geo);
focus_layer_->Renderlayer(graphics_engine);
}
graphics_engine.PopClippingRectangle();
}