In several cases an abyss (see Figure 127) is created between an image and the rectangle that encloses the image.
The following code adds a blue abyss color to the image bundle. To keep the code concise, the code to create the image bundle and polygon is not shown.
Lines 2 through 3: Create a TImageSamplingControl with the default filtering method of kPointSampling. You get the default because no parameter is specified in the imageSample instantiation.
Lines 6 and 7: Create an image that is 100 world-coordinate units wide and high, and get the image port.
Lines 9: Draw a rectangle that is 200 world-coordinate units wide and high into the image port. Note that the image is smaller than the rectangle.
Line 10: Draw the polygon graphic into the image port.
Line 12: Draw the image. The area between the rectangle and the image fills with the blue abyss color.
Line 1: Create a blue abyss color.1 TRGBColor blueColor( 0, 0, .5 );
2 TImageSamplingControl* imageSample = new TImageSamplingControl();
3 imageSample->SetAbyssColor( blueColor );
4 imageBundle->AdoptImageSampling( imageSample );
5
6 TA8R8G8B8Image anRGBImage( TGPoint::kOrigin, 100, 100, imageBundle );
7 TGrafPort* imagePort->anRGBImage.GetGrafPort();
8
9 imagePort->Draw( TGRect( 0,0, 200,200) );
10 aPolygon->Draw( *imagePort );
11
12 anRGBImage.Draw( thePort );
Line 3: Set the abyss color to blue in imageSample.
Line 4: Adopt imageSample to imageBundle.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.