indexing
	description: "Properties of a bitmap."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_LOG_BITMAP

create 

	make (a_width, a_height, a_width_bytes, a_planes, a_bits_pixel: INTEGER; a_bits: POINTER)
		require
			positive_width: a_width >= 0
			positive_height: a_height >= 0
			positive_width_bytes: a_width_bytes >= 0
			positive_planes: a_planes >= 0
			positive_bits_pixel: a_bits_pixel >= 0
			count_width_bytes: (a_width_bytes \\ 2) = 0
		ensure
			type_set: type = 0
			width_set: width = a_width
			height_set: height = a_height
			width_bytes_set: width_bytes = a_width_bytes
			planes_set: planes = a_planes
			bits_pixel_set: bits_pixel = a_bits_pixel
			bits_set: bits = a_bits

	make_by_bitmap (bitmap: WEL_BITMAP)
			-- Make a log bitmap using the information of bitmap.
		require
			bitmap_not_void: bitmap /= void
			bitmap_exists: bitmap.exists

feature -- Access

	bits: POINTER
			-- Bitmap bits

	bits_pixel: INTEGER
			-- Bitmap bits_pixel
		ensure
			positive_result: Result >= 0

	height: INTEGER
			-- Bitmap height
		ensure
			positive_result: Result >= 0

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

	planes: INTEGER
			-- Bitmap planes
		ensure
			positive_result: Result >= 0

	type: INTEGER
			-- Bitmap type

	width: INTEGER
			-- Bitmap width
		ensure
			positive_result: Result >= 0

	width_bytes: INTEGER
			-- Bitmap width_bytes
		ensure
			positive_result: Result >= 0
	
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 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_bits (a_bits: POINTER)
			-- Set bits with a_bits
		ensure
			set_bits: bits = a_bits

	set_bits_pixel (a_bits_pixel: INTEGER)
			-- Set bits_pixel with a_bits_pixel
		require
			positive_bits_pixel: a_bits_pixel >= 0
		ensure
			set_bits_pixel: bits_pixel = a_bits_pixel

	set_height (a_height: INTEGER)
			-- Set height with a_height
		require
			positive_height: a_height >= 0
		ensure
			set_height: height = a_height

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

	set_planes (a_planes: INTEGER)
			-- Set planes with a_planes
		require
			positive_planes: a_planes >= 0
		ensure
			set_planes: planes = a_planes

	set_type (a_type: INTEGER)
			-- Set type with a_type
		ensure
			set_type: type = a_type

	set_width (a_width: INTEGER)
			-- Set width with a_width
		require
			positive_width: a_width >= 0
		ensure
			set_width: width = a_width

	set_width_bytes (a_width_bytes: INTEGER)
			-- Set width_bytes with a_width_bytes
		require
			positive_width_bytes: a_width_bytes >= 0
		ensure
			set_width_bytes: width_bytes = a_width_bytes
	
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_LOG_BITMAP