本文整理汇总了C++中graph_reference::setsta方法的典型用法代码示例。如果您正苦于以下问题:C++ graph_reference::setsta方法的具体用法?C++ graph_reference::setsta怎么用?C++ graph_reference::setsta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph_reference
的用法示例。
在下文中一共展示了graph_reference::setsta方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refresh
void drawer::refresh(graph_reference graph)
{
auto const graphsize = graph.size();
auto & backimg = impl_->backimg;
if (!backimg.bground)
{
if (backimg.image.empty())
{
impl_->draw_background(graph, {});
return;
}
auto valid_area = backimg.valid_area;
if (valid_area.empty())
valid_area.dimension(backimg.image.size());
//The position where the image to be drawn.
::nana::point pos;
if (backimg.stretchable)
{
auto fit_size = fit_zoom(valid_area.dimension(), graphsize);
if (fit_size.width != graphsize.width)
{
switch (backimg.align_horz)
{
case ::nana::align::left: break;
case ::nana::align::center:
pos.x = (int(graphsize.width) - int(fit_size.width)) / 2;
break;
case ::nana::align::right:
pos.x = int(graphsize.width) - int(fit_size.width);
break;
}
}
else if (fit_size.height != graphsize.height)
{
switch (backimg.align_vert)
{
case ::nana::align_v::top: break;
case ::nana::align_v::center:
pos.y = (int(graphsize.height) - int(fit_size.height)) / 2;
break;
case ::nana::align_v::bottom:
pos.y = int(graphsize.height) - int(fit_size.height);
break;
}
}
impl_->draw_background(graph, fit_size);
backimg.image.stretch(valid_area, graph, ::nana::rectangle{ pos, fit_size });
}
else
{
switch (backimg.align_horz)
{
case ::nana::align::left: break;
case ::nana::align::center:
pos.x = (int(graphsize.width) - int(valid_area.width)) / 2;
break;
case ::nana::align::right:
pos.x = int(graphsize.width) - int(valid_area.width);
break;
}
switch (backimg.align_vert)
{
case ::nana::align_v::top: break;
case ::nana::align_v::center:
pos.y = (int(graphsize.height) - int(valid_area.height)) / 2;
break;
case ::nana::align_v::bottom:
pos.y = int(graphsize.height) - int(valid_area.height);
break;
}
impl_->draw_background(graph, valid_area.dimension());
backimg.image.paste(valid_area, graph, pos);
}
}
else
{
impl_->draw_background(graph, graphsize);
color invalid_clr_for_call;
backimg.bground->draw(graph, invalid_clr_for_call, invalid_clr_for_call, rectangle{ graphsize }, element_state::normal);
}
graph.setsta();
}