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

Class Viewport

         object --+    
                  |    
ClassWithParameters --+
                      |
                     Viewport


Connects stimuli to a screen.

A viewport defines a (possibly clipped region) of the screen on
which stimuli are drawn.

A screen may have multiple viewports.  The viewports may be
overlapping.

A viewport may have multiple stimuli.

A single stimulus may be drawn simultaneously by several
viewports, although this is typically useful only for 3D stimuli
to represent different views of the same object.

The coordinates of the stimulus are converted to screen
coordinates via several steps, the most important of which is the
projection, which is defined by an instance of the Projection
class.

By default, a viewport has a projection which maps eye coordinates
to viewport coordinates in 1:1 manner.  In other words, eye
coordinates specify pixel location in the viewport.

For cases where pixel units are not natural to describe
coordinates of a stimulus, the application should specify the a
projection other than the default.  This is usually the case for
3D stimuli.

For details of the projection and clipping process, see the
section 'Coordinate Transformations' in the book/online document
'The OpenGL Graphics System: A Specification'

Parameters
==========
anchor      -- How position parameter is interpreted (String)
               Default: lowerleft
depth_range -- depth range (in object units) for rendering (Sequence2 of Real)
               Default: (0, 1)
position    -- Position (in pixel units) within the screen (Sequence2 of Real)
               Default: (0, 0)
projection  -- projection for coordinate transforms (Instance of <class 'VisionEgg.Core.Projection'>)
               Default: (determined at instantiation)
screen      -- The screen in which this viewport is drawn (Instance of <class 'VisionEgg.Core.Screen'>)
               Default: (determined at instantiation)
size        -- Size (in pixel units) (Sequence2 of Real)
               Default: (determined at instantiation)
stimuli     -- sequence of stimuli to draw in screen (Sequence of Instance of <class 'VisionEgg.Core.Stimulus'>)
               Default: (determined at instantiation)

Method Summary
  __init__(self, **kw)
Create a new instance.
  clip_2_window(self, eye_coords_vertex)
Transform clip coordinates to window coordinates...
  draw(self)
Set the viewport and draw stimuli.
  eye_2_window(self, eye_coords_vertex)
Transform eye coordinates to window coordinates...
  make_current(self)
  make_new_pixel_coord_projection(self)
Create instance of Projection mapping eye coordinates 1:1 with pixel coordinates.
  norm_device_2_window(self, norm_device_vertex)
Transform normalized device coordinates to window coordinates...
    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...

Class Variable Summary
tuple __slots__ = ('parameters', 'constant_parameters', '_is_d...
member_descriptor constant_parameters = <member 'constant_parameters' of '...
member_descriptor parameters = <member 'parameters' of 'Viewport' objects>
ParameterDefinition parameters_and_defaults = {'projection': (None, <VisionE...
    Inherited from ClassWithParameters
ParameterDefinition constant_parameters_and_defaults = {}

Method Details

__init__(self, **kw)
(Constructor)

Create a new instance.

Required arguments:

screen

Optional arguments (specify parameter value other than default):

position -- defaults to (0,0), position relative to screen by anchor (see below)
anchor -- defaults to 'lowerleft'
size -- defaults to screen.size
projection -- defaults to self.make_new_pixel_coord_projection()
stimuli -- defaults to empty list
Overrides:
VisionEgg.ClassWithParameters.__init__

clip_2_window(self, eye_coords_vertex)

Transform clip coordinates to window coordinates

draw(self)

Set the viewport and draw stimuli.

eye_2_window(self, eye_coords_vertex)

Transform eye coordinates to window coordinates

make_new_pixel_coord_projection(self)

Create instance of Projection mapping eye coordinates 1:1 with pixel coordinates.

norm_device_2_window(self, norm_device_vertex)

Transform normalized device coordinates to window coordinates

Class Variable Details

__slots__

Type:
tuple
Value:
('parameters', 'constant_parameters', '_is_drawing')                   

constant_parameters

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

parameters

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

parameters_and_defaults

Type:
ParameterDefinition
Value:
{'projection': (None, <VisionEgg.ParameterTypes.Instance object at 0x4\
0c1b72c>, 'projection for coordinate transforms'), 'stimuli': (None, <\
VisionEgg.ParameterTypes.Sequence object at 0x40c1b76c>, 'sequence of \
stimuli to draw in screen'), 'anchor': ('lowerleft', <class 'VisionEgg\
.ParameterTypes.String'>, 'How position parameter is interpreted'), 'd\
epth_range': ((0, 1), <VisionEgg.ParameterTypes.Sequence2 object at 0x\
40c1b6cc>, 'depth range (in object units) for rendering'), 'position':\
 ((0, 0), <VisionEgg.ParameterTypes.Sequence2 object at 0x40c1b68c>, '\
...                                                                    

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