indexing
	description: "Defines the dimensions and color information for a Windows device-independent bitmap (DIB)."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_BITMAP_INFO

create 

	make (a_bitmap_info_header: WEL_BITMAP_INFO_HEADER; a_rgb_quad_count: INTEGER)
			-- Make a BITMAPINFO structure
			-- with a_bitmap_info_header
		require
			a_bitmap_info_header_not_void: a_bitmap_info_header /= void
			positive_rgb_quad_count: a_rgb_quad_count >= 0

	make_by_dc (dc: WEL_DC; bitmap: WEL_BITMAP; usage: INTEGER)
			-- Make a bitmap info structure using dc and
			-- bitmap.
			-- See class WEL_DIB_COLORS_CONSTANTS for usage
			-- values.
		require
			dc_not_void: dc /= void
			dc_exists: dc.exists
			bitmap_not_void: bitmap /= void
			bitmap_exists: bitmap.exists
			valid_usage: valid_dib_colors_constant (usage)

	make_by_pointer (a_pointer: POINTER)
			-- Set item with a_pointer.
			-- Since item is shared, it does not need
			-- to be freed.
			-- Caution: a_pointer must be a pointer
			-- coming from Windows.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			item_set: item = a_pointer
			shared: shared

feature -- Access

	header: WEL_BITMAP_INFO_HEADER
			-- Information about the dimensions and color
			-- format of a DIB
		ensure
			result_not_void: Result /= void

	item: POINTER
			-- Generic Windows handle or structure pointer.
			-- Can be a HWND, HICON, RECT *, WNDCLASS *, etc...
			-- (from WEL_ANY)

	rgb_quad (index: INTEGER): WEL_RGB_QUAD
			-- Bitmap color at zero-based index
		require
			index_small_enough: index < rgb_quad_count
			index_large_enough: index >= 0
		ensure
			result_not_void: Result /= void

	rgb_quad_count: INTEGER
			-- Number of colors
	
feature -- Measurement

	structure_size: INTEGER
			-- Size to allocate (in bytes)
		ensure -- from WEL_STRUCTURE
			positive_result: Result > 0
	
feature -- Status report

	exists: BOOLEAN
			-- Does the item exist?
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			Result = (item /= default_pointer)

	shared: BOOLEAN
			-- Is item shared by another object?
			-- If False (by default), item will
			-- be destroyed by destroy_item.
			-- If True, item will not be destroyed.
			-- (from WEL_ANY)
	
feature  -- Status report

	valid_dib_colors_constant (c: INTEGER): BOOLEAN
			-- Is c a valid dib colors constant?
			-- (from WEL_DIB_COLORS_CONSTANTS)
	
feature -- Status setting

	set_shared
			-- Set shared to True.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			shared: shared

	set_unshared
			-- Set shared to False.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			unshared: not shared
	
feature -- Element change

	set_bitmap_info_header (a_header: WEL_BITMAP_INFO_HEADER)
			-- Set header with a_header.
		require
			a_header_not_void: a_header /= void

	set_item (an_item: POINTER)
			-- Set item with an_item
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			item_set: item = an_item

	set_rgb_quad (index: INTEGER; a_rgb_quad: WEL_RGB_QUAD)
			-- Set rgb_quad with a_rgb_quad at
			-- zero-based index.
		require
			index_small_enough: index < rgb_quad_count
			index_large_enough: index >= 0
			a_rgb_quad_not_void: a_rgb_quad /= void
	
feature -- Removal

	dispose
			-- Destroy the inner structure of Current.
			--
			-- This function should be called by the GC when the
			-- object is collected or by the user if Current is
			-- no more usefull.
			-- (from WEL_ANY)
	
feature -- Conversion

	to_integer: INTEGER
			-- Converts item to an integer.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			Result = cwel_pointer_to_integer (item)
	
feature -- Basic operations

	initialize
			-- Fill Current with zeros.
			-- (from WEL_STRUCTURE)
		require -- from WEL_STRUCTURE
			exists: exists

	initialize_with_character (a_character: CHARACTER)
			-- Fill current with a_character.
			-- (from WEL_STRUCTURE)
		require -- from WEL_STRUCTURE
			exists: exists

	memory_copy (source_pointer: POINTER; length: INTEGER)
			-- Copy length bytes from source_pointer to item.
			-- (from WEL_STRUCTURE)
		require -- from WEL_STRUCTURE
			length_small_enough: length <= structure_size
			length_large_enough: length > 0
			exists: exists
	
invariant

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

end -- class WEL_BITMAP_INFO