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

em.video

Class EM_PIXELFORMAT


Direct ancestors

SDL_VIDEO_FUNCTIONS_EXTERNAL

Creation

Features

Invariants

indexing

description

Pixelformat for the EiffelMedia library.

date

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

revision

$Revision: 1.9 $

class

EM_PIXELFORMAT

create

make (a_pointer: POINTER)

-- Create from a_pointer.

feature -- Access

alpha: INTEGER

-- Overall surface alpha value

alpha_loss: INTEGER

-- Precision loss of alpha component
-- (Used to get a full 8bit value in non-32bit mode)

alpha_mask: INTEGER

-- Binary mask used to retrieve alpha component from a pixel

alpha_shift: INTEGER

-- Binary left shift of alpha component in a pixel value

bits_per_pixel: INTEGER

-- Number of bits for each pixel
-- If the number of bits is 8 (i.e. 1 byte) then pixel-value denotes an entry in the 'palette'

blue_loss: INTEGER

-- Precision loss of blue component
-- (Used to get a full 8bit value in non-32bit mode)

blue_mask: INTEGER

-- Binary mask used to retrieve blue component from a pixel

blue_shift: INTEGER

-- Binary left shift of blue component in a pixel value

bytes_per_pixel: INTEGER

-- Number of bytes for each pixel
-- If the number of bytes is 1 then each pixel-value denotes an entry in the 'palette'

colorkey: INTEGER

-- Color value that is set to be transparent

green_loss: INTEGER

-- Precision loss of green component
-- (Used to get a full 8bit value in non-32bit mode)

green_mask: INTEGER

-- Binary mask used to retrieve green component from a pixel

green_shift: INTEGER

-- Binary left shift of green component in a pixel value

palette: EM_PALETTE

-- Color palette
-- This is only available if 'bits_per_pixel' is 8

require
has_palette: has_palette
ensure
palette_not_void: Result /= Void
red_loss: INTEGER

-- Precision loss of red component
-- (Used to get a full 8bit value in non-32bit mode)

red_mask: INTEGER

-- Binary mask used to retrieve red component from a pixel

red_shift: INTEGER

-- Binary left shift of red component in a pixel value

feature -- Element change

set_alpha (a_value: INTEGER)

-- Set alpha to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
ensure
alpha_set: alpha = a_value
set_alpha_loss (a_value: INTEGER)

-- Set alpha_loss to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
set_alpha_mask (a_value: INTEGER)

-- Set alpha_mask to a_vlaue.
-- Note: By setting this manually you can break the application!

set_alpha_shift (a_value: INTEGER)

-- Set alpha_shift to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
set_bits_per_pixel (a_value: INTEGER)

-- Set bits_per_pixel to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
set_blue_loss (a_value: INTEGER)

-- Set blue_loss to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
set_blue_mask (a_value: INTEGER)

-- Set blue_mask to a_value.
-- Note: By setting this manually you can break the application!

set_blue_shift (a_value: INTEGER)

-- Set blue_shift to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
set_bytes_per_pixel (a_value: INTEGER)

-- Set bytes_per_pixel to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
set_colorkey (a_value: INTEGER)

-- Set colorkey to a_value.
-- Note: By setting this manually you can break the application!

ensure
colorkey_set: colorkey = a_value
set_green_loss (a_value: INTEGER)

-- Set green_loss to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
set_green_mask (a_value: INTEGER)

-- Set green_mask to a_value.
-- Note: By setting this manually you can break the application!

set_green_shift (a_value: INTEGER)

-- Set green_shift to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
set_palette (a_palette: like palette)

-- Set palette to a_palette.

require
has_palette: has_palette
set_red_loss (a_value: INTEGER)

-- Set red_loss to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255
set_red_mask (a_value: INTEGER)

-- Set red_mask to a_value.
-- Note: By setting this manually you can break the application!

set_red_shift (a_value: INTEGER)

-- Set red_shift to a_value.
-- Note: By setting this manually you can break the application!

require
a_value_in_range: 0 <= a_value and a_value <= 255

feature -- Conversion

color_to_pixel_value (a_color: EM_COLOR): INTEGER

-- Convert a_color to pixel value.

pixel_value_to_color (pixel_value: INTEGER): EM_COLOR

-- Convert pixel_value into a color object.

require
if_palette_pixel_value_in_range: has_palette implies 0 <= pixel_value and pixel_value < palette.number_of_colors
ensure
color_not_void: Result /= Void

feature -- Status

has_palette: BOOLEAN

-- Does Current have a palette?

feature {EM_SURFACE} -- Implementation

sdl_pixel_format_struct: SDL_PIXEL_FORMAT_STRUCT

-- SDL struct of format

invariant


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

end