本文整理汇总了C++中Painter::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ Painter::Draw方法的具体用法?C++ Painter::Draw怎么用?C++ Painter::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Painter
的用法示例。
在下文中一共展示了Painter::Draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawShape
void DrawShape(Painter& Painter, Color ShapeColor = Colors::red,
Color AxisColor = Colors::black)
{
/*To demonstrate affine transformations it helps to show a coordinate
axis. The Shapes class has a built-in path-maker for an axis with ticks.*/
Path Axis, Shape;
Shapes::AddCoordinateAxis(Axis);
/*Show a simple rectangle using filled (not stroked) lines. This allows
us to use a fill operation instead of a stroke operation and it also
provides the outline with rounded corners.*/
Shapes::AddRectangleFromLines(Shape,
Rectangle(Vector(0, 0), Vector(1, 1)), 0.05);
//Draw the axis using the color for the axis.
Painter.SetFill(AxisColor);
Painter.Draw(Axis);
//Draw the shape on top of the axis using the color for the shape.
Painter.SetFill(ShapeColor);
Painter.Draw(Shape);
}
示例2: Paint
virtual void Paint(Painter& Painter, Portfolio& Portfolio)
{
//Create a gradient of tiles.
for(number i = 0.; i < 8.; i += 0.125)
{
for(number j = 0.; j < 8.; j += 0.125)
{
Path p;
Shapes::AddRectangle(p, Rectangle(
Vector(i - 0.01, j - 0.01),
Vector(i + .13, j + .13)));
Color cl(i / 8., j / 8., 0.);
Painter.SetFill(cl);
Painter.Draw(p);
}
}
}