aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/util
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-08-14 13:37:33 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-08-14 13:37:33 +0000
commit39f5b053cc82f71efa6014c36c0de2f36534bd19 (patch)
treedb7e342c32dea5c7dcbba7258b110c60578fc8f3 /src/java/org/apache/fop/util
parent427e2d22a628b77cce5e7c22b32610b5ff23d8b2 (diff)
downloadxmlgraphics-fop-39f5b053cc82f71efa6014c36c0de2f36534bd19.tar.gz
xmlgraphics-fop-39f5b053cc82f71efa6014c36c0de2f36534bd19.zip
Merged revisions 685573,685785,685879,685885 via svnmerge from
https://svn.eu.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r685573 | jeremias | 2008-08-13 15:34:03 +0100 (Wed, 13 Aug 2008) | 1 line Fixed border trait parsing for the area tree XML when CMYK or ICC colors were used. ........ r685785 | jeremias | 2008-08-14 07:32:52 +0100 (Thu, 14 Aug 2008) | 1 line Removed three unused classes in the traits package. ........ r685879 | jeremias | 2008-08-14 14:03:20 +0100 (Thu, 14 Aug 2008) | 2 lines Fixed the source for a NullPointerException when the content of an fo:leader with leader-pattern="use-content" collapses to zero width during layout. ........ r685885 | acumiskey | 2008-08-14 14:25:54 +0100 (Thu, 14 Aug 2008) | 1 line Moved static method lightenColor() from PrintRenderer to ColorUtil. Thats one less Renderer interface dependency to worry about :). ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@685891 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/util')
-rw-r--r--src/java/org/apache/fop/util/ColorUtil.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/util/ColorUtil.java b/src/java/org/apache/fop/util/ColorUtil.java
index b85b0c017..9534bfba3 100644
--- a/src/java/org/apache/fop/util/ColorUtil.java
+++ b/src/java/org/apache/fop/util/ColorUtil.java
@@ -658,4 +658,27 @@ public final class ColorUtil {
colorMap.put("transparent", new Color(0, 0, 0, 0));
}
+ /**
+ * Lightens up a color for groove, ridge, inset and outset border effects.
+ * @param col the color to lighten up
+ * @param factor factor by which to lighten up (negative values darken the color)
+ * @return the modified color
+ */
+ public static Color lightenColor(Color col, float factor) {
+ // TODO: This function converts the color into the sRGB namespace.
+ // This should be avoided if possible.
+ float[] cols = new float[4];
+ cols = col.getRGBComponents(cols);
+ if (factor > 0) {
+ cols[0] += (1.0 - cols[0]) * factor;
+ cols[1] += (1.0 - cols[1]) * factor;
+ cols[2] += (1.0 - cols[2]) * factor;
+ } else {
+ cols[0] -= cols[0] * -factor;
+ cols[1] -= cols[1] * -factor;
+ cols[2] -= cols[2] * -factor;
+ }
+ return new Color(cols[0], cols[1], cols[2], cols[3]);
+ }
+
}