KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
30   Color value [PDF:1.6:4.5.1].
31 */

32 public abstract class Color
33 {
34   // <class>
35
// <static>
36
// <interface>
37
// <protected>
38
/**
39     Gets the normalized value of a color component [PDF:1.6:4.5.1].
40     @param value Color component value to normalize.
41     @return Normalized color component value.
42   */

43   /*
44     NOTE: Further developments may result in a color-space family-specific
45     implementation of this method; currently this implementation focuses on
46     device colors only.
47   */

48   protected static double normalizeComponent(
49     double value
50     )
51   {
52     // <validation>
53
if(value < 0)
54       return 0d;
55     else if(value > 1)
56       return 1d;
57     // </validation>
58

59     return value;
60   }
61   // </protected>
62
// </interface>
63
// </static>
64

65   // <dynamic>
66
// <constructors>
67
protected Color(
68     )
69   {}
70   // </constructors>
71

72   // <interface>
73
// <internal>
74
/**
75     Gets the nonstroking operator associated to the color value [PDF:1.6:4.5.2].
76     <h3>Remarks</h3>
77     <p>For internal use only.</p>
78     @return Nonstroking operator.
79   */

80   public String JavaDoc getFillOperator(
81     )
82   {return "sc";}
83
84   /**
85     Gets the stroking operator associated to the color value [PDF:1.6:4.5.2].
86     <h3>Remarks</h3>
87     <p>For internal use only.</p>
88     @return Stroking operator.
89   */

90   public String JavaDoc getStrokeOperator(
91     )
92   {return "SC";}
93
94   /**
95     Gets the PDF representation of the color value.
96     <h3>Remarks</h3>
97     <p>For internal use only.</p>
98     @return PDF representation.
99   */

100   public abstract String JavaDoc toPdf(
101     );
102   // </internal>
103
// </interface>
104
// </dynamic>
105
// </class>
106
}
Popular Tags