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

em.video

Class EM_BITMAP_FACTORY


Direct ancestors

EM_SHARED_SUBSYSTEMS, EM_SHARED_ERROR_HANDLER, SDL_IMAGE_FUNCTIONS_EXTERNAL, SDL_VIDEO_FUNCTIONS_EXTERNAL, SDL_ROTOZOOM_FUNCTIONS_EXTERNAL, SDL_RWOPS_FUNCTIONS_EXTERNAL, KL_SHARED_FILE_SYSTEM, PLATFORM

Creation

Features

Invariants

indexing

description

Singleton factory that creates objects of type EM_BITMAP.
Use EM_SHARED_BITMAP_FACTORY to access this singleton.

date

$Date: 2005/10/23 16:43:26 $

revision

$Revision: 1.14 $

class

EM_BITMAP_FACTORY

create {EM_SHARED_BITMAP_FACTORY}

make

-- Create new bitmap factory.

feature -- Access

video_subsystem: EM_VIDEO_SUBSYSTEM

-- EiffelMedia video subsystem

-- (From EM_SHARED_SUBSYSTEMS)

ensure
video_subsystem_not_void: Result /= Void
last_bitmap: EM_BITMAP

-- Last bitmap created

last_surface: EM_SURFACE

-- Last surface created

feature -- Bitmap creation

create_bitmap_from_c_array (an_array: POINTER; size: INTEGER)

-- create bitmap using a c array as source.
-- Make new bitmap available via last_bimap.
-- If creation fails set last_bitmap to Void.

create_bitmap_from_image (a_filename: STRING)

-- Create bitmap surface and initialize it using the image
-- from the file named a_filename. Make resulting bitmap
-- available via last_bitmap.
-- If the image could not be loaded an exception is raised.

require
a_filename_not_void: a_filename /= Void
ensure
image_loaded: last_bitmap /= Void
create_bitmap_from_surface_part (a_surface: EM_SURFACE; an_x, a_y, a_width, a_height: INTEGER)

-- Create bitmap with the width a_width and the height
-- a_height. Initialize bitmap with the content of surface
-- a_surface at the frame starting at position (an_x,
-- a_y_pos. Make new bitmap available via last_bimap.
-- If the bitmap could not be created an exception is raised.

require
a_surface_not_void: a_surface /= Void
an_x: an_x >= 0
a_y: a_y >= 0
a_width_positive: a_width > 0
a_height_positive: a_height > 0
ensure
bitmap_created: last_bitmap /= Void
transparent_colorkey_transfered: a_surface.has_transparent_colorkey implies last_bitmap.transparent_colorkey = a_surface.transparent_colorkey
anti_aliasing_as_in_source: a_surface.is_anti_aliasing_enabled = last_bitmap.is_anti_aliasing_enabled
create_empty_alpha_bitmap (a_width, a_height: INTEGER)

-- Create empty surface with the width a_width and the height
-- a_height and in the same format as
-- video_subsystem.video_surface. Make resulting surface
-- available via last_bitmap.
-- If the bitmap could not be created an exception is raised.
-- Note: The created surface has per pixel alpha transparency enabled.
--- As a result of that neither per surface alpha transparency nor a
--- transparent colorkey is enabled.

require
a_width_positive: a_width >= 0
a_height_positive: a_height >= 0
video_subsystem_is_enabled: video_subsystem.is_enabled
ensure
bitmap_created: last_bitmap /= Void
height_set: last_bitmap.height = a_height
width_set: last_bitmap.width = a_width
per_pixel_alpha_enabled: last_bitmap.is_per_pixel_alpha_enabled
create_empty_bitmap (a_width: INTEGER; a_height: INTEGER)

-- Create empty surface with the width a_width and the height
-- a_height in the same format as
-- video_subsystem.video_surface. Make resulting surface
-- available via last_bitmap.
-- If the bitmap could not be created an exception is raised.

require
a_width_positive: a_width >= 0
a_height_positive: a_height >= 0
video_subsystem_is_enabled: video_subsystem.is_enabled
ensure
bitmap_created: last_bitmap /= Void
height_set: last_bitmap.height = a_height
width_set: last_bitmap.width = a_width
create_empty_open_gl_bitmap (a_width:INTEGER; a_height:INTEGER)

-- Create empty OpenGL accelerated surface with the width
-- a_width and height a_height. Make resulting surface
-- available via last_bitmap.
-- If the bitmap could not be created an exception is raised.

ensure
bitmap_created: last_bitmap /= Void
height_set: last_bitmap.height = a_height
width_set: last_bitmap.width = a_width
create_rotated_bitmap (a_surface: EM_SURFACE; an_angle: DOUBLE)

-- Create rotated (by angle an_angle) bitmap from
-- a_surface. Make new bitmap available via last_bimap.
-- If the bitmap could not be created an exception is raised.

require
a_surface_not_void: a_surface /= Void
ensure
transparent_colorkey_transfered: last_bitmap /= Void implies a_surface.has_transparent_colorkey implies last_bitmap.transparent_colorkey = a_surface.transparent_colorkey
anti_aliasing_as_in_source: last_bitmap /= Void implies a_surface.is_anti_aliasing_enabled = last_bitmap.is_anti_aliasing_enabled
create_stretched_bitmap (a_surface: EM_SURFACE; an_x_factor, a_y_factor: DOUBLE)

-- Create stretched (horizontally by an_x_factor, vertically
-- by a_y_factor) bitmap from a_surface. Make new bitmap
-- available via last_bimap.
-- If the bitmap could not be created an exception is raised.

require
a_surface_not_void: a_surface /= Void
an_x_factor_is_positive: an_x_factor > 0
a_y_factor_is_positive: a_y_factor > 0
ensure
bitmap_created: last_bitmap /= Void
transparent_colorkey_transfered: a_surface.has_transparent_colorkey implies last_bitmap.transparent_colorkey = a_surface.transparent_colorkey
anti_aliasing_as_in_source: a_surface.is_anti_aliasing_enabled = last_bitmap.is_anti_aliasing_enabled
create_transformed_bitmap (a_surface: EM_SURFACE; an_x_factor, a_y_factor, an_angle: DOUBLE)

-- Create stretched (horizontally by an_x_factor, vertically
-- by a_y_factor) and rotated (by angle an_angle) bitmap
-- from a_surface. Make new bitmap available via last_bimap
-- If the bitmap could not be created an exception is raised.

require
a_surface_not_void: a_surface /= Void
ensure
bitmap_created: last_bitmap /= Void
transparent_colorkey_transfered: a_surface.has_transparent_colorkey implies last_bitmap.transparent_colorkey = a_surface.transparent_colorkey
anti_aliasing_as_in_source: a_surface.is_anti_aliasing_enabled = last_bitmap.is_anti_aliasing_enabled
create_zoomed_bitmap (a_surface: EM_SURFACE; a_zoom_factor: DOUBLE)

-- Create zoomed (by the factor a_zoom_factor) bitmap from
-- surface a_surface. Make new bitmap available via last_bimap.
-- If the bitmap could not be created an exception is raised.

require
a_surface_not_void: a_surface /= Void
positive_zoom_factor: a_zoom_factor > 0
ensure
bitmap_created: last_bitmap /= Void
transparent_colorkey_transfered: a_surface.has_transparent_colorkey implies last_bitmap.transparent_colorkey = a_surface.transparent_colorkey
anti_aliasing_as_in_source: a_surface.is_anti_aliasing_enabled = last_bitmap.is_anti_aliasing_enabled

feature -- Surface creation

create_empty_alpha_surface (a_width, a_height: INTEGER)

-- Create empty surface with dimension a_width a_height.
-- The format is the same asvideo_subsystem.video_surface.
-- Make resulting surface available via last_surface.
-- If the surface could not be created an exception is raised.
-- Note: The created surface has per pixel alpha transparency enabled.
--- As a result of that neither per surface alpha transparency nor a
--- transparent colorkey is enabled.

require
a_width_positive: a_width >= 0
a_height_positive: a_height >= 0
video_subsystem_is_enabled: video_subsystem.is_enabled
ensure
surface_created: last_surface /= Void
height_set: last_surface.height = a_height
width_set: last_surface.width = a_width
per_pixel_alpha_enabled: last_surface.is_per_pixel_alpha_enabled
create_empty_surface (a_width: INTEGER; a_height: INTEGER)

-- Create empty surface with dimension a_width a_height.
-- The format is the same asvideo_subsystem.video_surface.
-- Make resulting surface available via last_surface.
-- If the surface could not be created an exception is raised.

require
a_width_positive: a_width >= 0
a_height_positive: a_height >= 0
video_subsystem_is_enabled: video_subsystem.is_enabled
ensure
surface_created: last_surface /= Void
height_set: last_surface.height = a_height
width_set: last_surface.width = a_width

invariant


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

end