KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > format > RGB


1 /*********************************************************************
2 *
3 * Copyright (C) 2005 Andrew Khan
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***************************************************************************/

19
20
21 package jxl.format;
22
23 /**
24  * A structure which contains the RGB values for a particular colour
25  */

26 public final class RGB
27 {
28   /**
29    * The red component of this colour
30    */

31   private int red;
32
33   /**
34    * The green component of this colour
35    */

36   private int green;
37
38   /**
39    * The blue component of this colour
40    */

41   private int blue;
42
43   /**
44    * Constructor
45    *
46    * @param r the red component
47    * @param g the green component
48    * @param b the blue component
49    */

50   public RGB(int r, int g, int b)
51   {
52     red = r;
53     green = g;
54     blue = b;
55   }
56
57   /**
58    * Accessor for the red component
59    *
60    * @return the red component of the colour, between 0 and 255
61    */

62   public int getRed()
63   {
64     return red;
65   }
66
67   /**
68    * Accessor for the green component
69    *
70    * @return the green component of the colour, between 0 and 255
71    */

72   public int getGreen()
73   {
74     return green;
75   }
76
77   /**
78    * Accessor for the blue component
79    *
80    * @return the blue component of the colour, between 0 and 255
81    */

82   public int getBlue()
83   {
84     return blue;
85   }
86 }
87
88
Popular Tags