KickJava   Java API By Example, From Geeks To Geeks.

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


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 Cyan-Magenta-Yellow-Key color value [PDF:1.6:4.5.3].
33   <h3>Remarks</h3>
34   <p>The 'Key' component is renamed 'Black' to avoid semantic ambiguities.</p>
35 */

36 public class DeviceCMYKColor
37   extends DeviceColor
38 {
39   // <class>
40
// <dynamic>
41
// <fields>
42
private double cyan;
43   private double magenta;
44   private double yellow;
45   private double black;
46   // </fields>
47

48   // <constructors>
49
public DeviceCMYKColor(
50     double cyan,
51     double magenta,
52     double yellow,
53     double black
54     )
55   {
56     setCyan(cyan);
57     setMagenta(magenta);
58     setYellow(yellow);
59     setBlack(black);
60   }
61   // </constructors>
62

63   // <interface>
64
// <public>
65
/**
66     Gets the black (key) component.
67   */

68   public double getBlack(
69     )
70   {return black;}
71
72   /**
73     Gets the cyan component.
74   */

75   public double getCyan(
76     )
77   {return cyan;}
78
79   /**
80     Gets the magenta component.
81   */

82   public double getMagenta(
83     )
84   {return magenta;}
85
86   /**
87     Gets the yellow component.
88   */

89   public double getYellow(
90     )
91   {return yellow;}
92
93   /**
94     Sets the black (key) component.
95   */

96   public void setBlack(
97     double value
98     )
99   {black = normalizeComponent(value);}
100
101   /**
102     Sets the cyan component.
103   */

104   public void setCyan(
105     double value
106     )
107   {cyan = normalizeComponent(value);}
108
109   /**
110     Sets the magenta component.
111   */

112   public void setMagenta(
113     double value
114     )
115   {magenta = normalizeComponent(value);}
116
117   /**
118     Sets the yellow component.
119   */

120   public void setYellow(
121     double value
122     )
123   {yellow = normalizeComponent(value);}
124   // </public>
125

126   // <internal>
127
public String JavaDoc getFillOperator(
128     )
129   {return "k";}
130
131   public String JavaDoc getStrokeOperator(
132     )
133   {return "K";}
134
135   public String JavaDoc toPdf(
136     )
137   {
138     return (
139       PdfReal.toPdf(cyan) + " "
140         + PdfReal.toPdf(magenta) + " "
141         + PdfReal.toPdf(yellow) + " "
142         + PdfReal.toPdf(black)
143       );
144   }
145   // </internal>
146
// </interface>
147
// </dynamic>
148
// </class>
149
}
Popular Tags