indexing
description: "Color modeled as red, green, blue intensitieseach with range [0,1]."
legal: "See notice at end of class."
keywords: "color, pixel, rgb, 8, 16, 24"
status: "See notice at end of class."
date: "$Date: 2006-03-16 17:10:42 -0800 (Thu, 16 Mar 2006) $"
revision: "$Revision: 57525 $"
class interface
EV_COLOR
create
default_create
EV_ANY
require ANY
True
ensure then EV_ANY
is_coupled: implementation /= Void
is_initialized: is_initialized
default_create_called_set: default_create_called
is_in_default_state: is_in_default_state
make_with_8_bit_rgb (an_8_bit_red, an_8_bit_green, an_8_bit_blue: INTEGER_32)
`a_red'`a_green'`a_blue'
require
red_within_range: an_8_bit_red >= 0 and an_8_bit_red <= max_8_bit
green_within_range: an_8_bit_green >= 0 and an_8_bit_green <= max_8_bit
blue_within_range: an_8_bit_blue >= 0 and an_8_bit_blue <= max_8_bit
ensure
red_assigned: red_8_bit = an_8_bit_red
green_assigned: green_8_bit = an_8_bit_green
blue_assigned: blue_8_bit = an_8_bit_blue
make_with_rgb (a_red, a_green, a_blue: REAL_32)
`a_red'`a_green'`a_blue'
require
a_red_within_range: a_red >= 0 and then a_red <= 1
a_green_within_range: a_green >= 0 and then a_green <= 1
a_blue_within_range: a_blue >= 0 and then a_blue <= 1
ensure
red_assigned: (red - a_red).abs <= delta
green_assigned: (green - a_green).abs <= delta
blue_assigned: (blue - a_blue).abs <= delta
feature
blue: REAL_32
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.blue
data: ANY
EV_ANY
generating_type: STRING_8
ANY
generator: STRING_8
ANY
green: REAL_32
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.green
hue: REAL_32
require
not_destroyed: not is_destroyed
lightness: REAL_32
require
not_destroyed: not is_destroyed
red: REAL_32
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.red
saturation: REAL_32
require
not_destroyed: not is_destroyed
feature
copy (other: like Current)
`Current'`other'
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_equal: is_equal (other)
frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
shallow_implies_deep: standard_equal (some, other) implies Result
both_or_none_void: (some = Void) implies (Result = (other = Void))
same_type: (Result and (some /= Void)) implies some.same_type (other)
symmetric: Result implies deep_equal (other, some)
frozen equal (some: ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))
is_equal (other: like Current): BOOLEAN
`Current'`other'
require ANY
other_not_void: other /= Void
ensure ANY
symmetric: Result implies other.is_equal (Current)
consistent: standard_is_equal (other) implies Result
frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN
`some'`other'
ANY
ensure ANY
definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.standard_is_equal (other))
frozen standard_is_equal (other: like Current): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
same_type: Result implies same_type (other)
symmetric: Result implies other.standard_is_equal (Current)
feature
conforms_to (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
is_hashable: BOOLEAN
HASHABLE
ensure HASHABLE
ok_if_not_default: Result implies (Current /= default)
same_type (other: ANY): BOOLEAN
`other'
ANY
require ANY
other_not_void: other /= Void
ensure ANY
definition: Result = (conforms_to (other) and other.conforms_to (Current))
feature
set_blue (a_blue: REAL_32)
`a_blue'blue
require
not_destroyed: not is_destroyed
blue_within_range: a_blue >= 0 and then a_blue <= 1
ensure
blue_assigned: (blue - a_blue).abs <= delta
set_data (some_data: like data)
`some_data'data
EV_ANY
require EV_ANY
not_destroyed: not is_destroyed
ensure EV_ANY
data_assigned: data = some_data
set_green (a_green: REAL_32)
`a_green'green
require
not_destroyed: not is_destroyed
within_range: a_green >= 0 and then a_green <= 1
ensure
green_assigned: (green - a_green).abs <= delta
set_red (a_red: REAL_32)
`a_red'red
require
not_destroyed: not is_destroyed
within_range: a_red >= 0 and then a_red <= 1
ensure
red_assigned: (red - a_red).abs <= delta
set_rgb (a_red, a_green, a_blue: REAL_32)
`a_red'`a_green'`a_blue'
redgreenblue
require
not_destroyed: not is_destroyed
red_within_range: a_red >= 0 and then a_red <= 1
green_within_range: a_green >= 0 and then a_green <= 1
blue_within_range: a_blue >= 0 and then a_blue <= 1
ensure
red_assigned: (red - a_red).abs <= delta
green_assigned: (green - a_green).abs <= delta
blue_assigned: (blue - a_blue).abs <= delta
feature
blue_16_bit: INTEGER_32
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.blue_16_bit
blue_8_bit: INTEGER_32
blue
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.blue_8_bit
green_16_bit: INTEGER_32
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.green_16_bit
green_8_bit: INTEGER_32
green
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.green_8_bit
red_16_bit: INTEGER_32
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.red_16_bit
red_8_bit: INTEGER_32
red
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.red_8_bit
rgb_24_bit: INTEGER_32
redgreenblue
require
not_destroyed: not is_destroyed
ensure
bridge_ok: Result = implementation.rgb_24_bit
set_blue_with_16_bit (a_16_bit_blue: INTEGER_32)
blue`a_16_bit_blue'
require
not_destroyed: not is_destroyed
within_range: a_16_bit_blue >= 0 and then a_16_bit_blue <= max_16_bit
ensure
blue_assigned: blue_16_bit = a_16_bit_blue
set_blue_with_8_bit (an_8_bit_blue: INTEGER_32)
blue`an_8_bit_blue'
require
not_destroyed: not is_destroyed
within_range: an_8_bit_blue >= 0 and then an_8_bit_blue <= max_8_bit
ensure
blue_assigned: blue_8_bit = an_8_bit_blue
set_green_with_16_bit (a_16_bit_green: INTEGER_32)
green`a_16_bit_green'
require
not_destroyed: not is_destroyed
within_range: a_16_bit_green >= 0 and then a_16_bit_green <= max_16_bit
ensure
green_assigned: green_16_bit = a_16_bit_green
set_green_with_8_bit (an_8_bit_green: INTEGER_32)
green`an_8_bit_green'
require
not_destroyed: not is_destroyed
within_range: an_8_bit_green >= 0 and then an_8_bit_green <= max_8_bit
ensure
green_assigned: green_8_bit = an_8_bit_green
set_red_with_16_bit (a_16_bit_red: INTEGER_32)
red`a_8_bit_red'
require
not_destroyed: not is_destroyed
within_range: a_16_bit_red >= 0 and then a_16_bit_red <= max_16_bit
ensure
red_assigned: red_16_bit = a_16_bit_red
set_red_with_8_bit (an_8_bit_red: INTEGER_32)
red`an_8_bit_red'
require
not_destroyed: not is_destroyed
within_range: an_8_bit_red >= 0 and then an_8_bit_red <= max_8_bit
ensure
red_assigned: red_8_bit = an_8_bit_red
set_rgb_with_16_bit (a_16_bit_red, a_16_bit_green, a_16_bit_blue: INTEGER_32)
`a_16_bit_red'`a_16_bit_green'
`a_16_bit_blue'
require
not_destroyed: not is_destroyed
red_within_range: a_16_bit_red >= 0 and a_16_bit_red <= max_16_bit
green_within_range: a_16_bit_green >= 0 and a_16_bit_green <= max_16_bit
blue_within_range: a_16_bit_blue >= 0 and a_16_bit_blue <= max_16_bit
ensure
red_assigned: red_16_bit = a_16_bit_red
green_assigned: green_16_bit = a_16_bit_green
blue_assigned: blue_16_bit = a_16_bit_blue
set_rgb_with_24_bit (a_24_bit_rgb: INTEGER_32)
`a_24_bit_rgb'
require
not_destroyed: not is_destroyed
within_range: a_24_bit_rgb >= 0 and a_24_bit_rgb <= max_24_bit
ensure
rgb_assigned: rgb_24_bit = a_24_bit_rgb
set_rgb_with_8_bit (an_8_bit_red, an_8_bit_green, an_8_bit_blue: INTEGER_32)
`an_8_bit_red'`an_8_bit_green'
`an_8_bit_blue'
require
not_destroyed: not is_destroyed
red_within_range: an_8_bit_red >= 0 and an_8_bit_red <= max_8_bit
green_within_range: an_8_bit_green >= 0 and an_8_bit_green <= max_8_bit
blue_within_range: an_8_bit_blue >= 0 and an_8_bit_blue <= max_8_bit
ensure
red_assigned: red_8_bit = an_8_bit_red
green_assigned: green_8_bit = an_8_bit_green
blue_assigned: blue_8_bit = an_8_bit_blue
feature
frozen deep_copy (other: like Current)
copy`other'deep_twin
ANY
require ANY
other_not_void: other /= Void
ensure ANY
deep_equal: deep_equal (Current, other)
frozen deep_twin: like Current
ANY
ensure ANY
deep_equal: deep_equal (Current, Result)
frozen standard_copy (other: like Current)
`other'
ANY
require ANY
other_not_void: other /= Void
type_identity: same_type (other)
ensure ANY
is_standard_equal: standard_is_equal (other)
frozen standard_twin: like Current
`other'
ANY
ensure ANY
standard_twin_not_void: Result /= Void
equal: standard_equal (Result, Current)
frozen twin: like Current
`Current'
twincopycopy
ANY
ensure ANY
twin_not_void: Result /= Void
is_equal: Result.is_equal (Current)
feature
frozen default: like Current
ANY
frozen default_pointer: POINTER
`POINTER'
`p'default
`p'`POINTER'
ANY
default_rescue
ANY
frozen do_nothing
ANY
feature
destroy
`Current'
EV_ANY
ensure EV_ANY
is_destroyed: is_destroyed
feature
max_16_bit: INTEGER_32 is 65535
max_24_bit: INTEGER_32 is 16777215
max_8_bit: INTEGER_32 is 255
feature
hash_code: INTEGER_32
ensure HASHABLE
good_hash_value: Result >= 0
feature
io: STD_FILES
ANY
out: STRING_8
print (some: ANY)
`some'
ANY
frozen tagged_out: STRING_8
ANYout
ANY
feature
operating_environment: OPERATING_ENVIRONMENT
ANY
feature
is_destroyed: BOOLEAN
`Current'
EV_ANY
ensure EV_ANY
bridge_ok: Result = implementation.is_destroyed
invariant
red_within_range: red >= 0 and red <= 1
green_within_range: green >= 0 and green <= 1
blue_within_range: blue >= 0 and blue <= 1
red_8_bit_within_range: red_8_bit >= 0 and red_8_bit <= max_8_bit
green_8_bit_within_range: green_8_bit >= 0 and green_8_bit <= max_8_bit
blue_8_bit_within_range: blue_8_bit >= 0 and blue_8_bit <= max_8_bit
red_16_bit_within_range: red_16_bit >= 0 and red_16_bit <= max_16_bit
green_16_bit_within_range: green_16_bit >= 0 and green_16_bit <= max_16_bit
blue_16_bit_within_range: blue_16_bit >= 0 and blue_16_bit <= max_16_bit
rgb_24_bit_within_range: rgb_24_bit >= 0 and rgb_24_bit <= max_24_bit
red_16_bit_conversion: ((red * max_16_bit) - red_16_bit).abs <= delta * max_16_bit
red_8_bit_conversion: ((red * max_8_bit) - red_8_bit).abs <= delta * max_8_bit
green_16_bit_conversion: ((green * max_16_bit) - green_16_bit).abs <= delta * max_16_bit
green_8_bit_conversion: ((green * max_8_bit) - green_8_bit).abs < delta * max_8_bit
blue_16_bit_conversion: ((blue * max_16_bit) - blue_16_bit).abs < delta * max_16_bit
blue_8_bit_conversion: ((blue * max_8_bit) - blue_8_bit).abs < delta * max_8_bit
EV_ANY
is_initialized: is_initialized
is_coupled: implementation /= Void and then implementation.interface = Current
default_create_called: default_create_called
ANY
reflexive_equality: standard_is_equal (Current)
reflexive_conformance: conforms_to (Current)
indexing
copyright: "Copyright (c) 1984-2006, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
356 Storke Road, Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end EV_COLOR