- java.lang.Object
-
- javafx.scene.effect.Effect
-
- javafx.scene.effect.Lighting
-
public class Lighting extends Effect
模拟照亮给定内容的光源的效果,可用于给平坦物体更逼真的三维外观。例:
Light.Distant light = new Light.Distant(); light.setAzimuth(-135.0); Lighting lighting = new Lighting(); lighting.setLight(light); lighting.setSurfaceScale(5.0); Text text = new Text(); text.setText("JavaFX!"); text.setFill(Color.STEELBLUE); text.setFont(Font.font(null, FontWeight.BOLD, 60)); text.setX(10.0); text.setY(10.0); text.setTextOrigin(VPos.TOP); text.setEffect(lighting);以上代码产生以下内容:

- 从以下版本开始:
- JavaFX 2.0
-
-
Property Summary
Properties Type Property 描述 ObjectProperty<Effect>bumpInput可选的凹凸贴图输入。ObjectProperty<Effect>contentInput内容输入为Effect。DoublePropertydiffuseConstant漫反射常数。ObjectProperty<Light>light该光源为这Lighting效果。DoublePropertyspecularConstant镜面常数。DoublePropertyspecularExponent镜面指数。DoublePropertysurfaceScale表面比例因子。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 ObjectProperty<Effect>bumpInputProperty()可选的凹凸贴图输入。ObjectProperty<Effect>contentInputProperty()内容输入为Effect。DoublePropertydiffuseConstantProperty()漫反射常数。EffectgetBumpInput()获取属性bumpInput的值。EffectgetContentInput()获取属性contentInput的值。doublegetDiffuseConstant()获取属性diffuseConstant的值。LightgetLight()获取属性灯的值。doublegetSpecularConstant()获取属性specularConstant的值。doublegetSpecularExponent()获取属性specularExponent的值。doublegetSurfaceScale()获取属性surfaceScale的值。ObjectProperty<Light>lightProperty()光源为这Lighting效果。voidsetBumpInput(Effect value)设置属性bumpInput的值。voidsetContentInput(Effect value)设置属性contentInput的值。voidsetDiffuseConstant(double value)设置属性diffuseConstant的值。voidsetLight(Light value)设置属性灯的值。voidsetSpecularConstant(double value)设置属性specularConstant的值。voidsetSpecularExponent(double value)设置属性specularExponent的值。voidsetSurfaceScale(double value)设置属性surfaceScale的值。DoublePropertyspecularConstantProperty()镜面常数。DoublePropertyspecularExponentProperty()镜面指数。DoublePropertysurfaceScaleProperty()表面比例因子。
-
-
-
Property Detail
-
light
public final ObjectProperty<Light> lightProperty
这个光源为这个Lighting效果。- 另请参见:
-
getLight(),setLight(Light)
-
bumpInput
public final ObjectProperty<Effect> bumpInputProperty
可选的凹凸贴图输入。 如果未指定,则会从默认输入自动生成凹凸贴图。 如果设置为null或未指定,则将使用连接Effect的Node的图形图像生成默认凹凸贴图。- Default value:
- 半径为10的阴影效果
- 另请参见:
-
getBumpInput(),setBumpInput(Effect)
-
contentInput
public final ObjectProperty<Effect> contentInputProperty
内容输入为Effect。 如果设置为null或未指定,Effect连接Effect的Node的图形图像作为输入。- Default value:
- 空值
- 另请参见:
-
getContentInput(),setContentInput(Effect)
-
diffuseConstant
public final DoubleProperty diffuseConstantProperty
漫反射常数。Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a- Default value:
- 1.0
- 另请参见:
-
getDiffuseConstant(),setDiffuseConstant(double)
-
specularConstant
public final DoubleProperty specularConstantProperty
镜面常数。Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a- Default value:
- 0.3
- 另请参见:
-
getSpecularConstant(),setSpecularConstant(double)
-
specularExponent
public final DoubleProperty specularExponentProperty
镜面指数。Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a- Default value:
- 20.0
- 另请参见:
-
getSpecularExponent(),setSpecularExponent(double)
-
surfaceScale
public final DoubleProperty surfaceScaleProperty
表面比例因子。Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a- Default value:
- 1.5
- 另请参见:
-
getSurfaceScale(),setSurfaceScale(double)
-
-
构造方法详细信息
-
Lighting
public Lighting()
使用默认参数创建一个新的照明实例。
-
Lighting
public Lighting(Light light)
用指定的光线创建一个新的照明实例。- 参数
-
light- 这个Lighting效果的光源 - 从以下版本开始:
- JavaFX 2.1
-
-
方法详细信息
-
setLight
public final void setLight(Light value)
设置属性灯的值。- Property description:
-
这个光源为这个
Lighting效果。
-
getLight
public final Light getLight()
获取属性灯的值。- Property description:
-
这个光源为这个
Lighting效果。
-
lightProperty
public final ObjectProperty<Light> lightProperty()
这个光源为这个Lighting效果。- 另请参见:
-
getLight(),setLight(Light)
-
setBumpInput
public final void setBumpInput(Effect value)
设置属性bumpInput的值。- Property description:
-
可选的凹凸贴图输入。
如果未指定,则会从默认输入自动生成凹凸贴图。
如果设置为
null或未指定,则将使用Effect附带的Node的图形图像生成默认凹凸贴图。 - Default value:
- 半径为10的阴影效果
-
getBumpInput
public final Effect getBumpInput()
获取属性bumpInput的值。- Property description:
-
可选的凹凸贴图输入。
如果未指定,则会从默认输入自动生成凹凸贴图。
如果设置为
null或未指定,则Effect附带的Node的图形图像将用于生成默认凹凸贴图。 - Default value:
- 半径为10的阴影效果
-
bumpInputProperty
public final ObjectProperty<Effect> bumpInputProperty()
可选的凹凸贴图输入。 如果未指定,则会从默认输入自动生成凹凸贴图。 如果设置为null或未指定,则将使用连接Effect的Node的图形图像生成默认凹凸贴图。- Default value:
- 半径为10的阴影效果
- 另请参见:
-
getBumpInput(),setBumpInput(Effect)
-
setContentInput
public final void setContentInput(Effect value)
设置属性contentInput的值。- Property description:
-
内容输入为
Effect。 如果设置为null或未指定,Effect连接Effect的Node的图形图像用作输入。 - Default value:
- 空值
-
getContentInput
public final Effect getContentInput()
获取属性contentInput的值。- Property description:
-
内容输入为
Effect。 如果设置为null或未指定,则将使用连接Effect的Node的图形图像作为输入。 - Default value:
- 空值
-
contentInputProperty
public final ObjectProperty<Effect> contentInputProperty()
内容输入为Effect。 如果设置为null或未指定,Effect连接Effect的Node的图形图像作为输入。- Default value:
- 空值
- 另请参见:
-
getContentInput(),setContentInput(Effect)
-
setDiffuseConstant
public final void setDiffuseConstant(double value)
设置属性diffuseConstant的值。- Property description:
-
漫反射常数。
Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a - Default value:
- 1.0
-
getDiffuseConstant
public final double getDiffuseConstant()
获取属性diffuseConstant的值。- Property description:
-
漫反射常数。
Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a - Default value:
- 1.0
-
diffuseConstantProperty
public final DoubleProperty diffuseConstantProperty()
漫反射常数。Min: 0.0 Max: 2.0 Default: 1.0 Identity: n/a- Default value:
- 1.0
- 另请参见:
-
getDiffuseConstant(),setDiffuseConstant(double)
-
setSpecularConstant
public final void setSpecularConstant(double value)
设置属性specularConstant的值。- Property description:
-
镜面常数。
Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a - Default value:
- 0.3
-
getSpecularConstant
public final double getSpecularConstant()
获取属性specularConstant的值。- Property description:
-
镜面常数。
Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a - Default value:
- 0.3
-
specularConstantProperty
public final DoubleProperty specularConstantProperty()
镜面常数。Min: 0.0 Max: 2.0 Default: 0.3 Identity: n/a- Default value:
- 0.3
- 另请参见:
-
getSpecularConstant(),setSpecularConstant(double)
-
setSpecularExponent
public final void setSpecularExponent(double value)
设置属性specularExponent的值。- Property description:
-
镜面指数。
Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a - Default value:
- 20.0
-
getSpecularExponent
public final double getSpecularExponent()
获取属性specularExponent的值。- Property description:
-
镜面指数。
Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a - Default value:
- 20.0
-
specularExponentProperty
public final DoubleProperty specularExponentProperty()
镜面指数。Min: 0.0 Max: 40.0 Default: 20.0 Identity: n/a- Default value:
- 20.0
- 另请参见:
-
getSpecularExponent(),setSpecularExponent(double)
-
setSurfaceScale
public final void setSurfaceScale(double value)
设置属性surfaceScale的值。- Property description:
-
表面比例因子。
Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a - Default value:
- 1.5
-
getSurfaceScale
public final double getSurfaceScale()
获取属性surfaceScale的值。- Property description:
-
表面比例因子。
Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a - Default value:
- 1.5
-
surfaceScaleProperty
public final DoubleProperty surfaceScaleProperty()
表面比例因子。Min: 0.0 Max: 10.0 Default: 1.5 Identity: n/a- Default value:
- 1.5
- 另请参见:
-
getSurfaceScale(),setSurfaceScale(double)
-
-