aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java')
-rw-r--r--src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java
index 8838fa3e41..70d42ce5c3 100644
--- a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java
+++ b/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShadow.java
@@ -19,8 +19,11 @@ package org.apache.poi.xslf.usermodel;
import org.apache.poi.util.Units;
import org.openxmlformats.schemas.drawingml.x2006.main.CTOuterShadowEffect;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Shape;
import java.awt.geom.Rectangle2D;
/**
@@ -37,36 +40,44 @@ public class XSLFShadow extends XSLFSimpleShape {
_parent = parentShape;
}
- @Override
- public void draw(Graphics2D graphics) {
- Shape outline = _parent.getOutline();
- Paint parentFillColor = _parent.getFill(graphics);
- Paint parentLineColor = _parent.getLinePaint(graphics);
+ public void fill(Graphics2D graphics, Shape outline) {
double angle = getAngle();
double dist = getDistance();
- double dx = dist * Math.cos( Math.toRadians(angle));
- double dy = dist * Math.sin( Math.toRadians(angle));
+ double dx = dist * Math.cos(Math.toRadians(angle));
+ double dy = dist * Math.sin(Math.toRadians(angle));
graphics.translate(dx, dy);
Color fillColor = getFillColor();
if (fillColor != null) {
graphics.setColor(fillColor);
+ graphics.fill(outline);
}
- if(parentFillColor != null) {
- graphics.fill(outline);
- }
- if(parentLineColor != null) {
- _parent.applyStroke(graphics);
- graphics.draw(outline);
- }
+ graphics.translate(-dx, -dy);
+ }
+
+ public void draw(Graphics2D graphics, Shape outline) {
+
+ double angle = getAngle();
+ double dist = getDistance();
+ double dx = dist * Math.cos(Math.toRadians(angle));
+ double dy = dist * Math.sin(Math.toRadians(angle));
+
+ graphics.translate(dx, dy);
+
+ Color fillColor = getFillColor();
+ if (fillColor != null) {
+ graphics.setColor(fillColor);
+ graphics.draw(outline);
+ }
graphics.translate(-dx, -dy);
}
+
@Override
public Rectangle2D getAnchor(){
return _parent.getAnchor();
@@ -112,6 +123,11 @@ public class XSLFShadow extends XSLFSimpleShape {
public Color getFillColor() {
XSLFTheme theme = getSheet().getTheme();
CTOuterShadowEffect ct = (CTOuterShadowEffect)getXmlObject();
- return ct == null ? null : new XSLFColor(ct, theme).getColor();
+ if(ct == null) {
+ return null;
+ } else {
+ CTSchemeColor phClr = ct.getSchemeClr();
+ return new XSLFColor(ct, theme, phClr).getColor();
+ }
}
} \ No newline at end of file