From 108439d398a2a2f09e0374aec3e5621428c70ab6 Mon Sep 17 00:00:00 2001 From: eschaeffer Date: Mon, 29 May 2000 09:20:01 +0000 Subject: [PATCH] Add support for RGB colors with 0-255 components git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193387 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/pdf/PDFColor.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/org/apache/fop/pdf/PDFColor.java b/src/org/apache/fop/pdf/PDFColor.java index 73c07d464..d0e918fbc 100644 --- a/src/org/apache/fop/pdf/PDFColor.java +++ b/src/org/apache/fop/pdf/PDFColor.java @@ -91,6 +91,11 @@ public class PDFColor extends PDFPathPaint { this.blue = theBlue; } + // components from 0 to 255 + public PDFColor(int theRed, int theGreen, int theBlue) { + this(((double) theRed) / 255d * 2d - 1d, ((double) theGreen) / 255d * 2d - 1d, ((double) theBlue) / 255d * 2d - 1d); + } + public PDFColor(double theCyan, double theMagenta, double theYellow, double theBlack) { //super(theNumber);//? @@ -139,6 +144,18 @@ public class PDFColor extends PDFPathPaint { { return(this.blue); } + public int red255() + { + return (int) ((this.red + 1d) / 2d * 255d); + } + public int green255() + { + return (int) ((this.green + 1d) / 2d * 255d); + } + public int blue255() + { + return (int) ((this.blue + 1d) / 2d * 255d); + } public double cyan() { return(this.cyan); -- 2.39.5