public class ShadowFormat
extends java.lang.Object
To learn more, visit the Working with Graphic Elements documentation article.
Examples:
Shows how to get shadow color.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();
Assert.assertEquals(Color.RED.getRGB(), shadowFormat.getColor().getRGB());
Assert.assertEquals(ShadowType.SHADOW_MIXED, shadowFormat.getType());
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears shadow format.
|
java.awt.Color |
getColor()
Gets a
Color object that represents the color for the shadow. |
double |
getTransparency()
Gets the degree of transparency for the shadow effect as a value between 0.0 (opaque) and 1.0 (clear).
|
int |
getType()
Gets the specified
ShadowType for ShadowFormat. |
boolean |
getVisible()
Returns
true if the formatting applied to this instance is visible. |
void |
setColor(java.awt.Color value)
Sets a
Color object that represents the color for the shadow. |
void |
setTransparency(double value)
Sets the degree of transparency for the shadow effect as a value between 0.0 (opaque) and 1.0 (clear).
|
void |
setType(int value)
Sets the specified
ShadowType for ShadowFormat. |
public void clear()
Examples:
Shows how to work with a shadow formatting for the shape.
Document doc = new Document(getMyDir() + "Shape stroke pattern border.docx");
Shape shape = (Shape)doc.getChildNodes(NodeType.SHAPE, true).get(0);
if (shape.getShadowFormat().getVisible() && shape.getShadowFormat().getType() == ShadowType.SHADOW_2)
shape.getShadowFormat().setType(ShadowType.SHADOW_7);
if (shape.getShadowFormat().getType() == ShadowType.SHADOW_MIXED)
shape.getShadowFormat().clear();
public int getType()
ShadowType for ShadowFormat.
Remarks:
Setting a new shadow type will reset Color and Transparency values to their default ones. Therefore, it makes sense to first set the desired shadow type and only then Color and Transparency values.
Examples:
Shows how to get shadow color.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();
Assert.assertEquals(Color.RED.getRGB(), shadowFormat.getColor().getRGB());
Assert.assertEquals(ShadowType.SHADOW_MIXED, shadowFormat.getType());
ShadowType for ShadowFormat. The returned value is one of ShadowType constants.public void setType(int value)
ShadowType for ShadowFormat.
Remarks:
Setting a new shadow type will reset Color and Transparency values to their default ones. Therefore, it makes sense to first set the desired shadow type and only then Color and Transparency values.
Examples:
Shows how to get shadow color.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();
Assert.assertEquals(Color.RED.getRGB(), shadowFormat.getColor().getRGB());
Assert.assertEquals(ShadowType.SHADOW_MIXED, shadowFormat.getType());
value - The specified ShadowType for ShadowFormat. The value must be one of ShadowType constants.public boolean getVisible()
true if the formatting applied to this instance is visible.
Remarks:
Unlike clear(), assigning false to Visible does not clear the formatting, it only hides the shape effect.
Examples:
Shows how to work with a shadow formatting for the shape.
Document doc = new Document(getMyDir() + "Shape stroke pattern border.docx");
Shape shape = (Shape)doc.getChildNodes(NodeType.SHAPE, true).get(0);
if (shape.getShadowFormat().getVisible() && shape.getShadowFormat().getType() == ShadowType.SHADOW_2)
shape.getShadowFormat().setType(ShadowType.SHADOW_7);
if (shape.getShadowFormat().getType() == ShadowType.SHADOW_MIXED)
shape.getShadowFormat().clear();
true if the formatting applied to this instance is visible.public java.awt.Color getColor()
Color object that represents the color for the shadow. The default value is java.awt.Color#getBlack().
Examples:
Shows how to get shadow color.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();
Assert.assertEquals(Color.RED.getRGB(), shadowFormat.getColor().getRGB());
Assert.assertEquals(ShadowType.SHADOW_MIXED, shadowFormat.getType());
Shows how to set a color with transparency.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();
shadowFormat.setType(ShadowType.SHADOW_21);
shadowFormat.setColor(Color.RED);
shadowFormat.setTransparency(0.8);
doc.save(getArtifactsDir() + "Shape.ShadowFormatTransparency.docx");
Color object that represents the color for the shadow.public void setColor(java.awt.Color value)
Color object that represents the color for the shadow. The default value is java.awt.Color#getBlack().
Examples:
Shows how to get shadow color.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();
Assert.assertEquals(Color.RED.getRGB(), shadowFormat.getColor().getRGB());
Assert.assertEquals(ShadowType.SHADOW_MIXED, shadowFormat.getType());
Shows how to set a color with transparency.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();
shadowFormat.setType(ShadowType.SHADOW_21);
shadowFormat.setColor(Color.RED);
shadowFormat.setTransparency(0.8);
doc.save(getArtifactsDir() + "Shape.ShadowFormatTransparency.docx");
value - A Color object that represents the color for the shadow.public double getTransparency()
Examples:
Shows how to set a color with transparency.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();
shadowFormat.setType(ShadowType.SHADOW_21);
shadowFormat.setColor(Color.RED);
shadowFormat.setTransparency(0.8);
doc.save(getArtifactsDir() + "Shape.ShadowFormatTransparency.docx");
public void setTransparency(double value)
Examples:
Shows how to set a color with transparency.
Document doc = new Document(getMyDir() + "Shadow color.docx");
Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
ShadowFormat shadowFormat = shape.getShadowFormat();
shadowFormat.setType(ShadowType.SHADOW_21);
shadowFormat.setColor(Color.RED);
shadowFormat.setTransparency(0.8);
doc.save(getArtifactsDir() + "Shape.ShadowFormatTransparency.docx");
value - The degree of transparency for the shadow effect as a value between 0.0 (opaque) and 1.0 (clear).