FxTextures Sample

This sample is located in \Samples\afc11\FxTextures.

Description
Using the Sample
Key Project Files
Technologies Demonstrated

Description

This sample demonstrates how to use the texture options provided by the com.ms.fx.FxTexture class. The sample displays a panel that contains the following components:

AWT can draw images and stretch them evenly to fill an area with an arbitrary width and height. This is not always useful, however, if you want to stretch an image to internal parameters or prevent confusing visual artifacts when a texture is difficult to scale evenly. For example, with the circle and cross texture used in this sample, you may want the circle to stay as a border and simply stretch the cross.

The texture Stretch Mode panel in this sample shows the variety of stretch modes offered by the FxTexture class. Fx enables you to specify arbitrary gridlines. In this sample, gridlines have been added to the texture above, below, to the left, and to the right of the circle enclosing the red cross. By default, the stretch mode NONE is selected. This tiles the circle and cross texture (that is, repeats them across a surface). The circle repeats only on the outer edges of the textured area, while the cross is repeats only in the middle of the textured area, which provides an automatic bordering effect.

Using the Sample

To use the sample

You can manipulate the sample's components by performing the following actions:

Key Project Files

SDKConsts.java

This interface defines and initializes constants that control the partitioning and position of the image displayed in the Test Area.

TexturePnl.java

This class extends UIPanel and implements SDKConsts. It sets the stretch mode of the texture displayed in the Test Area, enables and disables drawing of partial textures, enables and disables tiling, and handles mouse events.

BtnPanel.java

This class extends UIPanel and implements SDKConsts. It creates the buttons and check box in the left pane of the application, and controls their behavior.

Technologies Demonstrated

AFC

© 1999 Microsoft Corporation. All rights reserved. Terms of use.