aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache
diff options
context:
space:
mode:
authorKaren Lease <klease@apache.org>2000-11-12 22:18:17 +0000
committerKaren Lease <klease@apache.org>2000-11-12 22:18:17 +0000
commitdb27c3c230df38e6f5cc6119deb9e490d7c6f495 (patch)
tree9f920ce4258ef42ed740ee4b2004a157faf3472d /src/org/apache
parent43e6d6469d855491a7f8cf2fba808ec983245753 (diff)
downloadxmlgraphics-fop-db27c3c230df38e6f5cc6119deb9e490d7c6f495.tar.gz
xmlgraphics-fop-db27c3c230df38e6f5cc6119deb9e490d7c6f495.zip
Put the handling of rgb(..) back for SVG style property
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193793 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache')
-rw-r--r--src/org/apache/fop/datatypes/ColorType.java41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/org/apache/fop/datatypes/ColorType.java b/src/org/apache/fop/datatypes/ColorType.java
index 14cfd0faa..e2e8c4817 100644
--- a/src/org/apache/fop/datatypes/ColorType.java
+++ b/src/org/apache/fop/datatypes/ColorType.java
@@ -105,8 +105,45 @@ public class ColorType {
this.blue = 0;
MessageHandler.errorln("ERROR: unknown colour format. Must be #RGB or #RRGGBB");
}
- }
- else if (value.startsWith("url(")) {
+ } else if (value.startsWith("rgb(")) {
+ int poss = value.indexOf("(");
+ int pose = value.indexOf(")");
+ if(poss != -1 && pose != -1) {
+ value = value.substring(poss + 1, pose);
+ StringTokenizer st = new StringTokenizer(value, ",");
+ try {
+ if(st.hasMoreTokens()) {
+ String str = st.nextToken().trim();
+ if(str.endsWith("%")) {
+ this.red = Integer.parseInt(str.substring(0, str.length() - 1)) * 2.55f;
+ } else {
+ this.red = Integer.parseInt(str)/255f;
+ }
+ }
+ if(st.hasMoreTokens()) {
+ String str = st.nextToken().trim();
+ if(str.endsWith("%")) {
+ this.green = Integer.parseInt(str.substring(0, str.length() - 1)) * 2.55f;
+ } else {
+ this.green = Integer.parseInt(str)/255f;
+ }
+ }
+ if(st.hasMoreTokens()) {
+ String str = st.nextToken().trim();
+ if(str.endsWith("%")) {
+ this.blue = Integer.parseInt(str.substring(0, str.length() - 1)) * 2.55f;
+ } else {
+ this.blue = Integer.parseInt(str)/255f;
+ }
+ }
+ } catch (Exception e) {
+ this.red = 0;
+ this.green = 0;
+ this.blue = 0;
+ MessageHandler.errorln("ERROR: unknown colour format. Must be #RGB or #RRGGBB");
+ }
+ }
+ } else if (value.startsWith("url(")) {
// refers to a gradient
} else {
if (value.toLowerCase().equals("transparent")) {