virtual void MGraphic::ScaleBy( const TGPoint& factor, const TGPoint& centerOfScale );
centerOfScale: The center of scale determines the point around which the graphic is scaled. A center of scale other than the center of the graphic can scale the graphic beyond the visible area of the view.
Figure 25
shows a shape scaled three times with a different center of scale each time. The shape after it has been rotated is shown filled.
The following code fragments scale the shape by 50 percent.
The origin of the view is TGPoint( 0,0 ).
The effect of negative scale factors is the same as mirroring. Scaling by 1.0 in the x direction is similar to mirroring about the y-axis. A negative scale factor in the y direction is similar to mirroring about the x-axis.
Figure 26
Center of graphic
shape->ScaleBy( TGPoint( 0.5, 0.5 ), shape->GetGeometricBounds().GetCenter() );
shape->Draw( thePort );
Origin of view
TGPoint( 0, 200 )
Negative scale factor
shape->ScaleBy( TGPoint( -1.0, -1.0), shape->GetGeometricBounds().GetCenter() );
shape->Draw( thePort );
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Generated with WebMaker