indexing description: "[ Background with a stretched bitmap. The bitmap will be repeated if necessary. ]" date: "$Date$" revision: "$Revision$" class EM_STRETCHED_BITMAP_BACKGROUND inherit EM_BITMAP_BACKGROUND create make_from_bitmap, make_from_file, make_from_bitmap_stretched, make_from_file_stretched feature {NONE} -- Initialisation make_from_file_stretched (a_filename: STRING; a_width, a_height: INTEGER) is -- Initialise background with image denoted by `a_filename' and -- new bitmap dimensions `a_width' `a_height'. require a_filename_not_void: a_filename /= Void a_width_positive: a_width > 0 a_height_positive: a_height > 0 do Bitmap_factory.create_bitmap_from_image (a_filename) make_from_bitmap_stretched (Bitmap_factory.last_bitmap, a_width, a_height) ensure bitmap_set: bitmap /= Void bitmap_width_set: bitmap.width = a_width bitmap_height_set: bitmap.height = a_height end make_from_bitmap_stretched (a_bitmap: like bitmap; a_width, a_height: INTEGER) is -- Initialise background with `a_bitmap' and new bitmap dimensions `a_width' `a_height'. require a_bitmap_not_void: a_bitmap /= Void a_width_positive: a_width > 0 a_height_positive: a_height > 0 do if a_bitmap.width /= a_width or a_bitmap.height /= a_height then Bitmap_factory.create_stretched_bitmap (a_bitmap, a_width/a_bitmap.width, a_height/a_bitmap.height) make_from_bitmap (Bitmap_factory.last_bitmap) else make_from_bitmap (a_bitmap) end ensure bitmap_set: bitmap /= Void bitmap_width_set: bitmap.width = a_width bitmap_height_set: bitmap.height = a_height end end