]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Add support for RGB colors with 0-255 components
authoreschaeffer <eschaeffer@unknown>
Mon, 29 May 2000 09:20:01 +0000 (09:20 +0000)
committereschaeffer <eschaeffer@unknown>
Mon, 29 May 2000 09:20:01 +0000 (09:20 +0000)
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

index 73c07d46493ac3e22bd5207a9460ed222bd1bc9f..d0e918fbc3dbf5bca55ea740551d9b9941f43fa7 100644 (file)
@@ -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);