diff options
author | Peter Hancock <phancock@apache.org> | 2012-06-29 11:22:42 +0000 |
---|---|---|
committer | Peter Hancock <phancock@apache.org> | 2012-06-29 11:22:42 +0000 |
commit | 3e31e071ea47f37ef7f8749b324dfdfe76745d18 (patch) | |
tree | 7d3b646c521349634592b62556a8832ec082cc9c /src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java | |
parent | ae8a5035235e1262e412e1eacd0eb3adfaef83ef (diff) | |
parent | 015538e0f11f031e3d7bd05db8c29e2a40365678 (diff) | |
download | xmlgraphics-fop-3e31e071ea47f37ef7f8749b324dfdfe76745d18.tar.gz xmlgraphics-fop-3e31e071ea47f37ef7f8749b324dfdfe76745d18.zip |
Merged trunk@1354651
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_RoundedCorners@1355321 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java')
-rw-r--r-- | src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java | 59 |
1 files changed, 43 insertions, 16 deletions
diff --git a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java index ca907eb0d..9651cf446 100644 --- a/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java +++ b/src/java/org/apache/fop/render/intermediate/AbstractIFPainter.java @@ -46,6 +46,7 @@ import org.apache.xmlgraphics.image.loader.util.ImageUtil; import org.apache.fop.ResourceEventProducer; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FopFactory; +import org.apache.fop.fo.Constants; import org.apache.fop.render.ImageHandler; import org.apache.fop.render.ImageHandlerRegistry; import org.apache.fop.render.ImageHandlerUtil; @@ -314,34 +315,60 @@ public abstract class AbstractIFPainter implements IFPainter { } /** {@inheritDoc} */ - public void drawBorderRect(Rectangle rect, BorderProps before, BorderProps after, - BorderProps start, BorderProps end, Color innerBackgroundColor) throws IFException { - if (before != null) { + public void drawBorderRect(Rectangle rect, BorderProps top, BorderProps bottom, + BorderProps left, BorderProps right, Color innerBackgroundColor) throws IFException { + if (top != null) { Rectangle b = new Rectangle( rect.x, rect.y, - rect.width, before.width); - fillRect(b, before.color); + rect.width, top.width); + fillRect(b, top.color); } - if (end != null) { + if (right != null) { Rectangle b = new Rectangle( - rect.x + rect.width - end.width, rect.y, - end.width, rect.height); - fillRect(b, end.color); + rect.x + rect.width - right.width, rect.y, + right.width, rect.height); + fillRect(b, right.color); } - if (after != null) { + if (bottom != null) { Rectangle b = new Rectangle( - rect.x, rect.y + rect.height - after.width, - rect.width, after.width); - fillRect(b, after.color); + rect.x, rect.y + rect.height - bottom.width, + rect.width, bottom.width); + fillRect(b, bottom.color); } - if (start != null) { + if (left != null) { Rectangle b = new Rectangle( rect.x, rect.y, - start.width, rect.height); - fillRect(b, start.color); + left.width, rect.height); + fillRect(b, left.color); } } + /** + * Indicates whether the given border segments (if present) have only solid borders, i.e. + * could be painted in a simplified fashion keeping the output file smaller. + * @param top the border segment on the top edge + * @param bottom the border segment on the bottom edge + * @param left the border segment on the left edge + * @param right the border segment on the right edge + * @return true if any border segment has a non-solid border style + */ + protected boolean hasOnlySolidBorders(BorderProps top, BorderProps bottom, + BorderProps left, BorderProps right) { + if (top != null && top.style != Constants.EN_SOLID) { + return false; + } + if (bottom != null && bottom.style != Constants.EN_SOLID) { + return false; + } + if (left != null && left.style != Constants.EN_SOLID) { + return false; + } + if (right != null && right.style != Constants.EN_SOLID) { + return false; + } + return true; + } + /** {@inheritDoc} */ public void drawLine(Point start, Point end, int width, Color color, RuleStyle style) throws IFException { |