Draw
Draws the shape to the drawing surface filled with the specified color. The actual output of this function depends on what kind of a Shape the object actually is. Examples // Create a new circle and store a pointer to it //
Shape *myShape = new Circle( 200.0, 100.0, 50.0 ); // Draw the shape to the canvas filled with green // myShape->Draw( Rgba::GREEN ); // Using a pointer to a shape can be useful if you make a list // // which contains all the primitives in the screen // std::list< Shape *> myList; // Add a circle, line and a rectangle to the list // myList.push_back( new Circle( 200.0, 100.0, 50.0 )); myList.push_back( new Line( 200.0, 100.0, 250.0, 150.0 ); myList.push_back( new Rect( 200.0, 100.0, 70.0, 50.0 ); // Draw all the primitives filled with black // for( std::list< Shape *> ::iterator iter = myList.begin(); iter != myList.end(); iter++ ) { (*iter)->Draw( Rgba::BLACK ); } Other functions of the class Shape
Questions about Draw? Click here. |