KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > stefanochizzolini > clown > documents > contents > colorSpaces > DeviceRGBColor


1 /*
2   Copyright 2006 Stefano Chizzolini. http://clown.stefanochizzolini.it
3
4   Contributors:
5     * Stefano Chizzolini (original code developer, info@stefanochizzolini.it):
6       contributed code is Copyright 2006 by Stefano Chizzolini.
7
8   This file should be part of the source code distribution of "PDF Clown library"
9   (the Program): see the accompanying README files for more info.
10
11   This Program is free software; you can redistribute it and/or modify it under
12   the terms of the GNU General Public License as published by the Free Software
13   Foundation; either version 2 of the License, or (at your option) any later version.
14
15   This Program is distributed in the hope that it will be useful, but WITHOUT ANY
16   WARRANTY, either expressed or implied; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more details.
18
19   You should have received a copy of the GNU General Public License along with this
20   Program (see README files); if not, go to the GNU website (http://www.gnu.org/).
21
22   Redistribution and use, with or without modification, are permitted provided that such
23   redistributions retain the above copyright notice, license and disclaimer, along with
24   this list of conditions.
25 */

26
27 package it.stefanochizzolini.clown.documents.contents.colorSpaces;
28
29 import it.stefanochizzolini.clown.objects.PdfReal;
30
31 /**
32   Device Red-Green-Blue color value [PDF:1.6:4.5.3].
33 */

34 public class DeviceRGBColor
35   extends DeviceColor
36 {
37   // <class>
38
// <dynamic>
39
// <fields>
40
private double blue;
41   private double green;
42   private double red;
43   // </fields>
44

45   // <constructors>
46
public DeviceRGBColor(
47     double red,
48     double green,
49     double blue
50     )
51   {
52     setRed(red);
53     setGreen(green);
54     setBlue(blue);
55   }
56   // </constructors>
57

58   // <interface>
59
// <public>
60
/**
61     Gets the blue component.
62   */

63   public double getBlue(
64     )
65   {return blue;}
66
67   /**
68     Gets the green component.
69   */

70   public double getGreen(
71     )
72   {return green;}
73
74   /**
75     Gets the red component.
76   */

77   public double getRed(
78     )
79   {return red;}
80
81   /**
82     Sets the blue component.
83   */

84   public void setBlue(
85     double value
86     )
87   {blue = normalizeComponent(value);}
88
89   /**
90     Sets the green component.
91   */

92   public void setGreen(
93     double value
94     )
95   {green = normalizeComponent(value);}
96
97   /**
98     Sets the red component.
99   */

100   public void setRed(
101     double value
102     )
103   {red = normalizeComponent(value);}
104   // </public>
105

106   // <internal>
107
public String JavaDoc getFillOperator(
108     )
109   {return "rg";}
110
111   public String JavaDoc getStrokeOperator(
112     )
113   {return "RG";}
114
115   public String JavaDoc toPdf(
116     )
117   {
118     return (
119       PdfReal.toPdf(red) + " "
120         + PdfReal.toPdf(green) + " "
121         + PdfReal.toPdf(blue)
122       );
123   }
124   // </internal>
125
// </interface>
126
// </dynamic>
127
// </class>
128
}
Popular Tags