The bevel and emboss image filter applies a bevel and emboss effect on the image. This effect works by first creating two blurred images from the original one, but painted in different color (highlight and shadow color) and then combining the original image with them. The different types of the bevel and emboss filter define how these images are combined.
You create a bevel and emboss image filter by creating an instance of the NBevelAndEmbossImageFilter and adding it to the Filters collection of the NImageFiltersStyle object:
C# |
Copy Code
|
NBevelAndEmbossImageFilter bevelAndEmbossImageFilter = new NBevelAndEmbossImageFilter();
someFillStyle.ImageFiltersStyle.Filters.Add(bevelAndEmbossImageFilter);
|
Visual Basic |
Copy Code
|
Dim bevelAndEmbossImageFilter As NBevelAndEmbossImageFilter = New NBevelAndEmbossImageFilter()
someFillStyle.ImageFiltersStyle.Filters.Add(bevelAndEmbossImageFilter)
|
The type of the bevel and emboss is controlled by the BevelType property, which accepts values from the BevelType enumeration:
Bevel type |
Description |
Inner |
Only pixels inside the original are modified, by adding the contribution generated from the highlight and shadow images to the original. |
Outer |
Only pixels that lay outside the original image are modified by adding the contribution from the highlight and shadow images leaving the original image intact. |
Emboss |
Both pixels that lay inside and outside of the image are modified.
If the pixel is inside the original image the contribution of the highlight and shadow images are added to the original pixel.
If the pixel is outside the original the contribution from the highlight and shadow images is written to the resulting image. |
PillowEmboss |
Both pixels that lay inside and outside of the image are modified.
If the pixel is inside the original the contribution of the highlight and shadow images are added to the original pixel.
If the pixel is outside the original the contribution from the inverted highlight and inverted shadow images is written to the resulting image. |
The highlight and shadow colors of the derived images can be controlled by using the LightColor and ShadowColor properties of the filter:
C# |
Copy Code
|
NBevelAndEmbossImageFilter bevelAndEmbossImageFilter = new NBevelAndEmbossImageFilter();
bevelAndEmbossImageFilter.LightColor = Color.White;
bevelAndEmbossImageFilter.ShadowColor = Color.Black;
someFillStyle.ImageFiltersStyle.Filters.Add(bevelAndEmbossImageFilter);
|
Visual Basic |
Copy Code
|
Dim bevelAndEmbossImageFilter As NBevelAndEmbossImageFilter = New NBevelAndEmbossImageFilter()
bevelAndEmbossImageFilter.LightColor = Color.White
bevelAndEmbossImageFilter.ShadowColor = Color.Black
someFillStyle.ImageFiltersStyle.Filters.Add(bevelAndEmbossFilter)
|
Furthermore the type and depth of the blur effect applied on the highlight and shadow images can also be controlled by using the BlurType and Soften parameters. The first one controls the color distribution function and the second one the size of the blur kernel used to convolve the original image in pixels.
Finally you can instruct the filter how much of the original image should be displayed by using the OriginalOpacity parameter accepting values in the range [0, 100], where 0 stands for completely transparent and 100 means completely opaque. The default value of this parameter is 100.
The following table shows the different types of bevel and emboss:
Image |
Description |
|
Inner bevel and emboss |
|
Outer bevel and emboss |
|
Emboss |
|
Pillow emboss |