![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() | |
![]()
|
|
|||||||||||||
FxTextures Sample AppletThis sample demonstrates the flexibility of the texture options provided by the com.ms.fx package.
DescriptionAWT is able to 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. 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, or prevent confusing visual artifacts if a texture is difficult to scale evenly. 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, these have been added to the texture above, below, to the left and to the right of the circle enclosing the red-colored cross. By default, the first stretch mode, NONE, is selected. This means that the circle and cross texture is tiled (or repeated across a surface), but the circle is repeated only on the outer edges of the textured area, while the cross is repeated only in the middle of the textured area, to give an automatic bordering effect. If you choose the MIDDLE stretch mode, the cross in the middle of the texture is stretched, while the circle at the edge of the textured area continues to be repeated. If you choose the OUTER stretch mode, the outer border is stretched, while the cross in the middle is repeated. Finally, if you choose the ALL stretch mode, both the border and the cross are stretched relative to the origin of the texture. You can change the position and size of the texture on the display area by clicking and dragging the mouse over the test area. The Texture Features option below the Texture Stretch Mode list of choices is Partial Texture (by default). If you select NONE from the Texture Stretch Mode list, you will see that the borders do not line up correctly. Unchecking Partial Texture enables the snap-to-grid capability in Fx, ensuring that all portions of the texture are automatically drawn evenly and that the borders look correct. The effects of the Partial Texture option can also be seen with the other Texture Stretch Mode options as you experiment with the sample. Finally, the Tile Texture option allows you to pin the origin of the texture to the origin of the panel in which the component that is being textured is displayed, resulting in the texture being tiled within the selected area. When this option is selected no stretching of the texture occurs. SourcesThis sample applet consists of the following sources:
|
![]() |