- java.lang.Object
- 
- javafx.scene.effect.Effect
- 
- javafx.scene.effect.DisplacementMap
 
 
- 
 public class DisplacementMap extends Effect An effect that shifts each pixel by a distance specified by the first two bands of of the specifiedFloatMap. For each pixel in the output, the corresponding data from themapDatais retrieved, scaled and offset by thescaleandoffsetattributes, scaled again by the size of the source input image and used as an offset from the destination pixel to retrieve the pixel data from the source input.dst[x,y] = src[(x,y) + (offset+scale*map[x,y])*(srcw,srch)]A value of(0.0, 0.0)would specify no offset for the pixel data whereas a value of(0.5, 0.5)would specify an offset of half of the source image size.Note that the mapping is the offset from a destination pixel to the source pixel location from which it is sampled which means that filling the map with all values of 0.5would displace the image by half of its size towards the upper left since each destination pixel would contain the data that comes from the source pixel below and to the right of it.Also note that this effect does not adjust the coordinates of input events or any methods that measure containment on a Node. The results of mouse picking and the containment methods are undefined when aNodehas aDisplacementMapeffect in place.Example: int width = 220; int height = 100; FloatMap floatMap = new FloatMap(); floatMap.setWidth(width); floatMap.setHeight(height); for (int i = 0; i < width; i++) { double v = (Math.sin(i / 20.0 * Math.PI) - 0.5) / 40.0; for (int j = 0; j < height; j++) { floatMap.setSamples(i, j, 0.0f, (float) v); } } DisplacementMap displacementMap = new DisplacementMap(); displacementMap.setMapData(floatMap); Text text = new Text(); text.setX(40.0); text.setY(80.0); text.setText("Wavy Text"); text.setFill(Color.web("0x3b596d")); text.setFont(Font.font(null, FontWeight.BOLD, 50)); text.setEffect(displacementMap);The code above produces the following:   - Since:
- JavaFX 2.0
 
- 
- 
Property SummaryProperties Type Property Description ObjectProperty<Effect>inputThe input for thisEffect.ObjectProperty<FloatMap>mapDataThe map data for thisEffect.DoublePropertyoffsetXThe offset by which all x coordinate offset values in theFloatMapare displaced after they are scaled.DoublePropertyoffsetYThe offset by which all y coordinate offset values in theFloatMapare displaced after they are scaled.DoublePropertyscaleXThe scale factor by which all x coordinate offset values in theFloatMapare multiplied.DoublePropertyscaleYThe scale factor by which all y coordinate offset values in theFloatMapare multiplied.BooleanPropertywrapDefines whether values taken from outside the edges of the map "wrap around" or not.
 - 
Constructor SummaryConstructors Constructor Description DisplacementMap()Creates a new instance of DisplacementMap with default parameters.DisplacementMap(FloatMap mapData)Creates a new instance of DisplacementMap with the specified mapData.DisplacementMap(FloatMap mapData, double offsetX, double offsetY, double scaleX, double scaleY)Creates a new instance of DisplacementMap with the specified mapData, offsetX, offsetY, scaleX, and scaleY.
 - 
Method SummaryModifier and Type Method Description EffectgetInput()Gets the value of the property input.FloatMapgetMapData()Gets the value of the property mapData.doublegetOffsetX()Gets the value of the property offsetX.doublegetOffsetY()Gets the value of the property offsetY.doublegetScaleX()Gets the value of the property scaleX.doublegetScaleY()Gets the value of the property scaleY.ObjectProperty<Effect>inputProperty()The input for thisEffect.booleanisWrap()Gets the value of the property wrap.ObjectProperty<FloatMap>mapDataProperty()The map data for thisEffect.DoublePropertyoffsetXProperty()The offset by which all x coordinate offset values in theFloatMapare displaced after they are scaled.DoublePropertyoffsetYProperty()The offset by which all y coordinate offset values in theFloatMapare displaced after they are scaled.DoublePropertyscaleXProperty()The scale factor by which all x coordinate offset values in theFloatMapare multiplied.DoublePropertyscaleYProperty()The scale factor by which all y coordinate offset values in theFloatMapare multiplied.voidsetInput(Effect value)Sets the value of the property input.voidsetMapData(FloatMap value)Sets the value of the property mapData.voidsetOffsetX(double value)Sets the value of the property offsetX.voidsetOffsetY(double value)Sets the value of the property offsetY.voidsetScaleX(double value)Sets the value of the property scaleX.voidsetScaleY(double value)Sets the value of the property scaleY.voidsetWrap(boolean value)Sets the value of the property wrap.BooleanPropertywrapProperty()Defines whether values taken from outside the edges of the map "wrap around" or not.
 
- 
- 
- 
Property Detail- 
inputpublic final ObjectProperty<Effect> inputProperty The input for thisEffect. If set tonull, or left unspecified, a graphical image of theNodeto which theEffectis attached will be used as the input.- Default value:
- null
- See Also:
- getInput(),- setInput(Effect)
 
 - 
mapDatapublic final ObjectProperty<FloatMap> mapDataProperty The map data for thisEffect.- Default value:
- an empty map
- See Also:
- getMapData(),- setMapData(FloatMap)
 
 - 
scaleXpublic final DoubleProperty scaleXProperty The scale factor by which all x coordinate offset values in theFloatMapare multiplied.Min: n/a Max: n/a Default: 1.0 Identity: 1.0- Default value:
- 1.0
- See Also:
- getScaleX(),- setScaleX(double)
 
 - 
scaleYpublic final DoubleProperty scaleYProperty The scale factor by which all y coordinate offset values in theFloatMapare multiplied.Min: n/a Max: n/a Default: 1.0 Identity: 1.0- Default value:
- 1.0
- See Also:
- getScaleY(),- setScaleY(double)
 
 - 
offsetXpublic final DoubleProperty offsetXProperty The offset by which all x coordinate offset values in theFloatMapare displaced after they are scaled.Min: n/a Max: n/a Default: 0.0 Identity: 0.0- Default value:
- 0.0
- See Also:
- getOffsetX(),- setOffsetX(double)
 
 - 
offsetYpublic final DoubleProperty offsetYProperty The offset by which all y coordinate offset values in theFloatMapare displaced after they are scaled.Min: n/a Max: n/a Default: 0.0 Identity: 0.0- Default value:
- 0.0
- See Also:
- getOffsetY(),- setOffsetY(double)
 
 - 
wrappublic final BooleanProperty wrapProperty Defines whether values taken from outside the edges of the map "wrap around" or not.Min: n/a Max: n/a Default: false Identity: n/a- Default value:
- false
- See Also:
- isWrap(),- setWrap(boolean)
 
 
- 
 - 
Constructor Detail- 
DisplacementMappublic DisplacementMap() Creates a new instance of DisplacementMap with default parameters.
 - 
DisplacementMappublic DisplacementMap(FloatMap mapData) Creates a new instance of DisplacementMap with the specified mapData.- Parameters:
- mapData- the map data for this displacement map effect
- Since:
- JavaFX 2.1
 
 - 
DisplacementMappublic DisplacementMap(FloatMap mapData, double offsetX, double offsetY, double scaleX, double scaleY) Creates a new instance of DisplacementMap with the specified mapData, offsetX, offsetY, scaleX, and scaleY.- Parameters:
- mapData- the map data for this displacement map effect
- offsetX- the offset by which all x coordinate offset values in the- FloatMapare displaced after they are scaled
- offsetY- the offset by which all y coordinate offset values in the- FloatMapare displaced after they are scaled
- scaleX- the scale factor by which all x coordinate offset values in the- FloatMapare multiplied
- scaleY- the scale factor by which all y coordinate offset values in the- FloatMapare multiplied
- Since:
- JavaFX 2.1
 
 
- 
 - 
Method Detail- 
setInputpublic final void setInput(Effect value) Sets the value of the property input.- Property description:
- The input for this Effect. If set tonull, or left unspecified, a graphical image of theNodeto which theEffectis attached will be used as the input.
- Default value:
- null
 
 - 
getInputpublic final Effect getInput() Gets the value of the property input.- Property description:
- The input for this Effect. If set tonull, or left unspecified, a graphical image of theNodeto which theEffectis attached will be used as the input.
- Default value:
- null
 
 - 
inputPropertypublic final ObjectProperty<Effect> inputProperty() The input for thisEffect. If set tonull, or left unspecified, a graphical image of theNodeto which theEffectis attached will be used as the input.- Default value:
- null
- See Also:
- getInput(),- setInput(Effect)
 
 - 
setMapDatapublic final void setMapData(FloatMap value) Sets the value of the property mapData.- Property description:
- The map data for this Effect.
- Default value:
- an empty map
 
 - 
getMapDatapublic final FloatMap getMapData() Gets the value of the property mapData.- Property description:
- The map data for this Effect.
- Default value:
- an empty map
 
 - 
mapDataPropertypublic final ObjectProperty<FloatMap> mapDataProperty() The map data for thisEffect.- Default value:
- an empty map
- See Also:
- getMapData(),- setMapData(FloatMap)
 
 - 
setScaleXpublic final void setScaleX(double value) Sets the value of the property scaleX.- Property description:
- The scale factor by which all x coordinate offset values in the
 FloatMapare multiplied.Min: n/a Max: n/a Default: 1.0 Identity: 1.0
- Default value:
- 1.0
 
 - 
getScaleXpublic final double getScaleX() Gets the value of the property scaleX.- Property description:
- The scale factor by which all x coordinate offset values in the
 FloatMapare multiplied.Min: n/a Max: n/a Default: 1.0 Identity: 1.0
- Default value:
- 1.0
 
 - 
scaleXPropertypublic final DoubleProperty scaleXProperty() The scale factor by which all x coordinate offset values in theFloatMapare multiplied.Min: n/a Max: n/a Default: 1.0 Identity: 1.0- Default value:
- 1.0
- See Also:
- getScaleX(),- setScaleX(double)
 
 - 
setScaleYpublic final void setScaleY(double value) Sets the value of the property scaleY.- Property description:
- The scale factor by which all y coordinate offset values in the
 FloatMapare multiplied.Min: n/a Max: n/a Default: 1.0 Identity: 1.0
- Default value:
- 1.0
 
 - 
getScaleYpublic final double getScaleY() Gets the value of the property scaleY.- Property description:
- The scale factor by which all y coordinate offset values in the
 FloatMapare multiplied.Min: n/a Max: n/a Default: 1.0 Identity: 1.0
- Default value:
- 1.0
 
 - 
scaleYPropertypublic final DoubleProperty scaleYProperty() The scale factor by which all y coordinate offset values in theFloatMapare multiplied.Min: n/a Max: n/a Default: 1.0 Identity: 1.0- Default value:
- 1.0
- See Also:
- getScaleY(),- setScaleY(double)
 
 - 
setOffsetXpublic final void setOffsetX(double value) Sets the value of the property offsetX.- Property description:
- The offset by which all x coordinate offset values in the
 FloatMapare displaced after they are scaled.Min: n/a Max: n/a Default: 0.0 Identity: 0.0
- Default value:
- 0.0
 
 - 
getOffsetXpublic final double getOffsetX() Gets the value of the property offsetX.- Property description:
- The offset by which all x coordinate offset values in the
 FloatMapare displaced after they are scaled.Min: n/a Max: n/a Default: 0.0 Identity: 0.0
- Default value:
- 0.0
 
 - 
offsetXPropertypublic final DoubleProperty offsetXProperty() The offset by which all x coordinate offset values in theFloatMapare displaced after they are scaled.Min: n/a Max: n/a Default: 0.0 Identity: 0.0- Default value:
- 0.0
- See Also:
- getOffsetX(),- setOffsetX(double)
 
 - 
setOffsetYpublic final void setOffsetY(double value) Sets the value of the property offsetY.- Property description:
- The offset by which all y coordinate offset values in the
 FloatMapare displaced after they are scaled.Min: n/a Max: n/a Default: 0.0 Identity: 0.0
- Default value:
- 0.0
 
 - 
getOffsetYpublic final double getOffsetY() Gets the value of the property offsetY.- Property description:
- The offset by which all y coordinate offset values in the
 FloatMapare displaced after they are scaled.Min: n/a Max: n/a Default: 0.0 Identity: 0.0
- Default value:
- 0.0
 
 - 
offsetYPropertypublic final DoubleProperty offsetYProperty() The offset by which all y coordinate offset values in theFloatMapare displaced after they are scaled.Min: n/a Max: n/a Default: 0.0 Identity: 0.0- Default value:
- 0.0
- See Also:
- getOffsetY(),- setOffsetY(double)
 
 - 
setWrappublic final void setWrap(boolean value) Sets the value of the property wrap.- Property description:
- Defines whether values taken from outside the edges of the map
 "wrap around" or not.
 Min: n/a Max: n/a Default: false Identity: n/a
- Default value:
- false
 
 - 
isWrappublic final boolean isWrap() Gets the value of the property wrap.- Property description:
- Defines whether values taken from outside the edges of the map
 "wrap around" or not.
 Min: n/a Max: n/a Default: false Identity: n/a
- Default value:
- false
 
 - 
wrapPropertypublic final BooleanProperty wrapProperty() Defines whether values taken from outside the edges of the map "wrap around" or not.Min: n/a Max: n/a Default: false Identity: n/a- Default value:
- false
- See Also:
- isWrap(),- setWrap(boolean)
 
 
- 
 
-