当前位置: 首页>>代码示例>>C++>>正文


C++ graph_reference::setsta方法代码示例

本文整理汇总了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();
			}
开发者ID:besh81,项目名称:nana,代码行数:95,代码来源:picture.cpp


注:本文中的graph_reference::setsta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。