- All Implemented Interfaces:
public class EmbossOp extends AbstractBufferedImageOpThe
EmbossOpimplements embossing of an image against another image, the so called bump image. The embossing algorithm works like this :
- Define the position of the light source using two angles, the azimut and the elevation. The azimut defines the direction in the image plane from where the light shines and the elevation defines the height above the image plane of the light source.
- Define a filtersize defining the spread of the embossing effect. We could also say, this is sort of the size of the light.
- Define the bump image. This image is scaled to gray and then used to define the embossing piece.
- For each pixel position in the images :
- Define a plane
E: ax + bx + cx + d = 0where a is the luminance difference between pixels above and below the current pixel, b is the luminance difference between pixels left and right of the current pixel and c is constant relative to the filtersize.
- Calculate the scale factor to apply to the pixel in the image as
- If factors a and b both are zero, the plane E is no plane at all and the scale factor is the height of the light source.
- Else it is the distance of the light source to the above defined plane.
- Multiply each pixel with the scale factor, ignoring the alpha channels.
- Define a plane
The emobossing area is the smaller of the bump and the image to emboss. You will get the best results from using an image as the bump image and some monochromatic image as the image to emboss.
Constructors Constructor Description
EmbossOp(java.awt.image.BufferedImage bump, float azimut, float elevation, float filtersize)Creates a new
EmbossOpfilter instance with the given parameters for embossing.
public EmbossOp(java.awt.image.BufferedImage bump, float azimut, float elevation, float filtersize)Creates a new
EmbossOpfilter instance with the given parameters for embossing. The bump image is copied into the instance so that subsequent changes to the bump image do not have an effect on the embossing operation.
bump- the image being used for the 'bump'
azimut- the light direction azimut in degrees.
elevation- the light direction elevation in degrees.
filtersize- the filtersize for the embossing.
java.lang.IllegalArgumentException- if any of the azimut, elevation or filtersize arguments is negative or
java.lang.NullPointerException- if bump is null.