public class DropShadow extends Effect
Example:
DropShadow dropShadow = new DropShadow();
dropShadow.setRadius(5.0);
dropShadow.setOffsetX(3.0);
dropShadow.setOffsetY(3.0);
dropShadow.setColor(Color.color(0.4, 0.5, 0.5));
Text text = new Text();
text.setEffect(dropShadow);
text.setCache(true);
text.setX(10.0);
text.setY(70.0);
text.setFill(Color.web("0x3b596d"));
text.setText("JavaFX drop shadow...");
text.setFont(Font.font(null, FontWeight.BOLD, 40));
DropShadow dropShadow2 = new DropShadow();
dropShadow2.setOffsetX(6.0);
dropShadow2.setOffsetY(4.0);
Circle circle = new Circle();
circle.setEffect(dropShadow2);
circle.setCenterX(50.0);
circle.setCenterY(125.0);
circle.setRadius(30.0);
circle.setFill(Color.STEELBLUE);
circle.setCache(true);
The code above produces the following:
Type | Property and Description |
---|---|
<any> |
blurType
The algorithm used to blur the shadow.
|
<any> |
color
The shadow
Color . |
DoubleProperty |
height
The vertical size of the shadow blur kernel.
|
<any> |
input
The input for this
Effect . |
DoubleProperty |
offsetX
The shadow offset in the x direction, in pixels.
|
DoubleProperty |
offsetY
The shadow offset in the y direction, in pixels.
|
DoubleProperty |
radius
The radius of the shadow blur kernel.
|
DoubleProperty |
spread
The spread of the shadow.
|
DoubleProperty |
width
The horizontal size of the shadow blur kernel.
|
Effect.EffectInputChangeListener, Effect.EffectInputProperty
Modifier and Type | Field and Description |
---|---|
private <any> |
blurType
The algorithm used to blur the shadow.
|
private boolean |
changeIsLocal |
private <any> |
color
The shadow
Color . |
private DoubleProperty |
height
The vertical size of the shadow blur kernel.
|
private <any> |
input
The input for this
Effect . |
private DoubleProperty |
offsetX
The shadow offset in the x direction, in pixels.
|
private DoubleProperty |
offsetY
The shadow offset in the y direction, in pixels.
|
private DoubleProperty |
radius
The radius of the shadow blur kernel.
|
private DoubleProperty |
spread
The spread of the shadow.
|
private DoubleProperty |
width
The horizontal size of the shadow blur kernel.
|
Constructor and Description |
---|
DropShadow()
Creates a new instance of DropShadow with default parameters.
|
DropShadow(BlurType blurType,
Color color,
double radius,
double spread,
double offsetX,
double offsetY)
Creates a new instance of DropShadow with the specified blurType, color,
radius, spread, offsetX and offsetY.
|
DropShadow(double radius,
Color color)
Creates a new instance of DropShadow with specified radius and color.
|
DropShadow(double radius,
double offsetX,
double offsetY,
Color color)
Creates a new instance of DropShadow with the specified radius, offsetX,
offsetY and color.
|
Modifier and Type | Method and Description |
---|---|
<any> |
blurTypeProperty()
The algorithm used to blur the shadow.
|
(package private) boolean |
checkChainContains(Effect e) |
<any> |
colorProperty()
The shadow
Color . |
(package private) Effect |
copy() |
(package private) com.sun.scenario.effect.DropShadow |
createPeer() |
BlurType |
getBlurType()
Gets the value of the property blurType.
|
private BlurType |
getBlurTypeInternal() |
(package private) BaseBounds |
getBounds(BaseBounds bounds,
BaseTransform tx,
Node node,
BoundsAccessor boundsAccessor)
Returns bounds of given node with applied effect.
|
private float |
getClampedHeight() |
private float |
getClampedSpread() |
private float |
getClampedWidth() |
Color |
getColor()
Gets the value of the property color.
|
private Color |
getColorInternal() |
double |
getHeight()
Gets the value of the property height.
|
Effect |
getInput()
Gets the value of the property input.
|
double |
getOffsetX()
Gets the value of the property offsetX.
|
double |
getOffsetY()
Gets the value of the property offsetY.
|
double |
getRadius()
Gets the value of the property radius.
|
double |
getSpread()
Gets the value of the property spread.
|
double |
getWidth()
Gets the value of the property width.
|
DoubleProperty |
heightProperty()
The vertical size of the shadow blur kernel.
|
<any> |
inputProperty()
The input for this
Effect . |
DoubleProperty |
offsetXProperty()
The shadow offset in the x direction, in pixels.
|
DoubleProperty |
offsetYProperty()
The shadow offset in the y direction, in pixels.
|
DoubleProperty |
radiusProperty()
The radius of the shadow blur kernel.
|
void |
setBlurType(BlurType value)
Sets the value of the property blurType.
|
void |
setColor(Color value)
Sets the value of the property color.
|
void |
setHeight(double value)
Sets the value of the property height.
|
void |
setInput(Effect value)
Sets the value of the property input.
|
void |
setOffsetX(double value)
Sets the value of the property offsetX.
|
void |
setOffsetY(double value)
Sets the value of the property offsetY.
|
void |
setRadius(double value)
Sets the value of the property radius.
|
void |
setSpread(double value)
Sets the value of the property spread.
|
void |
setWidth(double value)
Sets the value of the property width.
|
DoubleProperty |
spreadProperty()
The spread of the shadow.
|
(package private) void |
update() |
private void |
updateHeight(double value) |
private void |
updateRadius(double value) |
private void |
updateWidth(double value) |
DoubleProperty |
widthProperty()
The horizontal size of the shadow blur kernel.
|
containsCycles, effectBoundsChanged, getInputBounds, getKernelSize, getPeer, getShadowBounds, markDirty, sync, transformBounds
public final <any> 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 DoubleProperty radiusProperty
width
and height
attributes to a value of (2 * radius + 1)
.
Min: 0.0 Max: 127.0 Default: 10.0 Identity: 0.0
getRadius()
,
setRadius(double)
public final DoubleProperty widthProperty
1.0
are not distributed beyond the original
pixel and so have no blurring effect on the shadow.
Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0
getWidth()
,
setWidth(double)
public final DoubleProperty heightProperty
1.0
are not distributed beyond the original
pixel and so have no blurring effect on the shadow.
Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0
getHeight()
,
setHeight(double)
public final <any> blurTypeProperty
Min: n/a Max: n/a Default: BlurType.THREE_PASS_BOX Identity: n/a
getBlurType()
,
setBlurType(BlurType)
public final DoubleProperty spreadProperty
0.0
will result in a distribution of the
shadow determined entirely by the blur algorithm.
A spread of 1.0
will result in a solid growth outward of the
source material opacity to the limit of the radius with a very sharp
cutoff to transparency at the radius.
Min: 0.0 Max: 1.0 Default: 0.0 Identity: 0.0
getSpread()
,
setSpread(double)
public final <any> colorProperty
Color
.
Min: n/a Max: n/a Default: Color.BLACK Identity: n/a
getColor()
,
setColor(Color)
public final DoubleProperty offsetXProperty
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
getOffsetX()
,
setOffsetX(double)
public final DoubleProperty offsetYProperty
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
getOffsetY()
,
setOffsetY(double)
private boolean changeIsLocal
private <any> input
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.private DoubleProperty radius
width
and height
attributes to a value of (2 * radius + 1)
.
Min: 0.0 Max: 127.0 Default: 10.0 Identity: 0.0
private DoubleProperty width
1.0
are not distributed beyond the original
pixel and so have no blurring effect on the shadow.
Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0
private DoubleProperty height
1.0
are not distributed beyond the original
pixel and so have no blurring effect on the shadow.
Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0
private <any> blurType
Min: n/a Max: n/a Default: BlurType.THREE_PASS_BOX Identity: n/a
private DoubleProperty spread
0.0
will result in a distribution of the
shadow determined entirely by the blur algorithm.
A spread of 1.0
will result in a solid growth outward of the
source material opacity to the limit of the radius with a very sharp
cutoff to transparency at the radius.
Min: 0.0 Max: 1.0 Default: 0.0 Identity: 0.0
private <any> color
Color
.
Min: n/a Max: n/a Default: Color.BLACK Identity: n/a
private DoubleProperty offsetX
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
private DoubleProperty offsetY
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
public DropShadow()
public DropShadow(double radius, Color color)
radius
- the radius of the shadow blur kernelcolor
- the shadow Color
public DropShadow(double radius, double offsetX, double offsetY, Color color)
radius
- the radius of the shadow blur kerneloffsetX
- the shadow offset in the x directionoffsetY
- the shadow offset in the y directioncolor
- the shadow Color
public DropShadow(BlurType blurType, Color color, double radius, double spread, double offsetX, double offsetY)
blurType
- the algorithm used to blur the shadowcolor
- the shadow Color
radius
- the radius of the shadow blur kernelspread
- the portion of the radius where the contribution of
the source material will be 100%offsetX
- the shadow offset in the x directionoffsetY
- the shadow offset in the y directioncom.sun.scenario.effect.DropShadow createPeer()
createPeer
in class Effect
public final void setInput(Effect value)
public final Effect getInput()
public final <any> 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)
boolean checkChainContains(Effect e)
checkChainContains
in class Effect
public final void setRadius(double value)
public final double getRadius()
public final DoubleProperty radiusProperty()
width
and height
attributes to a value of (2 * radius + 1)
.
Min: 0.0 Max: 127.0 Default: 10.0 Identity: 0.0
getRadius()
,
setRadius(double)
private void updateRadius(double value)
public final void setWidth(double value)
public final double getWidth()
public final DoubleProperty widthProperty()
1.0
are not distributed beyond the original
pixel and so have no blurring effect on the shadow.
Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0
getWidth()
,
setWidth(double)
private void updateWidth(double value)
public final void setHeight(double value)
public final double getHeight()
public final DoubleProperty heightProperty()
1.0
are not distributed beyond the original
pixel and so have no blurring effect on the shadow.
Min: 0.0 Max: 255.0 Default: 21.0 Identity: <1.0
getHeight()
,
setHeight(double)
private void updateHeight(double value)
public final void setBlurType(BlurType value)
public final BlurType getBlurType()
public final <any> blurTypeProperty()
Min: n/a Max: n/a Default: BlurType.THREE_PASS_BOX Identity: n/a
getBlurType()
,
setBlurType(BlurType)
public final void setSpread(double value)
public final double getSpread()
public final DoubleProperty spreadProperty()
0.0
will result in a distribution of the
shadow determined entirely by the blur algorithm.
A spread of 1.0
will result in a solid growth outward of the
source material opacity to the limit of the radius with a very sharp
cutoff to transparency at the radius.
Min: 0.0 Max: 1.0 Default: 0.0 Identity: 0.0
getSpread()
,
setSpread(double)
public final void setColor(Color value)
public final Color getColor()
public final <any> colorProperty()
Color
.
Min: n/a Max: n/a Default: Color.BLACK Identity: n/a
getColor()
,
setColor(Color)
public final void setOffsetX(double value)
public final double getOffsetX()
public final DoubleProperty offsetXProperty()
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
getOffsetX()
,
setOffsetX(double)
public final void setOffsetY(double value)
public final double getOffsetY()
public final DoubleProperty offsetYProperty()
Min: n/a Max: n/a Default: 0.0 Identity: 0.0
getOffsetY()
,
setOffsetY(double)
private float getClampedWidth()
private float getClampedHeight()
private float getClampedSpread()
private Color getColorInternal()
private BlurType getBlurTypeInternal()
BaseBounds getBounds(BaseBounds bounds, BaseTransform tx, Node node, BoundsAccessor boundsAccessor)
Effect