Package VisionEgg :: Module Core :: Class Screen
[frames | no frames]

Class Screen

         object --+    
                  |    
ClassWithParameters --+
                      |
                     Screen


An OpenGL window, possibly displayed across multiple displays.

A Screen instance is an OpenGL window for the Vision Egg to draw
in.  For an instance of Screen to do anything useful, it must
contain one or more instances of the Viewport class and one or
more instances of the Stimulus class.

Currently, only one OpenGL window is supported by the library with
which the Vision Egg initializes graphics (pygame/SDL).  However,
this need not limit display to a single physical display device.
Many video drivers, for example, allow applications to treat two
separate monitors as one large array of contiguous pixels.  By
sizing a window such that it occupies both monitors and creating
separate viewports for the portion of the window on each monitor,
a multiple screen effect can be created.

Public variables
================
size -- Tuple of 2 integers specifying width and height
red_bits -- Integer (or None if not supported) specifying framebuffer depth
green_bits -- Integer (or None if not supported) specifying framebuffer depth
blue_bits -- Integer (or None if not supported) specifying framebuffer depth
alpha_bits -- Integer (or None if not supported) specifying framebuffer depth

Parameters
==========
bgcolor -- background color (AnyOf(Sequence3 of Real or Sequence4 of Real))
           Default: (0.5, 0.5, 0.5, 0.0)

Constant Parameters
===================
frameless     -- remove standard window frame? (Boolean)
                 Default: 0
fullscreen    -- use full screen? (Boolean)
                 Default: 0
hide_mouse    -- hide the mouse cursor? (Boolean)
                 Default: 1
maxpriority   -- raise priority? (platform dependent) (Boolean)
                 Default: 0
preferred_bpp -- preferred bits per pixel (bit depth) (UnsignedInteger)
                 Default: 32
size          -- size (units: pixels) (Sequence2 of Real)
                 Default: (640, 480)
sync_swap     -- synchronize buffer swaps to vertical sync? (Boolean)
                 Default: 1

Method Summary
  __init__(self, **kw)
Create self.parameters and set values.
  __del__(self)
  clear(self)
Called by Presentation instance.
  close(self)
Close the screen.
  create_default()
Alternative constructor using configuration variables. (Static method)
  get_framebuffer_as_array(self, buffer, format, position, anchor, size)
get pixel values from framebuffer to Numeric array...
  get_framebuffer_as_image(self, buffer, format, position, anchor, size)
get pixel values from framebuffer to PIL image...
  get_size(self)
  make_current(self)
Called by Viewport instance.
  measure_refresh_rate(self, average_over_seconds)
Measure the refresh rate.
  put_pixels(self, pixels, position, anchor, scale_x, scale_y, texture_min_filter, texture_mag_filter, internal_format)
Put pixel values to screen.
  query_refresh_rate(self)
  set_gamma_ramp(self, *args, **kw)
Set the gamma_ramp, if supported.
  set_size(self, value)
    Inherited from ClassWithParameters
  get_specified_type(self, parameter_name)
  is_constant_parameter(self, parameter_name)
  set(self, **kw)
Set a parameter with type-checked value This is the slow but safe way to set parameters.
  verify_parameters(self)
Perform type check on all parameters...
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name...
  __getattribute__(...)
x.__getattribute__('name') <==> x.name...
  __hash__(x)
x.__hash__() <==> hash(x)...
  __reduce__(...)
helper for pickle...
  __reduce_ex__(...)
helper for pickle...
  __repr__(x)
x.__repr__() <==> repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value...
  __str__(x)
x.__str__() <==> str(x)...
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T...

Property Summary
  size

Class Variable Summary
member_descriptor __cursor_visible_func__ = <member '__cursor_visible_func...
member_descriptor __pygame_quit__ = <member '__pygame_quit__' of 'Screen' ...
tuple __slots__ = ('parameters', 'constant_parameters', 'red_b...
member_descriptor alpha_bits = <member 'alpha_bits' of 'Screen' objects>
member_descriptor blue_bits = <member 'blue_bits' of 'Screen' objects>
member_descriptor constant_parameters = <member 'constant_parameters' of '...
ParameterDefinition constant_parameters_and_defaults = {'fullscreen': (0, <c...
member_descriptor green_bits = <member 'green_bits' of 'Screen' objects>
member_descriptor parameters = <member 'parameters' of 'Screen' objects>
ParameterDefinition parameters_and_defaults = {'bgcolor': ((0.5, 0.5, 0.5, 0...
member_descriptor red_bits = <member 'red_bits' of 'Screen' objects>

Instance Method Details

__init__(self, **kw)
(Constructor)

Create self.parameters and set values.
Overrides:
VisionEgg.ClassWithParameters.__init__ (inherited documentation)

clear(self)

Called by Presentation instance. Clear the screen.

close(self)

Close the screen.

You can call this to close the screen.  Not necessary during
normal operation because it gets automatically deleted.

get_framebuffer_as_array(self, buffer='back', format=6407, position=(0, 0), anchor='lowerleft', size=None)

get pixel values from framebuffer to Numeric array

get_framebuffer_as_image(self, buffer='back', format=6407, position=(0, 0), anchor='lowerleft', size=None)

get pixel values from framebuffer to PIL image

make_current(self)

Called by Viewport instance. Makes screen active for drawing.

Can not be implemented until multiple screens are possible.

measure_refresh_rate(self, average_over_seconds=0.10000000000000001)

Measure the refresh rate. Assumes swap buffers synced.

put_pixels(self, pixels=None, position=(0, 0), anchor='lowerleft', scale_x=1.0, scale_y=1.0, texture_min_filter=9728, texture_mag_filter=9728, internal_format=6407)

Put pixel values to screen.

Pixel values become texture data using the VisionEgg.Textures
module.  Any source of texture data accepted by that module is
accepted here.

This function could be sped up by allocating a fixed OpenGL texture object.

set_gamma_ramp(self, *args, **kw)

Set the gamma_ramp, if supported.

Call pygame.display.set_gamma_ramp, if available.

Returns True on success, False otherwise.

Static Method Details

create_default()

Alternative constructor using configuration variables.

Most of the time you can create and instance of Screen using
this method.  If your script needs explicit control of the
Screen parameters, initialize with the normal constructor.

Uses VisionEgg.config.VISIONEGG_GUI_INIT to determine how the
default screen parameters should are determined.  If this
value is 0, the values from VisionEgg.cfg are used.  If this
value is 1, a GUI panel is opened and allows manual settings
of the screen parameters.

Property Details

size

Get Method:
get_size(self)
Set Method:
set_size(self, value)

Class Variable Details

__cursor_visible_func__

Type:
member_descriptor
Value:
<member '__cursor_visible_func__' of 'Screen' objects>                 

__pygame_quit__

Type:
member_descriptor
Value:
<member '__pygame_quit__' of 'Screen' objects>                         

__slots__

Type:
tuple
Value:
('parameters',
 'constant_parameters',
 'red_bits',
 'green_bits',
 'blue_bits',
 'alpha_bits',
 '__cursor_visible_func__',
 '__pygame_quit__',
...                                                                    

alpha_bits

Type:
member_descriptor
Value:
<member 'alpha_bits' of 'Screen' objects>                              

blue_bits

Type:
member_descriptor
Value:
<member 'blue_bits' of 'Screen' objects>                               

constant_parameters

Type:
member_descriptor
Value:
<member 'constant_parameters' of 'Screen' objects>                     

constant_parameters_and_defaults

Type:
ParameterDefinition
Value:
{'fullscreen': (0, <class 'VisionEgg.ParameterTypes.Boolean'>, 'use fu\
ll screen?'), 'sync_swap': (1, <class 'VisionEgg.ParameterTypes.Boolea\
n'>, 'synchronize buffer swaps to vertical sync?'), 'preferred_bpp': (\
0, <class 'VisionEgg.ParameterTypes.UnsignedInteger'>, 'preferred bits\
 per pixel (bit depth)'), 'frameless': (0, <class 'VisionEgg.Parameter\
Types.Boolean'>, 'remove standard window frame?'), 'maxpriority': (0, \
<class 'VisionEgg.ParameterTypes.Boolean'>, 'raise priority? (platform\
 dependent)'), 'hide_mouse': (1, <class 'VisionEgg.ParameterTypes.Bool\
...                                                                    

green_bits

Type:
member_descriptor
Value:
<member 'green_bits' of 'Screen' objects>                              

parameters

Type:
member_descriptor
Value:
<member 'parameters' of 'Screen' objects>                              

parameters_and_defaults

Type:
ParameterDefinition
Value:
{'bgcolor': ((0.5, 0.5, 0.5, 0.0), <VisionEgg.ParameterTypes.AnyOf obj\
ect at 0x4037d84c>, 'background color')}                               

red_bits

Type:
member_descriptor
Value:
<member 'red_bits' of 'Screen' objects>                                

Generated by Epydoc 2.0 on Fri Sep 19 18:29:39 2003 http://epydoc.sf.net