Eiffel Media API
Overview Cluster Class Classes Index      Previous Next      Top Features

em.widget.background

Class EM_SHIFTED_BITMAP_BACKGROUND


Direct ancestors

EM_BITMAP_BACKGROUND

Creation

Features

Invariants

indexing

description

Bitmap background with an offset in the bitmap.
The bitmap will not be repeated.

date

$Date: 2005/10/23 11:10:45 $

revision

$Revision: 1.9 $

class

EM_SHIFTED_BITMAP_BACKGROUND

inherit

EM_BITMAP_BACKGROUND

create

make_from_bitmap_offset (a_bitmap: like bitmap; a_x, a_y: INTEGER)

-- Initialise background with a_bitmap and offset a_x a_y.

require
a_bitmap_not_void: a_bitmap /= Void
a_x_in_range: a_x >= 0 and a_x < a_bitmap.width
a_y_in_range: a_y >= 0 and a_y < a_bitmap.width
ensure
bitmap_set: bitmap = a_bitmap
x_set: x = a_x
y_set: y = a_y
make_from_bitmap (a_bitmap: like bitmap)

-- Initialise background with image a_bitmap.

-- (From EM_BITMAP_BACKGROUND)

require
a_bitmap_not_void: a_bitmap /= Void
ensure
bitmap_set: bitmap = a_bitmap
make_from_file (a_filename: STRING)

-- Initialise background with image denoted by a_filename.

-- (From EM_BITMAP_BACKGROUND)

require
a_filename_not_void: a_filename /= Void
ensure
bitmap_created: bitmap /= Void

feature -- Access

bitmap: EM_BITMAP

-- Bitmap that is drawn as background

-- (From EM_BITMAP_BACKGROUND)

x: INTEGER

-- X offset of bitmap

y: INTEGER

-- Y offset of bitmap

feature -- Element change

set_bitmap (a_bitmap: like bitmap)

-- Set bitmap to a_bitmap.
-- If the coordinates x and y are outside a_bitmap they will be reset to 0.

-- (From EM_BITMAP_BACKGROUND)

require
a_bitmap_not_void: a_bitmap /= Void
ensure
bitmap_set: bitmap = a_bitmap
ensure then
x_reset_if_out_of_range: x >= a_bitmap.width implies x = 0
y_reset_if_out_of_range: y >= a_bitmap.height implies y = 0
set_offset (a_x: like x; a_y: like y)

-- Set offset to a_x a_y.

require
a_x_in_range: a_x >= 0 and a_x < bitmap.width
a_y_in_range: a_y >= 0 and a_y < bitmap.width
ensure
x_set: x = a_x
y_set: y = a_y

feature -- Drawing

draw_on (a_widget: EM_WIDGET)

-- Draw background on a_widget.

-- (From EM_BACKGROUND)

require
a_widget_not_void: a_widget /= Void

invariant

x_in_range: x >= 0 and x < bitmap.width
y_in_range: y >= 0 and y < bitmap.width

bitmap_not_void: bitmap /= Void

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

end