    indexing
    	description: ""
    	legal: "See notice at end of class."
    	status: "See notice at end of class."
    	date: "$Date: 2006-10-02 10:45:06 -0700 (Mon, 02 Oct 2006) $"
    	revision: "$Revision: 64044 $"

    class interface
    	EV_RAW_IMAGE_DATA

    create
    	make (a_width, a_height: INTEGER_32)
    			-- Create an array which has `a_width'
    			-- * `a_height' * 4 items.
    		require
    			a_width_positive: a_width > 0
    			a_height_positive: a_height > 0
    		ensure
    			new_count: count = height * width * 4

    	make_with_alpha_zero (a_width, a_height: INTEGER_32)
    			-- Create an array which has `a_width'
    			-- * `a_height' * 4 items.
    		require
    			a_width_positive: a_width > 0
    			a_height_positive: a_height > 0
    		ensure
    			new_count: count = height * width * 4

    feature -- Initialization

    	make_from_array (a: ARRAY [NATURAL_8])
    			-- Initialize from the items of `a'.
    			-- (Useful in proper descendants of class `ARRAY',
    			-- to initialize an array-like object from a manifest array.)
    			-- (from ARRAY)
    		require -- from ARRAY
    			array_exists: a /= Void

    	make_from_cil (na: NATIVE_ARRAY [like array_item])
    			-- Initialize array from `na'.
    			-- (from ARRAY)
    		require -- from ARRAY
    			is_dotnet: {PLATFORM}.is_dotnet
    			na_not_void: na /= Void

    feature -- Access

    	entry (i: INTEGER_32): NATURAL_8
    			-- Entry at index `i', if in index interval
    			-- (from ARRAY)
    		require -- from ARRAY
    			valid_key: valid_index (i)

    	generating_type: STRING_8
    			-- Name of current object's generating type
    			-- (type of which it is a direct instance)
    			-- (from ANY)

    	generator: STRING_8
    			-- Name of current object's generating class
    			-- (base class of the type of which it is a direct instance)
    			-- (from ANY)

    	has (v: NATURAL_8): BOOLEAN
    			-- Does `v' appear in array?
    			-- (Reference or object equality,
    			-- based on object_comparison.)
    			-- (from ARRAY)
    		ensure -- from CONTAINER
    			not_found_in_empty: Result implies not is_empty

    	originating_pixmap: EV_PIXMAP
    			-- Pixmap `Current' was based on, if any.

    	pixel (a_x, a_y: INTEGER_32): EV_COLOR
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)

    	pixel_alpha_component (a_x, a_y: INTEGER_32): NATURAL_8
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)

    	pixel_blue_component (a_x, a_y: INTEGER_32): NATURAL_8
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)

    	pixel_green_component (a_x, a_y: INTEGER_32): NATURAL_8
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)

    	pixel_red_component (a_x, a_y: INTEGER_32): NATURAL_8
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)

    	rgb_hex_representation: STRING_8
    			-- Returns a string of hex codes representing the RGB values
    			-- of all the pixels in pixmap.

    	infix "@" (i: INTEGER_32): NATURAL_8 assign put
    			-- Entry at index `i', if in index interval
    			-- Was declared in ARRAY as synonym of `item'.
    			-- (from ARRAY)
    		require -- from TABLE
    			valid_key: valid_index (i)
    		require -- from TO_SPECIAL
    			valid_index: valid_index (i)

    feature {ANY} -- Access

    	area: SPECIAL [NATURAL_8]
    			-- Special data zone
    			-- (from TO_SPECIAL)

    feature -- Measurement

    	additional_space: INTEGER_32
    			-- Proposed number of additional items
    			-- (from RESIZABLE)
    		ensure -- from RESIZABLE
    			at_least_one: Result >= 1

    	capacity: INTEGER_32
    			-- Number of available indices
    			-- Was declared in ARRAY as synonym of count.
    			-- (from ARRAY)
    		require -- from  BOUNDED
    			True
    		ensure then -- from ARRAY
    			consistent_with_bounds: Result = upper - lower + 1

    	count: INTEGER_32
    			-- Number of available indices
    			-- Was declared in ARRAY as synonym of capacity.
    			-- (from ARRAY)
    		require -- from  FINITE
    			True
    		ensure then -- from ARRAY
    			consistent_with_bounds: Result = upper - lower + 1

    	growth_percentage: INTEGER_32 is 50
    			-- Percentage by which structure will grow automatically
    			-- (from RESIZABLE)

    	height: INTEGER_32
    			-- Number of rows.

    	index_set: INTEGER_INTERVAL
    			-- Range of acceptable indexes
    			-- (from ARRAY)
    		require -- from  INDEXABLE
    			True
    		ensure -- from INDEXABLE
    			not_void: Result /= Void
    		ensure then -- from ARRAY
    			same_count: Result.count = count
    			same_bounds: ((Result.lower = lower) and (Result.upper = upper))

    	lower: INTEGER_32
    			-- Minimum index
    			-- (from ARRAY)

    	minimal_increase: INTEGER_32 is 5
    			-- Minimal number of additional items
    			-- (from RESIZABLE)

    	occurrences (v: NATURAL_8): INTEGER_32
    			-- Number of times `v' appears in structure
    			-- (from ARRAY)
    		ensure -- from BAG
    			non_negative_occurrences: Result >= 0

    	upper: INTEGER_32
    			-- Maximum index
    			-- (from ARRAY)

    	width: INTEGER_32
    			-- Number of columns.

    feature {ANY} -- Comparison

    	is_equal (other: like Current): BOOLEAN
    			-- Is array made of the same items as `other'?
    			-- (from ARRAY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			symmetric: Result implies other.is_equal (Current)
    			consistent: standard_is_equal (other) implies Result

    feature -- Comparison

    	frozen deep_equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void
    			-- or attached to isomorphic object structures?
    			-- (from ANY)
    		ensure -- from 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
    			-- Are `some' and `other' either both void or attached
    			-- to objects considered equal?
    			-- (from ANY)
    		ensure -- from ANY
    			definition: Result = (some = Void and other = Void) or else ((some /= Void and other /= Void) and then some.is_equal (other))

    	frozen standard_equal (some: ANY; other: like arg #1): BOOLEAN
    			-- Are `some' and `other' either both void or attached to
    			-- field-by-field identical objects of the same type?
    			-- Always uses default object comparison criterion.
    			-- (from ANY)
    		ensure -- from 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
    			-- Is `other' attached to an object of the same type
    			-- as current object, and field-by-field identical to it?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			same_type: Result implies same_type (other)
    			symmetric: Result implies other.standard_is_equal (Current)

    feature -- Status report

    	all_default: BOOLEAN
    			-- Are all items set to default values?
    			-- (from ARRAY)
    		ensure -- from ARRAY
    			definition: Result = (count = 0 or else ((array_item (upper) = Void or else array_item (upper) = array_item (upper).default) and subarray (lower, upper - 1).all_default))

    	changeable_comparison_criterion: BOOLEAN
    			-- May object_comparison be changed?
    			-- (Answer: yes by default.)
    			-- (from CONTAINER)

    	conforms_to (other: ANY): BOOLEAN
    			-- Does type of current object conform to type
    			-- of `other' (as per Eiffel: The Language, chapter 13)?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void

    	extendible: BOOLEAN
    			-- May items be added?
    			-- (Answer: no, although array may be resized.)
    			-- (from ARRAY)

    	full: BOOLEAN
    			-- Is structure filled to capacity? (Answer: yes)
    			-- (from ARRAY)
    		require -- from  BOX
    			True

    	is_empty: BOOLEAN
    			-- Is structure empty?
    			-- (from FINITE)
    		require -- from  CONTAINER
    			True

    	is_inserted (v: NATURAL_8): BOOLEAN
    			-- Has `v' been inserted by the most recent insertion?
    			-- (By default, the value returned is equivalent to calling
    			-- `has (v)'. However, descendants might be able to provide more
    			-- efficient implementations.)
    			-- (from COLLECTION)

    	object_comparison: BOOLEAN
    			-- Must search operations use equal rather than `='
    			-- for comparing references? (Default: no, use `='.)
    			-- (from CONTAINER)

    	prunable: BOOLEAN
    			-- May items be removed? (Answer: no.)
    			-- (from ARRAY)

    	resizable: BOOLEAN
    			-- May capacity be changed? (Answer: yes.)
    			-- (from RESIZABLE)

    	same_items (other: like Current): BOOLEAN
    			-- Do `other' and Current have same items?
    			-- (from ARRAY)
    		require -- from ARRAY
    			other_not_void: other /= Void
    		ensure -- from ARRAY
    			definition: Result = ((count = other.count) and then (count = 0 or else (array_item (upper) = other.array_item (other.upper) and subarray (lower, upper - 1).same_items (other.subarray (other.lower, other.upper - 1)))))

    	same_type (other: ANY): BOOLEAN
    			-- Is type of current object identical to type of `other'?
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			definition: Result = (conforms_to (other) and other.conforms_to (Current))

    	valid_index (i: INTEGER_32): BOOLEAN
    			-- Is `i' within the bounds of the array?
    			-- (from ARRAY)
    		require -- from  TABLE
    			True
    		require -- from  TO_SPECIAL
    			True
    		ensure then -- from INDEXABLE
    			only_if_in_index_set: Result implies ((i >= index_set.lower) and (i <= index_set.upper))

    	valid_index_set: BOOLEAN
    			-- (from ARRAY)

    feature -- Status setting

    	compare_objects
    			-- Ensure that future search operations will use equal
    			-- rather than `=' for comparing references.
    			-- (from CONTAINER)
    		require -- from CONTAINER
    			changeable_comparison_criterion: changeable_comparison_criterion
    		ensure -- from CONTAINER
    			object_comparison

    	compare_references
    			-- Ensure that future search operations will use `='
    			-- rather than equal for comparing references.
    			-- (from CONTAINER)
    		require -- from CONTAINER
    			changeable_comparison_criterion: changeable_comparison_criterion
    		ensure -- from CONTAINER
    			reference_comparison: not object_comparison

    feature -- Element change

    	enter (v: like array_item; i: INTEGER_32)
    			-- Replace `i'-th entry, if in index interval, by `v'.
    			-- (from ARRAY)
    		require -- from ARRAY
    			valid_key: valid_index (i)

    	fill (other: CONTAINER [NATURAL_8])
    			-- Fill with as many items of `other' as possible.
    			-- The representations of `other' and current structure
    			-- need not be the same.
    			-- (from COLLECTION)
    		require -- from COLLECTION
    			other_not_void: other /= Void
    			extendible: extendible

    	subcopy (other: ARRAY [like array_item]; start_pos, end_pos, index_pos: INTEGER_32)
    			-- Copy items of `other' within bounds `start_pos' and `end_pos'
    			-- to current array starting at index `index_pos'.
    			-- (from ARRAY)
    		require -- from ARRAY
    			other_not_void: other /= Void
    			valid_start_pos: other.valid_index (start_pos)
    			valid_end_pos: other.valid_index (end_pos)
    			valid_bounds: (start_pos <= end_pos) or (start_pos = end_pos + 1)
    			valid_index_pos: valid_index (index_pos)
    			enough_space: (upper - index_pos) >= (end_pos - start_pos)

    feature -- Removal

    	clear_all
    			-- Reset all items to default values.
    			-- (from ARRAY)
    		ensure -- from ARRAY
    			stable_lower: lower = old lower
    			stable_upper: upper = old upper
    			default_items: all_default

    	discard_items
    			-- Reset all items to default values with reallocation.
    			-- (from ARRAY)
    		ensure -- from ARRAY
    			default_items: all_default

    	prune_all (v: NATURAL_8)
    			-- Remove all occurrences of `v'.
    			-- (Reference or object equality,
    			-- based on object_comparison.)
    			-- (from COLLECTION)
    		require -- from COLLECTION
    			prunable: prunable
    		ensure -- from COLLECTION
    			no_more_occurrences: not has (v)

    feature -- Resizing

    	automatic_grow
    			-- Change the capacity to accommodate at least
    			-- Growth_percentage more items.
    			-- (from RESIZABLE)
    		ensure -- from RESIZABLE
    			increased_capacity: capacity >= old capacity + old capacity * growth_percentage // 100

    	conservative_resize (min_index, max_index: INTEGER_32)
    			-- Rearrange array so that it can accommodate
    			-- indices down to `min_index' and up to `max_index'.
    			-- Do not lose any previously entered item.
    			-- (from ARRAY)
    		require -- from ARRAY
    			good_indices: min_index <= max_index
    		ensure -- from ARRAY
    			no_low_lost: lower = min_index or else lower = old lower
    			no_high_lost: upper = max_index or else upper = old upper

    	grow (i: INTEGER_32)
    			-- Change the capacity to at least `i'.
    			-- (from ARRAY)
    		ensure -- from RESIZABLE
    			new_capacity: capacity >= i

    feature {ANY} -- Conversion

    	to_c: ANY
    			-- Address of actual sequence of values,
    			-- for passing to external (non-Eiffel) routines.
    			-- (from ARRAY)
    		require -- from ARRAY
    			not_is_dotnet: not {PLATFORM}.is_dotnet

    feature -- Conversion

    	linear_representation: LINEAR [NATURAL_8]
    			-- Representation as a linear structure
    			-- (from ARRAY)

    	to_cil: NATIVE_ARRAY [NATURAL_8]
    			-- Address of actual sequence of values,
    			-- for passing to external (non-Eiffel) routines.
    			-- (from ARRAY)
    		require -- from ARRAY
    			is_dotnet: {PLATFORM}.is_dotnet
    		ensure -- from ARRAY
    			to_cil_not_void: Result /= Void

    	to_special: SPECIAL [NATURAL_8]
    			-- 'area'.
    			-- (from ARRAY)
    		ensure -- from ARRAY
    			to_special_not_void: Result /= Void

    feature {ANY} -- Duplication

    	copy (other: like Current)
    			-- Reinitialize by copying all the items of `other'.
    			-- (This is also used by clone.)
    			-- (from ARRAY)
    		require -- from ANY
    			other_not_void: other /= Void
    			type_identity: same_type (other)
    		ensure -- from ANY
    			is_equal: is_equal (other)
    		ensure then -- from ARRAY
    			equal_areas: area.is_equal (other.area)

    feature -- Duplication

    	frozen deep_copy (other: like Current)
    			-- Effect equivalent to that of:
    			--		copy (`other' . deep_twin)
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    		ensure -- from ANY
    			deep_equal: deep_equal (Current, other)

    	frozen deep_twin: like Current
    			-- New object structure recursively duplicated from Current.
    			-- (from ANY)
    		ensure -- from ANY
    			deep_equal: deep_equal (Current, Result)

    	frozen standard_copy (other: like Current)
    			-- Copy every field of `other' onto corresponding field
    			-- of current object.
    			-- (from ANY)
    		require -- from ANY
    			other_not_void: other /= Void
    			type_identity: same_type (other)
    		ensure -- from ANY
    			is_standard_equal: standard_is_equal (other)

    	frozen standard_twin: like Current
    			-- New object field-by-field identical to `other'.
    			-- Always uses default copying semantics.
    			-- (from ANY)
    		ensure -- from ANY
    			standard_twin_not_void: Result /= Void
    			equal: standard_equal (Result, Current)

    	subarray (start_pos, end_pos: INTEGER_32): ARRAY [NATURAL_8]
    			-- Array made of items of current array within
    			-- bounds `start_pos' and `end_pos'.
    			-- (from ARRAY)
    		require -- from ARRAY
    			valid_start_pos: valid_index (start_pos)
    			valid_end_pos: end_pos <= upper
    			valid_bounds: (start_pos <= end_pos) or (start_pos = end_pos + 1)
    		ensure -- from ARRAY
    			lower: Result.lower = start_pos
    			upper: Result.upper = end_pos

    	frozen twin: like Current
    			-- New object equal to `Current'
    			-- twin calls copy; to change copying/twining semantics, redefine copy.
    			-- (from ANY)
    		ensure -- from ANY
    			twin_not_void: Result /= Void
    			is_equal: Result.is_equal (Current)

    feature -- Basic operations

    	frozen default: like Current
    			-- Default value of object's type
    			-- (from ANY)

    	frozen default_pointer: POINTER
    			-- Default value of type `POINTER'
    			-- (Avoid the need to write `p'.default for
    			-- some `p' of type `POINTER'.)
    			-- (from ANY)

    	default_rescue
    			-- Process exception for routines with no Rescue clause.
    			-- (Default: do nothing.)
    			-- (from ANY)

    	frozen do_nothing
    			-- Execute a null action.
    			-- (from ANY)

    feature -- Contract support

    	valid_coordinates (a_x, a_y: INTEGER_32): BOOLEAN

    feature -- Element Change

    	set_pixel (a_x, a_y: INTEGER_32; a_color: EV_COLOR)
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)
    			a_color_not_void: a_color /= Void

    	set_pixel_alpha_component (a_x, a_y: INTEGER_32; a_intensity: NATURAL_8)
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)

    	set_pixel_blue_component (a_x, a_y: INTEGER_32; a_intensity: NATURAL_8)
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)

    	set_pixel_green_component (a_x, a_y: INTEGER_32; a_intensity: NATURAL_8)
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)

    	set_pixel_red_component (a_x, a_y: INTEGER_32; a_intensity: NATURAL_8)
    		require
    			valid_coordinates: valid_coordinates (a_x, a_y)

    feature -- Iteration

    	do_all (action: PROCEDURE [ANY, TUPLE [NATURAL_8]])
    			-- Apply `action' to every item.
    			-- Semantics not guaranteed if `action' changes the structure;
    			-- in such a case, apply iterator to clone of structure instead.
    			-- (from ARRAY)
    		require -- from ARRAY
    			action_not_void: action /= Void

    	do_if (action: PROCEDURE [ANY, TUPLE [NATURAL_8]]; test: FUNCTION [ANY, TUPLE [NATURAL_8], BOOLEAN])
    			-- Apply `action' to every item that satisfies `test'.
    			-- Semantics not guaranteed if `action' or `test' changes the structure;
    			-- in such a case, apply iterator to clone of structure instead.
    			-- (from ARRAY)
    		require -- from ARRAY
    			action_not_void: action /= Void
    			test_not_void: test /= Void

    	for_all (test: FUNCTION [ANY, TUPLE [NATURAL_8], BOOLEAN]): BOOLEAN
    			-- Is `test' true for all items?
    			-- (from ARRAY)
    		require -- from ARRAY
    			test_not_void: test /= Void

    	there_exists (test: FUNCTION [ANY, TUPLE [NATURAL_8], BOOLEAN]): BOOLEAN
    			-- Is `test' true for at least one item?
    			-- (from ARRAY)
    		require -- from ARRAY
    			test_not_void: test /= Void

    feature -- Output

    	io: STD_FILES
    			-- Handle to standard file setup
    			-- (from ANY)

    	out: STRING_8
    			-- New string containing terse printable representation
    			-- of current object
    			-- Was declared in ANY as synonym of tagged_out.
    			-- (from ANY)

    	print (some: ANY)
    			-- Write terse external representation of `some'
    			-- on standard output.
    			-- (from ANY)

    	frozen tagged_out: STRING_8
    			-- New string containing terse printable representation
    			-- of current object
    			-- Was declared in ANY as synonym of out.
    			-- (from ANY)

    feature -- Platform

    	operating_environment: OPERATING_ENVIRONMENT
    			-- Objects available from the operating system
    			-- (from ANY)

    invariant
    	items_number: count = width * height * 4

    		-- from ARRAY
    	area_exists: area /= Void
    	consistent_size: capacity = upper - lower + 1
    	non_negative_count: count >= 0
    	index_set_has_same_count: valid_index_set

    		-- from RESIZABLE
    	increase_by_at_least_one: minimal_increase >= 1

    		-- from BOUNDED
    	valid_count: count <= capacity
    	full_definition: full = (count = capacity)

    		-- from FINITE
    	empty_definition: is_empty = (count = 0)
    	non_negative_count: count >= 0

    		-- from ANY
    	reflexive_equality: standard_is_equal (Current)
    	reflexive_conformance: conforms_to (Current)

    		-- from INDEXABLE
    	index_set_not_void: index_set /= Void

    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 -- class EV_RAW_IMAGE_DATA