Image pattern paints

<not implemented yet>

TPaint is an abstract base class, and TImagePatternPaint represents a repeating image pattern for filling or framing a geometry. The TImagePatternPaint owns a TGImage, and the TGImage provides the repeating pattern.

The code fragment below creates a red ellipse and a TA8R8G8B8Image. It gets the image port and draws the ellipse into the image. It then gets the image geometry to create an image pattern paint. The image pattern paint is used to construct the image bundle. A rectangle the size of the image and the image bundle are drawn into the image port, which causes a repeating image pattern of ellipses to fill the image port as shown in Figure 98.


      TColorPaint whiteFill = new TColorPaint( TRGBColor( 1, 1, 1 ) );
      TGrafBundle* ellipseBundle = new TGrafBundle( whiteFill, TAttributeState::kFill );
      TEllipse anEllipse( TGRect( 0, 0, 30, 20 ), ellipseBundle );
      
      TA8R8G8B8Image patternImage( TGPoint::kOrigin, 30,20 );
      TGrafPort* imagePort = patternImage.GetGrafPort();
      anEllipse.Draw( *imagePort );
      
      TImagePatternPaint* anImagePattern = new TImagePatternPaint( *patternImage.GetImage() );
      TGrafBundle imageBundle( anImagePattern, TAttributeState::kFill );
      
      thePort.Draw( TGRect( 0, 0, 200, 200 ), imageBundle );

[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