note
	description: "Representation of a RGBA color. Not for use with SDL. For SDL, use SDL_COLOR."
	author: "Louis Marchand"
	date: "Thu, 02 Apr 2015 02:40:10 +0000"
	revision: "2.0"

class 
	GAME_COLOR

inherit
	GAME_COLOR_READABLE
		redefine
			make,
			red,
			green,
			blue,
			alpha
		end

create 
	make,
	make_rgb,
	make_from_hexadecimal,
	make_rgb_from_hexadecimal,
	make_from_other

feature {NONE} -- Initialization

	make (a_red, a_green, a_blue, a_alpha: NATURAL_8)
			-- Initialization for Current using a_red, a_green, a_blue as primary color intensity and a_alpha as opacity intensity.
			-- For primary color intensity, 0=no intensity and 255=maximum intensity
			-- For opacity intensity, 0=transparent and 255=opaque
		do
			set_red (a_red)
			set_green (a_green)
			set_blue (a_blue)
			set_alpha (a_alpha)
		end
	
feature -- Access

	red: NATURAL_8 assign set_red
			-- Red intensity of the color
			-- 0=no intensity and 255=maximum intensity
		do
			Result := Precursor
		end

	green: NATURAL_8 assign set_green
			-- Green intensity of the color
			-- 0=no intensity and 255=maximum intensity
		do
			Result := Precursor
		end

	blue: NATURAL_8 assign set_blue
			-- Blue intensity of the color
			-- 0=no intensity and 255=maximum intensity
		do
			Result := Precursor
		end

	alpha: NATURAL_8 assign set_alpha
			-- The opacity (aplha channel) intensity
			-- 0=transparent and 255=opaque
		do
			Result := Precursor
		end

	set_red (a_red: NATURAL_8)
			-- Assign the red intensity to a_red.
			-- 0=no intensity and 255=maximum intensity
		do
			red_internal := a_red
		ensure
			set_red_is_set: red = a_red
			set_red_blue_unchange: blue = old blue
			set_red_green_unchange: green = old green
			set_red_alpha_unchange: alpha = old alpha
		end

	set_green (a_green: NATURAL_8)
			-- Assign the green intensity to a_green.
			-- 0=no intensity and 255=maximum intensity
		do
			green_internal := a_green
		ensure
			set_green_is_set: green = a_green
			set_green_blue_unchange: blue = old blue
			set_green_red_unchange: red = old red
			set_green_alpha_unchange: alpha = old alpha
		end

	set_blue (a_blue: NATURAL_8)
			-- Assign the blue intensity to a_blue.
			-- 0=no intensity and 255=maximum intensity
		do
			blue_internal := a_blue
		ensure
			set_blue_is_set: blue = a_blue
			set_blue_red_unchange: red = old red
			set_blue_green_unchange: green = old green
			set_blue_alpha_unchange: alpha = old alpha
		end

	set_alpha (a_alpha: NATURAL_8)
			-- Assign the alpha (opacity) intensity to a_alpha.
			-- 0=no intensity and 255=maximum intensity
			-- 0=transparent and 255=opaque
		do
			alpha_internal := a_alpha
		ensure
			set_alpha_is_set: alpha = a_alpha
			set_alpha_red_unchange: red = old red
			set_alpha_green_unchange: green = old green
			set_alpha_blue_unchange: blue = old blue
		end
	
end -- class GAME_COLOR

Generated by ISE EiffelStudio