ripta-color-tools 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d0671d2f6ffbb0a65f9a38f2bebe37a9ac462c4d
4
+ data.tar.gz: 985a016475aab3b0a0f4e941c6977eda55afa6e2
5
+ SHA512:
6
+ metadata.gz: 158256c3e29dcff40f383abcdaa301f0f6e546012a2b9484db1383f3fb8a1b01954d3297b54eebbd019acc7f0f75a2e14a41a20d1113d762a2e1976e66950f58
7
+ data.tar.gz: 26e2308403b9ed12f4ddc1396121825af1110099913f9d516fde59337f1e5bc53e075285b21a2703c9469a050ecdc46d47540e55a38b226177ee139deddc3749
data/Changelog ADDED
@@ -0,0 +1,55 @@
1
+ = color-tools Change Log
2
+
3
+ == color-utils 1.4.0
4
+ * Use autoloading for various parts of the library. Now simply require "color"
5
+ and other modules/classes will be required for you when you use them for the
6
+ first time.
7
+
8
+ == color-utils 1.3.0
9
+ * Added new metallic colours suggested by Jim Freeze <jfn@freeze.org>. These
10
+ are in the namespace Color::Metallic.
11
+ * Colours that were defined in the Color namespace (e.g., Color::Red,
12
+ Color::AliceBlue) are now defined in Color::RGB (e.g., Color::RGB::Red,
13
+ Color::RGB::AliceBlue). They are added back to the Color namespace on the
14
+ first use of the old colours and a warning is printed. In version 1.4, this
15
+ warning will be printed on every use of the old colours. In version 1.5,
16
+ the backwards compatible support for colours like Color::Red will be
17
+ removed completely.
18
+ * Added the Color::CSS module, color/css or Color::CSS that provides a name
19
+ lookup of Color::RGB-namespaced constants with Color::CSS[name]. Most of
20
+ these colours (which are mirrored from the Color::RGB default colours) are
21
+ only "officially" recognised under the CSS3 colour module or SVG.
22
+ * Added the Color::HSL colour space and some helper utilities to Color::RGB
23
+ for colour manipulation using the HSL value.
24
+ * Controlled internal value replacement to be between 0 and 1 for all
25
+ colours.
26
+ * Updated Color::Palette::Gimp to more meaningfully deal with duplicate named
27
+ colours. Named colours now return an array of colours.
28
+ * Indicated the plans for some methods and constants out to color-tools 2.0.
29
+ * Added unit tests and fixed a number of hidden bugs because of them.
30
+
31
+ == color-utils 1.2.0
32
+ * Changed installer from a custom-written install.rb to setup.rb
33
+ 3.3.1-modified.
34
+ * Added Color::GreyScale (or Color::GrayScale).
35
+ * Added Color::YIQ. This colour definition is incomplete; it does not have
36
+ conversions from YIQ to other colour spaces.
37
+
38
+ == color-utils 1.1.0
39
+ * Added color/palette/gimp to support the reading and use of GIMP color
40
+ palettes.
41
+
42
+ == color-utils 1.0.0
43
+ * Initial release.
44
+
45
+ #--
46
+ # Colour management with Ruby.
47
+ #
48
+ # Copyright 2005 Austin Ziegler
49
+ # http://rubyforge.org/ruby-pdf/
50
+ #
51
+ # Licensed under a MIT-style licence.
52
+ #
53
+ # $Id$
54
+ #++
55
+ # vim: sts=2 sw=2 ts=4 et ai tw=77
data/Install ADDED
@@ -0,0 +1,18 @@
1
+ Installing this package is as simple as:
2
+
3
+ % ruby setup.rb
4
+
5
+ Alternatively, you can use the RubyGem version of color-tools available as
6
+ color-tools-1.3.0.gem from the usual sources.
7
+
8
+ #--
9
+ # Colour management with Ruby.
10
+ #
11
+ # Copyright 2005 Austin Ziegler
12
+ # http://rubyforge.org/ruby-pdf/
13
+ #
14
+ # Licensed under a MIT-style licence.
15
+ #
16
+ # $Id$
17
+ #++
18
+ # vim: sts=2 sw=2 ts=4 et ai tw=77
data/README.rdoc ADDED
@@ -0,0 +1,82 @@
1
+
2
+ color-tools is a Ruby library to provide RGB, CMYK, and other colourspace
3
+ support to applications that require it. It also provides 152 named RGB
4
+ colours. It offers 152 named RGB colours (184 with spelling variations)
5
+ that are commonly supported and used in HTML, SVG, and X11 applications. A
6
+ technique for generating a monochromatic contrasting palette is also
7
+ included.
8
+
9
+ Version 1.3 offers significant enhancements over color-tools 1.2, and a
10
+ plan for an incompatible change to the library.
11
+
12
+ * Colours that were defined in the Color namespace (e.g., Color::Red,
13
+ Color::AliceBlue) are now defined in Color::RGB (e.g., Color::RGB::Red,
14
+ Color::RGB::AliceBlue). They are added back to the Color namespace on
15
+ the first use of the old colours and a warning is printed. In version
16
+ 1.4, this warning will be printed on every use of the old colours. In
17
+ version 1.5, the backwards compatible support for colours like
18
+ Color::Red will be removed completely.
19
+
20
+ * A CSS colour name module has been added. It is based on the Color::RGB
21
+ predefined colours. It is called with "Color::CSS[color]". The provided
22
+ colour name will be looked up ignoring case so that "DarkSalmon" and
23
+ "darksalmon" (and :darksalmon) are the same value. This makes it easier
24
+ on web or SVG developers who wish to be able to manipulate a colour
25
+ based on a CSS colour name.
26
+
27
+ * A new predefined colour namespace has been added for RGB metallic
28
+ colours (Color::Metallic, in color/rgb/metallic), suggested by Jim
29
+ Freeze <jfn@freeze.org>.
30
+
31
+ * A new colour space, Color::HSL (hue, saturation, and luminosity) has
32
+ been added with some helper methods to Color::RGB for colour
33
+ manipulation.
34
+
35
+ * Added unit tests and fixed various little bugs.
36
+
37
+ == Copyright
38
+ Copyright 2005 by Austin Ziegler
39
+
40
+ Color::Palette was developed based on techniques described by Andy
41
+ "Malarkey" Clarke[1], implemented in JavaScript by Steve G. Chipman at
42
+ SlayerOffice[2] and by Patrick Fitzgerald of BarelyFitz[3] in PHP.
43
+
44
+ == Licence
45
+ Permission is hereby granted, free of charge, to any person obtaining a
46
+ copy of this software and associated documentation files (the "Soft-
47
+ ware"), to deal in the Software without restriction, including without
48
+ limitation the rights to use, copy, modify, merge, publish, distribute,
49
+ sublicense, and/or sell copies of the Software, and to permit persons to
50
+ whom the Software is furnished to do so, subject to the following
51
+ conditions:
52
+
53
+ * The names of its contributors may not be used to endorse or promote
54
+ products derived from this software without specific prior written
55
+ permission.
56
+
57
+ The above copyright notice and this permission notice shall be included in
58
+ all copies or substantial portions of the Software.
59
+
60
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
61
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
62
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
63
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
64
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
65
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
66
+ DEALINGS IN THE SOFTWARE.
67
+
68
+ [1] http://www.stuffandnonsense.co.uk/archives/creating_colour_palettes.html
69
+ [2] http://slayeroffice.com/tools/color_palette/
70
+ [3] http://www.barelyfitz.com/projects/csscolor/
71
+
72
+ #--
73
+ # Colour management with Ruby.
74
+ #
75
+ # Copyright 2005 Austin Ziegler
76
+ # http://rubyforge.org/ruby-pdf/
77
+ #
78
+ # Licensed under a MIT-style licence.
79
+ #
80
+ # $Id$
81
+ #++
82
+ # vim: sts=2 sw=2 ts=4 et ai tw=74
data/Rakefile ADDED
@@ -0,0 +1,123 @@
1
+ #! /usr/bin/env rake
2
+ #--
3
+ # Colour management with Ruby.
4
+ #
5
+ # Copyright 2005 Austin Ziegler
6
+ # http://rubyforge.org/ruby-pdf/
7
+ #
8
+ # Licensed under a MIT-style licence.
9
+ #
10
+ # $Id$
11
+ #++
12
+ # vim: sts=2 sw=2 ts=4 et ai tw=77
13
+
14
+ $LOAD_PATH.unshift('lib')
15
+
16
+ require 'rubygems'
17
+ require 'rubygems/package_task'
18
+ require 'color'
19
+
20
+ DISTDIR = "color-tools-#{Color::COLOR_TOOLS_VERSION}"
21
+ TARDIST = "../#{DISTDIR}.tar.gz"
22
+
23
+ DATE_RE = %r<(\d{4})[./-]?(\d{2})[./-]?(\d{2})(?:[\sT]?(\d{2})[:.]?(\d{2})[:.]?(\d{2})?)?>
24
+
25
+ if ENV['RELEASE_DATE']
26
+ year, month, day, hour, minute, second = DATE_RE.match(ENV['RELEASE_DATE']).captures
27
+ year ||= 0
28
+ month ||= 0
29
+ day ||= 0
30
+ hour ||= 0
31
+ minute ||= 0
32
+ second ||= 0
33
+ ReleaseDate = Time.mktime(year, month, day, hour, minute, second)
34
+ else
35
+ ReleaseDate = nil
36
+ end
37
+
38
+ task :test do |t|
39
+ require 'test/unit/testsuite'
40
+ require 'test/unit/ui/console/testrunner'
41
+
42
+ runner = Test::Unit::UI::Console::TestRunner
43
+
44
+ $LOAD_PATH.unshift('tests')
45
+ Dir['tests/test_*.rb'].each do |testcase|
46
+ load testcase
47
+ end
48
+
49
+ suite = Test::Unit::TestSuite.new("color-tools")
50
+
51
+ ObjectSpace.each_object(Class) do |testcase|
52
+ suite << testcase.suite if testcase < Test::Unit::TestCase
53
+ end
54
+
55
+ runner.run(suite)
56
+ end
57
+
58
+ spec = eval(File.read("color-tools.gemspec"))
59
+ spec.version = Color::COLOR_TOOLS_VERSION
60
+ desc "Build the RubyGem for color-tools"
61
+ task :gem => [ :test ]
62
+ Gem::PackageTask.new(spec) do |g|
63
+ g.need_tar = false
64
+ g.need_zip = false
65
+ g.package_dir = ".."
66
+ end
67
+
68
+ desc "Build a color-tools .tar.gz distribution."
69
+ task :tar => [ TARDIST ]
70
+ file TARDIST => [ :test ] do |t|
71
+ require 'archive/tar/minitar'
72
+ require 'zlib'
73
+ current = File.basename(Dir.pwd)
74
+ Dir.chdir("..") do
75
+ begin
76
+ files = Dir["#{current}/**/*"].select { |dd| dd !~ %r{(?:/CVS/?|~$)} }
77
+ files.map! do |dd|
78
+ ddnew = dd.gsub(/^#{current}/, DISTDIR)
79
+ mtime = ReleaseDate || File.stat(dd).mtime
80
+ if File.directory?(dd)
81
+ { :name => ddnew, :mode => 0755, :dir => true, :mtime => mtime }
82
+ else
83
+ if dd =~ %r{bin/}
84
+ mode = 0755
85
+ else
86
+ mode = 0644
87
+ end
88
+ data = File.open(dd, "rb") { |ff| ff.read }
89
+ { :name => ddnew, :mode => mode, :data => data, :size => data.size,
90
+ :mtime => mtime }
91
+ end
92
+ end
93
+
94
+ ff = File.open(t.name.gsub(%r{^\.\./}o, ''), "wb")
95
+ gz = Zlib::GzipWriter.new(ff)
96
+ tw = Archive::Tar::Minitar::Writer.new(gz)
97
+
98
+ files.each do |entry|
99
+ if entry[:dir]
100
+ tw.mkdir(entry[:name], entry)
101
+ else
102
+ tw.add_file_simple(entry[:name], entry) { |os| os.write(entry[:data]) }
103
+ end
104
+ end
105
+ ensure
106
+ tw.close if tw
107
+ gz.close if gz
108
+ end
109
+ end
110
+ end
111
+ task TARDIST => [ :test ]
112
+
113
+ desc "Build the rdoc documentation for color-tools"
114
+ task :docs do
115
+ require 'rdoc/rdoc'
116
+ rdoc_options = %w(--title color-tools --main README.rdoc --line-numbers)
117
+ files = FileList[*%w(README.rdoc Changelog bin/**/*.rb lib/**/*.rb)]
118
+ rdoc_options += files.to_a
119
+ RDoc::RDoc.new.document(rdoc_options)
120
+ end
121
+
122
+ desc "Build everything."
123
+ task :default => [ :tar, :gem ]
data/lib/color.rb ADDED
@@ -0,0 +1,78 @@
1
+ #--
2
+ # Colour management with Ruby.
3
+ #
4
+ # Copyright 2005 Austin Ziegler
5
+ # http://rubyforge.org/ruby-pdf/
6
+ #
7
+ # Licensed under a MIT-style licence.
8
+ #
9
+ # $Id$
10
+ #++
11
+
12
+ # = Colour Management with Ruby
13
+ #
14
+ # == Copyright
15
+ # Copyright 2005 by Austin Ziegler
16
+ #
17
+ # Color::RGB and Color::CMYK were originally developed for the Ruby PDF
18
+ # project and PDF::Writer and represent wholly unique code.
19
+ #
20
+ # Color::Palette was developed based on techniques described by Andy
21
+ # "Malarkey"[http://www.stuffandnonsense.co.uk/archives/creating_colour_palettes.html]
22
+ # Clarke, implemented in JavaScript by Steve G. Chipman at
23
+ # SlayerOffice[http://slayeroffice.com/tools/color_palette/] and by Patrick
24
+ # Fitzgerald of BarelyFitz[http://www.barelyfitz.com/projects/csscolor/] in
25
+ # PHP.
26
+ #
27
+ # == LICENCE
28
+ # Permission is hereby granted, free of charge, to any person obtaining a
29
+ # copy of this software and associated documentation files (the "Software"),
30
+ # to deal in the Software without restriction, including without limitation
31
+ # the rights to use, copy, modify, merge, publish, distribute, sublicense,
32
+ # and/or sell copies of the Software, and to permit persons to whom the
33
+ # Software is furnished to do so, subject to the following conditions:
34
+ #
35
+ # * The names of its contributors may not be used to endorse or promote
36
+ # products derived from this software without specific prior written
37
+ # permission.
38
+ #
39
+ # The above copyright notice and this permission notice shall be included in
40
+ # all copies or substantial portions of the Software.
41
+ #
42
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
45
+ # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
47
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
48
+ # DEALINGS IN THE SOFTWARE.
49
+ module Color
50
+
51
+ COLOR_TOOLS_VERSION = '1.3.0'
52
+
53
+ autoload :CMYK, "color/cmyk"
54
+ autoload :CSS, "color/css"
55
+ autoload :GrayScale, "color/grayscale"
56
+ autoload :GreyScale, "color/grayscale"
57
+ autoload :HSL, "color/hsl"
58
+ autoload :Palette, "color/palette"
59
+ autoload :RGB, "color/rgb"
60
+ autoload :YIQ, "color/yiq"
61
+
62
+ def self.const_missing(name) #:nodoc:
63
+ if Color::RGB.const_defined?(name)
64
+ warn "These colour constants have been deprecated. Use Color::RGB::#{name} instead."
65
+ Color::RGB.constants.each do |const|
66
+ color = Color::RGB.const_get(const)
67
+ const_set(const, color) if color.is_a?(Color::RGB)
68
+ end
69
+ class <<Color
70
+ remove_method :const_missing
71
+ end
72
+ Color.const_get(name)
73
+ else
74
+ super
75
+ end
76
+ end
77
+
78
+ end
data/lib/color/cmyk.rb ADDED
@@ -0,0 +1,185 @@
1
+ #--
2
+ # Colour management with Ruby.
3
+ #
4
+ # Copyright 2005 Austin Ziegler
5
+ # http://rubyforge.org/ruby-pdf/
6
+ #
7
+ # Licensed under a MIT-style licence.
8
+ #
9
+ # $Id$
10
+ #++
11
+
12
+ # An CMYK colour object. CMYK (cyan, magenta, yellow, and black) colours
13
+ # are based on additive percentages of ink. A CMYK colour of (0.3, 0, 0.8,
14
+ # 0.3) would be mixed from 30% cyan, 0% magenta, 80% yellow, and 30%
15
+ # black.
16
+ class Color::CMYK
17
+ # The format of a DeviceCMYK colour for PDF. In color-tools 2.0 this
18
+ # will be removed from this package and added back as a modification by
19
+ # the PDF::Writer package.
20
+ PDF_FORMAT_STR = "%.3f %.3f %.3f %.3f %s"
21
+
22
+ # Compares the other colour to this one. The other colour will be
23
+ # converted to CMYK before comparison, so the comparison between a CMYK
24
+ # colour and a non-CMYK colour will be approximate and based on the
25
+ # other colour's #to_cmyk conversion. If there is no #to_cmyk
26
+ # conversion, this will raise an exception. This will report that two
27
+ # CMYK colours are equivalent if all component values are within 1e-4
28
+ # (0.0001) of each other.
29
+ def ==(other)
30
+ other = other.to_cmyk
31
+ other.kind_of?(Color::CMYK) and
32
+ ((@c - other.c).abs <= 1e-4) and
33
+ ((@m - other.m).abs <= 1e-4) and
34
+ ((@y - other.y).abs <= 1e-4) and
35
+ ((@k - other.k).abs <= 1e-4)
36
+ end
37
+
38
+ # Creates a CMYK colour object from fractional values 0..1.
39
+ #
40
+ # Color::CMYK.from_fraction(0.3, 0, 0.8, 0.3)
41
+ def self.from_fraction(c = 0, m = 0, y = 0, k = 0)
42
+ colour = Color::CMYK.new
43
+ colour.c = c
44
+ colour.m = m
45
+ colour.y = y
46
+ colour.k = k
47
+ colour
48
+ end
49
+
50
+ # Creates a CMYK colour object from percentages. Internally, the colour
51
+ # is managed as fractional values 0..1.
52
+ #
53
+ # Color::CMYK.from_fraction(30, 0, 80, 30)
54
+ def initialize(c = 0, m = 0, y = 0, k = 0)
55
+ @c = c / 100.0
56
+ @m = m / 100.0
57
+ @y = y / 100.0
58
+ @k = k / 100.0
59
+ end
60
+
61
+ # Present the colour as a DeviceCMYK fill colour string for PDF. This
62
+ # will be removed from the default package in color-tools 2.0.
63
+ def pdf_fill
64
+ PDF_FORMAT_STR % [ @c, @m, @y, @k, "k" ]
65
+ end
66
+
67
+ # Present the colour as a DeviceCMYK stroke colour string for PDF. This
68
+ # will be removed from the default package in color-tools 2.0.
69
+ def pdf_stroke
70
+ PDF_FORMAT_STR % [ @c, @m, @y, @k, "K" ]
71
+ end
72
+
73
+ # Present the colour as an RGB HTML/CSS colour string. Note that this
74
+ # will perform a #to_rgb operation using the default conversion formula.
75
+ def html
76
+ to_rgb.html
77
+ end
78
+
79
+ # Converts the CMYK colour to RGB. Most colour experts strongly suggest
80
+ # that this is not a good idea (some even suggesting that it's a very
81
+ # bad idea). CMYK represents additive percentages of inks on white
82
+ # paper, whereas RGB represents mixed colour intensities on a black
83
+ # screen.
84
+ #
85
+ # However, the colour conversion can be done, and there are two
86
+ # different methods for the conversion that provide slightly different
87
+ # results. Adobe PDF conversions are done with the first form.
88
+ #
89
+ # # Adobe PDF Display Formula
90
+ # r = 1.0 - min(1.0, c + k)
91
+ # g = 1.0 - min(1.0, m + k)
92
+ # b = 1.0 - min(1.0, y + k)
93
+ #
94
+ # # Other
95
+ # r = 1.0 - (c * (1.0 - k) + k)
96
+ # g = 1.0 - (m * (1.0 - k) + k)
97
+ # b = 1.0 - (y * (1.0 - k) + k)
98
+ #
99
+ # If we have a CMYK colour of [33% 66% 83% 25%], the first method will
100
+ # give an approximate RGB colour of (107, 23, 0) or #6b1700. The second
101
+ # method will give an approximate RGB colour of (128, 65, 33) or
102
+ # #804121. Which is correct? Although the colours may seem to be
103
+ # drastically different in the RGB colour space, they are very similar
104
+ # colours, differing mostly in intensity. The first is a darker,
105
+ # slightly redder brown; the second is a lighter brown.
106
+ #
107
+ # Because of this subtlety, both methods are now offered for conversion
108
+ # in color-tools 1.2 or later. The Adobe method is not used by default;
109
+ # to enable it, pass +true+ to #to_rgb.
110
+ #
111
+ # Future versions of color-tools may offer other conversion mechanisms
112
+ # that offer greater colour fidelity.
113
+ def to_rgb(use_adobe_method = false)
114
+ if use_adobe_method
115
+ r = 1.0 - [1.0, @c + @k].min
116
+ g = 1.0 - [1.0, @m + @k].min
117
+ b = 1.0 - [1.0, @y + @k].min
118
+ else
119
+ r = 1.0 - (@c.to_f * (1.0 - @k.to_f) + @k.to_f)
120
+ g = 1.0 - (@m.to_f * (1.0 - @k.to_f) + @k.to_f)
121
+ b = 1.0 - (@y.to_f * (1.0 - @k.to_f) + @k.to_f)
122
+ end
123
+ Color::RGB.from_fraction(r, g, b)
124
+ end
125
+
126
+ # Converts the CMYK colour to a single greyscale value. There are
127
+ # undoubtedly multiple methods for this conversion, but only a minor
128
+ # variant of the Adobe conversion method will be used:
129
+ #
130
+ # g = 1.0 - min(1.0, 0.299 * c + 0.587 * m + 0.114 * y + k)
131
+ #
132
+ # This treats the CMY values similarly to YIQ (NTSC) values and then
133
+ # adds the level of black. This is a variant of the Adobe version
134
+ # because it uses the more precise YIQ (NTSC) conversion values for Y
135
+ # (intensity) rather than the approximates provided by Adobe (0.3, 0.59,
136
+ # and 0.11).
137
+ def to_grayscale
138
+ c = 0.299 * @c.to_f
139
+ m = 0.587 * @m.to_f
140
+ y = 0.114 * @y.to_f
141
+ g = 1.0 - [1.0, c + m + y + @k].min
142
+ Color::GrayScale.from_fraction(g)
143
+ end
144
+ alias to_greyscale to_grayscale
145
+
146
+ def to_cmyk
147
+ self
148
+ end
149
+
150
+ # Converts to RGB then YIQ.
151
+ def to_yiq
152
+ to_rgb.to_yiq
153
+ end
154
+
155
+ # Converts to RGB then HSL.
156
+ def to_hsl
157
+ to_rgb.to_hsl
158
+ end
159
+
160
+ attr_reader :c, :m, :y, :k
161
+
162
+ def c=(cc) #:nodoc:
163
+ cc = 1.0 if cc > 1
164
+ cc = 0.0 if cc < 0
165
+ @c = cc
166
+ end
167
+
168
+ def m=(mm) #:nodoc:
169
+ mm = 1.0 if mm > 1
170
+ mm = 0.0 if mm < 0
171
+ @m = mm
172
+ end
173
+
174
+ def y=(yy) #:nodoc:
175
+ yy = 1.0 if yy > 1
176
+ yy = 0.0 if yy < 0
177
+ @y = yy
178
+ end
179
+
180
+ def k=(kk) #:nodoc:
181
+ kk = 1.0 if kk > 1
182
+ kk = 0.0 if kk < 0
183
+ @k = kk
184
+ end
185
+ end