Beispiel #1
0
 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);
 }
Beispiel #2
0
 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);
     }
   }
 }