indexing
	description: "Device independent bitmap which can be created from a file."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"
	note: "Not all variants of the bmp format can be read. If you haveproblems with a certain image please use i.e. MS Paint to convertthe image to the standard bmp format and then try again."
class interface
	WEL_DIB
create 
	make_by_file (file: RAW_FILE)
			file
		require
			file_not_void: file /= void
			file_exists: file.exists
			file_opened: file.is_open_read
		ensure
			palette_not_void: palette /= void
			palette_exists: palette.exists
			file_closed: file.is_closed
	make_by_content_pointer (bits_ptr: POINTER; size: INTEGER)
		ensure
			palette_not_void: palette /= void
			palette_exists: palette.exists
feature 
	color_count: INTEGER
			
		require
			exists: exists
		ensure
			positive_result: Result >= 0
	height: INTEGER
			
		require
			exists: exists
		ensure
			positive_result: Result >= 0
	item: POINTER
			
			
			 WEL_ANY
	item_bits: POINTER
		require
			exists: exists
	palette: WEL_PALETTE
			
			
			palette
			palette
	width: INTEGER
			
		require
			exists: exists
		ensure
			positive_result: Result >= 0
	
feature 
	exists: BOOLEAN
			item
			 WEL_ANY
		ensure  WEL_ANY
			Result = (item /= default_pointer)
	shared: BOOLEAN
			item
			item
			destroy_item
			item
			 WEL_ANY
	
feature 
	set_shared
			shared
			 WEL_ANY
		ensure  WEL_ANY
			shared: shared
	set_unshared
			shared
			 WEL_ANY
		ensure  WEL_ANY
			unshared: not shared
	
feature 
	set_item (an_item: POINTER)
			iteman_item
			 WEL_ANY
		ensure  WEL_ANY
			item_set: item = an_item
	
feature 
	dispose
			Current
			
			
			Current
			
			 WEL_ANY
	
feature 
	to_integer: INTEGER
			item
			 WEL_ANY
		ensure  WEL_ANY
			Result = cwel_pointer_to_integer (item)
	
feature 
	initialize
			
			 WEL_STRUCTURE
		require  WEL_STRUCTURE
			exists: exists
	initialize_with_character (a_character: CHARACTER)
			a_character
			 WEL_STRUCTURE
		require  WEL_STRUCTURE
			exists: exists
	memory_copy (source_pointer: POINTER; length: INTEGER)
			lengthsource_pointeritem
			 WEL_STRUCTURE
		require  WEL_STRUCTURE
			length_small_enough: length <= structure_size
			length_large_enough: length > 0
			exists: exists
	set_pal_color
			
			Dib_pal_colors
		require
			exists: exists
	
invariant
		 ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)
end -- WEL_DIB