Framework > Presentation Layer > Graphics > Appearance Styles > Fill Styles > Texture Mapping Style |
In Nevron Graphics gradients, patterns, advanced gradients and images are treated as textures. Therefore its possible to control how these texture are mapped on the visualized objects. By default you'll not have to directly modify the properties related to texture mapping, because each fill style will automatically assign these properties for you. In certain cases however you may wish to alter the default behavior.
The properties related to texture mapping are controlled by an instance of the NTextureMappingStyle class. You can assign such an object to every fill style derived from the NTextureFillStyle (gradient, hatch, image and advanced gradient), through its Mapping property:
C# |
Copy Code
|
---|---|
NTextureMappingStyle newMappingStyle = new NTextureMappingStyle();
newMappingStyle.MapLayout = MapLayout.Tiled;
textureFillStyle.TextureMappingStyle = newMappingStyle;
|
Visual Basic |
Copy Code
|
---|---|
Dim newMappingStyle As NTextureMappingStyle = New NTextureMappingStyle() newMappingStyle.MapLayout = MapLayout.Tiled textureFillStyle.TextureMappingStyle = newMappingStyle |
In a nut shell texture mapping is controlled by the MapLayout and MapMode properties of the NTextureMappingStyle object. There are three mapping modes:
When the mapping mode is set to MapMode.RelativeToObject (which is the default) there are several map layout strategies:
The following code example applies a tiled pattern, which is scaled 4 times in both the horizontal and vertical directions:
C# |
Copy Code
|
---|---|
NHatchFillStyle hatchFillStyle = new NHatchFillStyle(HatchStyle.Divot, Color.White, Color.Blue); NTextureMappingStyle mapping = new NTextureMappingStyle(); mapping.MapMode = MapMode.RelativeToViewer; mapping.MapLayout = MapLayout.Tiled; mapping.HorizontalScale = 4.0f; mapping.VerticalScale = 4.0f; hatchFillStyle.TextureMappingStyle = mapping; |
Visual Basic |
Copy Code
|
---|---|
Dim hatchFillStyle As NHatchFillStyle = New NHatchFillStyle(HatchStyle.Divot, Color.White, Color.Blue) Dim mapping As NTextureMappingStyle = New NTextureMappingStyle() mapping.MapMode = MapMode.RelativeToViewer mapping.MapLayout = MapLay.Tiled mapping.HorizontalScale = 4.0F mapping.VerticalScale = 4.0F hatchFillStyle.TextureMappingStyle = mapping |