indexing description: "[ A one-color background with an alpha value. Only widgets which have a parent can have a transparent background. This means that a widget wich is placed directly on a EM_COMPONENT_SCENE can not have a transparent background. ]" date: "$Date$" revision: "$Revision$" class EM_ALPHA_COLOR_BACKGROUND inherit EM_TRANSPARENT_BACKGROUND redefine draw_on end EM_BITMAP_BACKGROUND export {NONE} bitmap, set_bitmap redefine draw_on end create make_from_color feature {NONE} -- Initialisation make_from_color (a_color: like color) is -- Initialise background with `a_color'. require a_color_not_void: a_color /= Void do Bitmap_factory.create_empty_bitmap (256, 256) make_from_bitmap (bitmap_factory.last_bitmap) set_color (a_color) ensure color_set: color = a_color end feature -- Access color: EM_COLOR -- Background color feature -- Element change set_color (a_color: like color) is -- Set `color' to `a_color'. require a_color_not_void: a_color /= Void do color := a_color bitmap.fill (color) set_alpha_value (color.alpha) ensure color_set: color = a_color end set_alpha_value (alpha: INTEGER) is -- Set alpha value of `color' to `alpha'. require alpha_in_range: 0 <= alpha and alpha <= 255 do color.set_alpha (alpha) bitmap.set_alpha_value (alpha) ensure alpha_set: color.alpha = alpha end feature -- Drawing draw_on (a_widget: EM_WIDGET) is -- Draw background on`a_widget'. do Precursor {EM_TRANSPARENT_BACKGROUND} (a_widget) Precursor {EM_BITMAP_BACKGROUND} (a_widget) end invariant color_not_void: color /= Void end