Example apple

Figure 65 and the following code show how to combine ellipses to create an apple with two leaves and a stem.


    1  TGArea apple( TGEllipse( TGRect ( 0, 64, 96, 176 ) ) );
    2  apple += TGEllipse( TGRect( 32, 64, 128, 176 ) );
    3  apple += TGRect( 63, 32, 65, 72 );
    4  TGArea leaf( TGEllipse( TGRect( 40, 16, 88, 64 ) ) );
    5  leaf *= TGEllipse( TGRect( 64, 40, 112, 88 ) );
    6  apple += leaf; 
    7  leaf.TransformBy( TGrafMatrix( TGPoint( 64, 0 ), TGPoint( 1, 1 ) ) );
    8  leaf.TransformBy( TGrafMatrix( TGPoint( 0, 16 ) ) );
    9  apple += leaf;
Line 1: Left side of apple.

Line 2: Right side of apple.

Line 3: Apple stem.

Lines 4 through 6: Right leaf.

Lines 7 through 9: Left Leaf.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker