Spec-Zone .ru
спецификации, руководства, описания, API
|
public class DisplacementMap extends Effect
FloatMap
. Для каждого пикселя в выводе, соответствующих данных от mapData
получается, масштабируется и смещается scale
и offset
атрибуты, масштабируемые снова размером исходного ввода, отображают и используемый в качестве смещения от целевого пикселя, чтобы получить пиксельные данные от исходного ввода. dst[x,y] = src[(x,y) + (offset+scale*map[x,y])*(srcw,srch)]Значение
(0.0, 0.0)
не определил бы смещения для пиксельных данных тогда как значение (0.5, 0.5)
определил бы смещение половины размера исходного изображения.
Отметьте, что отображение является смещением от целевого пикселя до исходного пиксельного расположения, от которого это выбирается, что означает что, заполняя карту всеми значениями 0.5
переместил бы изображение половиной его размера к верхнему левому, так как каждый целевой пиксель будет содержать данные, которые прибывают из исходного пикселя ниже и направо от этого.
Также отметьте, что этот эффект не корректирует координаты входных событий или любых методов, которые измеряют включение на a Node
. Результаты выбора мыши и методов включения неопределены когда a Node
имеет a DisplacementMap
произведите на месте.
Пример:
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:
Type | Property and Description |
---|---|
ObjectProperty<Effect> |
ввод
The input for this
Effect . |
ObjectProperty<FloatMap> |
mapData
The map data for this
Effect . |
DoubleProperty |
offsetX
The offset by which all x coordinate offset values in the
FloatMap are displaced after they are scaled. |
DoubleProperty |
offsetY
The offset by which all y coordinate offset values in the
FloatMap are displaced after they are scaled. |
DoubleProperty |
scaleX
The scale factor by which all x coordinate offset values in the
FloatMap are multiplied. |
DoubleProperty |
scaleY
The scale factor by which all y coordinate offset values in the
FloatMap are multiplied. |
BooleanProperty |
обертка
Defines whether values taken from outside the edges of the map
"wrap around" or not.
|
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
Эффект |
getInput()
Gets the value of the property input.
|
FloatMap |
getMapData()
Gets the value of the property mapData.
|
double |
getOffsetX()
Gets the value of the property offsetX.
|
double |
getOffsetY()
Gets the value of the property offsetY.
|
double |
getScaleX()
Gets the value of the property scaleX.
|
double |
getScaleY()
Gets the value of the property scaleY.
|
ObjectProperty<Effect> |
inputProperty()
The input for this
Effect . |
boolean |
isWrap()
Gets the value of the property wrap.
|
ObjectProperty<FloatMap> |
mapDataProperty()
The map data for this
Effect . |
DoubleProperty |
offsetXProperty()
The offset by which all x coordinate offset values in the
FloatMap are displaced after they are scaled. |
DoubleProperty |
offsetYProperty()
The offset by which all y coordinate offset values in the
FloatMap are displaced after they are scaled. |
DoubleProperty |
scaleXProperty()
The scale factor by which all x coordinate offset values in the
FloatMap are multiplied. |
DoubleProperty |
scaleYProperty()
The scale factor by which all y coordinate offset values in the
FloatMap are multiplied. |
void |
setInput(Effect value)
Sets the value of the property input.
|
void |
setMapData(FloatMap value)
Sets the value of the property mapData.
|
void |
setOffsetX(double value)
Sets the value of the property offsetX.
|
void |
setOffsetY(double value)
Sets the value of the property offsetY.
|
void |
setScaleX(double value)
Sets the value of the property scaleX.
|
void |
setScaleY(double value)
Sets the value of the property scaleY.
|
void |
setWrap(boolean value)
Sets the value of the property wrap.
|
BooleanProperty |
wrapProperty()
Defines whether values taken from outside the edges of the map
"wrap around" or not.
|
public final ObjectProperty<Эффект> inputProperty
Effect
.
If set to null
, or left unspecified, a graphical image of
the Node
to which the Effect
is attached will be
used as the input.getInput()
,
setInput(Effect)
public final ObjectProperty<FloatMap> mapDataProperty
Effect
.getMapData()
,
setMapData(FloatMap)
public final DoubleProperty scaleXProperty
FloatMap
are multiplied.
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
getScaleX()
,
setScaleX(double)
public final DoubleProperty scaleYProperty
FloatMap
are multiplied.
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
getScaleY()
,
setScaleY(double)
public final DoubleProperty offsetXProperty
FloatMap
are displaced after they are scaled.
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
getOffsetX()
,
setOffsetX(double)
public final DoubleProperty offsetYProperty
FloatMap
are displaced after they are scaled.
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
getOffsetY()
,
setOffsetY(double)
public final BooleanProperty wrapProperty
Min: n/a Max: n/a Default: false Identity: n/a
isWrap()
,
setWrap(boolean)
public DisplacementMap()
public DisplacementMap(FloatMap mapData)
mapData
- the map data for this displacement map effectpublic DisplacementMap(FloatMap mapData, double offsetX, double offsetY, double scaleX, double scaleY)
mapData
- the map data for this displacement map effectoffsetX
- the offset by which all x coordinate offset values in the
FloatMap
are displaced after they are scaledoffsetY
- the offset by which all y coordinate offset values in the
FloatMap
are displaced after they are scaledscaleX
- the scale factor by which all x coordinate offset values in the
FloatMap
are multipliedscaleY
- the scale factor by which all y coordinate offset values in the
FloatMap
are multipliedpublic final void setInput(Effect value)
Effect
.
If set to null
, or left unspecified, a graphical image of
the Node
to which the Effect
is attached will be
used as the input.public final Эффект getInput()
Effect
.
If set to null
, or left unspecified, a graphical image of
the Node
to which the Effect
is attached will be
used as the input.public final ObjectProperty<Эффект> inputProperty()
Effect
.
If set to null
, or left unspecified, a graphical image of
the Node
to which the Effect
is attached will be
used as the input.getInput()
,
setInput(Effect)
public final void setMapData(FloatMap value)
Effect
.public final FloatMap getMapData()
Effect
.public final ObjectProperty<FloatMap> mapDataProperty()
Effect
.getMapData()
,
setMapData(FloatMap)
public final void setScaleX(double value)
FloatMap
are multiplied.
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
public final double getScaleX()
FloatMap
are multiplied.
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
public final DoubleProperty scaleXProperty()
FloatMap
are multiplied.
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
getScaleX()
,
setScaleX(double)
public final void setScaleY(double value)
FloatMap
are multiplied.
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
public final double getScaleY()
FloatMap
are multiplied.
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
public final DoubleProperty scaleYProperty()
FloatMap
are multiplied.
Min: n/a Max: n/a Default: 1.0 Identity: 1.0
getScaleY()
,
setScaleY(double)
public final void setOffsetX(double value)
FloatMap
are displaced after they are scaled.
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
public final double getOffsetX()
FloatMap
are displaced after they are scaled.
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
public final DoubleProperty offsetXProperty()
FloatMap
are displaced after they are scaled.
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
getOffsetX()
,
setOffsetX(double)
public final void setOffsetY(double value)
FloatMap
are displaced after they are scaled.
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
public final double getOffsetY()
FloatMap
are displaced after they are scaled.
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
public final DoubleProperty offsetYProperty()
FloatMap
are displaced after they are scaled.
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
getOffsetY()
,
setOffsetY(double)
public final void setWrap(boolean value)
Min: n/a Max: n/a Default: false Identity: n/a
public final boolean isWrap()
Min: n/a Max: n/a Default: false Identity: n/a
public final BooleanProperty wrapProperty()
Min: n/a Max: n/a Default: false Identity: n/a
isWrap()
,
setWrap(boolean)
Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. Use is subject to