OSDL::Video::VideoModule Class Reference

Root module for all video needs. More...

#include <OSDLVideo.h>

Collaboration diagram for OSDL::Video::VideoModule:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool hasScreenSurface () const
 Returns whether a screen surface is available.
virtual SurfacegetScreenSurface () const
 Returns the current screen surface, if any.
virtual void setScreenSurface (Surface &newScreenSurface)
 Assigns a new surface to the screen surface.
virtual bool hasRenderer () const
 Tells whether this video module uses a (video) renderer.
virtual Rendering::VideoRenderergetRenderer () const
 Returns the video renderer currently used.
virtual void setRenderer (Rendering::VideoRenderer &newRenderer)
 Sets a new video renderer.
virtual bool hasOpenGLContext () const
 Tells whether this video module has an OpenGL context.
virtual void setOpenGLContext (OpenGL::OpenGLContext &newOpenGLContext)
 Sets a new OpenGL context.
virtual OpenGL::OpenGLContextgetOpenGLContext () const
 Returns the OpenGL context currently used.
virtual BitsPerPixel getBestColorDepthForMode (Length width, Length height, BitsPerPixel askedBpp, Ceylan::Flags flags)
 Returns what is the closest recommended bits per pixel choice for specified video mode, according to specified bits per pixel target.
virtual bool isDisplayInitialized () const
 Tells whether the display is currently running, i.e.
virtual bool isGUIEnabled () const
 Tells whether a GUI (Graphical User Interface) is being managed by this video module.
virtual void setGUIEnableStatus (bool newStatus)
 Determines whether a GUI (Graphical User Interface) should be used.
virtual Ceylan::Flags setMode (Length width, Length height, BitsPerPixel askedBpp, Ceylan::Flags flags, OpenGL::Flavour flavour=OpenGL::None)
 Tries to sets up a video mode with the specified width, height and bits-per-pixel.
virtual void resize (Length newWidth, Length newHeight)
 Does everything needed when the application is resized, including calling setMode and updating OpenGL state if necessary.
virtual void redraw ()
 This method should be called whenever the screen needs to be redrawn, for example if the window manager asks for it.
virtual void toggleFullscreen ()
 Toggles the application between windowed and fullscreen mode, if supported.
virtual void makeBMPScreenshot (const std::string &screenshotFilename)
 Performs a screenshot of onscreen content, and saves it in a BMP file whose name is specified.
virtual bool getEndPointDrawState () const
 Tells whether line endpoint (final pixel) should be drawn.
virtual void setEndPointDrawState (bool newState)
 Sets the draw-endpoint mode.
virtual bool getAntiAliasingState () const
 Tells whether graphics should be anti-aliased, if possible.
virtual void setAntiAliasingState (bool newState)
 Sets the anti-aliasing mode.
virtual std::string getDriverName () const
 Returns the name of the video driver being currently used (example: 'x11').
virtual void setWindowCaption (const std::string &newTitle, const std::string &iconName)
 Sets the window title and icon name.
virtual void getWindowCaption (std::string &title, std::string &iconName)
 Gets the window title and icon name.
virtual void setWindowIcon (const std::string &filename)
 Sets the icon for the display window.
virtual bool iconifyWindow ()
 Iconifies (minimizes) the window.
virtual Ceylan::Float32 getAverageRefreshRate ()
 Returns the current average refresh rate (in frames per second) of the screen surface, since its creation.
virtual bool isUsingOpenGL () const
 Tells whether OpenGL is being used currently by this video module.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns an user-friendly description of the state of this object.

Static Public Member Functions

static bool IsDisplayInitialized ()
 Tells whether display has already been initialized (VideoModule::setMode called).
static bool GetEndPointDrawState ()
 Tells whether the last pixel of a segment of line should be drawn.
static bool GetAntiAliasingState ()
 Tells whether antialiasing is wanted.
static std::string GetDriverName ()
 Returns the name of the video driver being currently used (example: 'x11').
static std::string InterpretFlags (Ceylan::Flags flags)
 Describes specified video flags according to the semantics used in setMode.
static bool HardwareSurfacesCanBeCreated ()
 Returns whether hardware surfaces can be created.
static bool WindowManagerAvailable ()
 Returns whether there is a window manager available.
static bool HardwareToHardwareBlitsAccelerated ()
 Returns whether hardware to hardware blits are accelerated.
static bool HardwareToHardwareColorkeyBlitsAccelerated ()
 Returns whether hardware to hardware colorkey blits are accelerated.
static bool HardwareToHardwareAlphaBlitsAccelerated ()
 Returns whether hardware to hardware alpha blits are accelerated.
static bool SoftwareToHardwareBlitsAccelerated ()
 Returns whether software to hardware blits are accelerated.
static bool SoftwareToHardwareColorkeyBlitsAccelerated ()
 Returns whether software to hardware colorkey blits are accelerated.
static bool SoftwareToHardwareAlphaBlitsAccelerated ()
 Returns whether software to hardware alpha blits are accelerated.
static bool ColorFillsAccelerated ()
 Returns whether color fills are accelerated.
static Ceylan::Uint32 GetVideoMemorySize ()
 Returns the total amount of video memory, in kilobytes.
static Pixels::PixelFormat GetVideoDevicePixelFormat ()
 Returns the native format of the video device.
static std::string DescribeVideoCapabilities ()
 Returns a summary of video chain capabilities.
static bool AreDefinitionsRestricted (std::list< Definition > &definitions, Ceylan::Flags flags, Pixels::PixelFormat *pixelFormat=0)
 Tells whether definitions are restricted for the specified flags and pixel format.
static std::string DescribeAvailableDefinitions (Ceylan::Flags flags, Pixels::PixelFormat *pixelFormat=0)
 Returns a summary of available screen definitions for specified flags and pixel format.
static StandardScreenSize ToStandardScreenSize (const std::string &standardScreenSizeInText)
 Returns the standard screen size corresponding to the specified text.
static void ToScreenDimensions (StandardScreenSize screenSize, Length &screenWidth, Length &screenHeight)
 Returns (in specified variables) the screen dimensions corresponding to the specified physical standard screen size.
static std::string DescribeEnvironmentVariables ()
 Returns a summary about the possible use of video-related environment variables, for the selected back-end, expressed in specified format.
static bool IsUsingOpenGL ()
 Returns whether OpenGL is being used, at least by one video module.
static bool IsUsingDrawingPrimitives ()
 Returns whether drawing primitives can be rendered.

Static Public Attributes

static const BitsPerPixel UseCurrentColorDepth = 0
 Tells setMode that the color depth of the current display should be used.
static const Ceylan::Flags SoftwareSurface = 0x00000000
 Indicates that the screen surface is to be stored in system memory.
static const Ceylan::Flags HardwareSurface = 0x00000001
 Indicates that the screen surface is to be stored in video memory.
static const Ceylan::Flags AsynchronousBlit = 0x00000004
 Enables the use of asynchronous updates of the display surface.
static const Ceylan::Flags AnyPixelFormat = 0x10000000
 Indicates that the screen surface may use any pixel format.
static const Ceylan::Flags ExclusivePalette = 0x20000000
 Indicates that a surface should have an exclusive palette.
static const Ceylan::Flags DoubleBuffered = 0x40000000
 Indicates that the screen surface is to be double buffered.
static const Ceylan::Flags FullScreen = 0x80000000
 Indicates that the screen surface is to be full screen, not windowed.
static const Ceylan::Flags OpenGL = 0x00000002
 Indicates that the screen surface should have an OpenGL context.
static const Ceylan::Flags Resizable = 0x00000010
 Indicates that the screen surface is to be resizable.
static const Ceylan::Flags NoFrame = 0x00000020
 Indicates that a window which would correspond to a screen surface should have no title bar nor frame decoration, if possible.

Protected Attributes

Surface_screen
 Internal surface corresponding to the screen.
bool _displayInitialized
 Keeps tracks of setMode calls, be OpenGL used or not.
bool _isGuiEnabled
 Tells whether a graphical user interface is to be managed.
Rendering::VideoRenderer_renderer
 The video renderer being used, if any.

Static Protected Attributes

static bool _IsUsingOpenGL = false
 Caches the current state relative to the current use of OpenGL.
static bool _DrawEndPoint = false
 Caches the current state relative to final pixel drawing for lines.
static bool _AntiAliasing = true
 Caches the current state relative to antialiasing.
static const Ceylan::Uint16 DriverNameMaximumLength = 50
 The maximum length for the name of the display driver.

Private Member Functions

 VideoModule ()
 Private constructor to be sure it will not be implicitly called.
virtual ~VideoModule () throw ()
 Basic virtual private destructor.
 VideoModule (const VideoModule &source)
 Copy constructor made private to ensure that it will never be called.
VideoModuleoperator= (const VideoModule &source)
 Assignment operator made private to ensure that it will never be called.

Private Attributes

OpenGL::OpenGLContext_openGLcontext
 The current OpenGL context, if OpenGL is used.
bool _drawEndPoint
 Records the current state relative to final pixel drawing for lines.
bool _antiAliasing
 Records the current antialiasing state.
Ceylan::System::Second _screenStartingSecond
 Stores the second at which the screen surface (if any) was created, to compute its average refresh rate (frames per second).
Ceylan::System::Microsecond _screenStartingMicrosecond
 Stores the microsecond at which the screen surface (if any) was created, to compute its average refresh rate (frames per second).

Static Private Attributes

static const std::string _SDLEnvironmentVariables [] = {}
 Array of all known environment variables related to video, for SDL back-end.

Friends

class OSDL::CommonModule

Detailed Description

Root module for all video needs.

Notably manages the screen surface.

Note:
if the video subsystem has already been initialized, calling the static methods returning video informations will apply to the current video mode. If the video subsystem has not already been initialized, those static methods will return informations about the best available video mode.

Definition at line 123 of file OSDLVideo.h.


Constructor & Destructor Documentation

VideoModule::VideoModule (  )  [private]

Private constructor to be sure it will not be implicitly called.

Exceptions:
VideoException if the video subsystem initialization failed.

Definition at line 218 of file OSDLVideo.cc.

References OSDL::CommonModule::BackendSuccess, OSDL::Utils::getBackendLastError(), and OSDL::CommonModule::UseVideo.

VideoModule::~VideoModule (  )  throw () [private, virtual]

Basic virtual private destructor.

Definition at line 284 of file OSDLVideo.cc.

References _openGLcontext, _renderer, _screen, getAverageRefreshRate(), OSDL::Video::Pixels::toString(), and OSDL::CommonModule::UseVideo.

OSDL::Video::VideoModule::VideoModule ( const VideoModule source  )  [explicit, private]

Copy constructor made private to ensure that it will never be called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

bool VideoModule::AreDefinitionsRestricted ( std::list< Definition > &  definitions,
Ceylan::Flags  flags,
Pixels::PixelFormat pixelFormat = 0 
) [static]

Tells whether definitions are restricted for the specified flags and pixel format.

Returns:
false if all definitions are possible for the given pixel format, true if dimensions are restricted, and in this case in the specified list (definitions) available dimension pairs are stored, if any.
Parameters:
definitions an empty list in which dimension pairs will be stored, if not all dimensions are allowed for the given pixel format. The list may remain empty, if nothing is available for specified choice.
flags describes the desired screen surface, with the same meaning as the setMode flags.
format,: desired pixel format. If format is null (0), the definition list will correspond to the "best" mode available.
Exceptions:
VideoException if the operation failed or is not supported.

Definition at line 1919 of file OSDLVideo.cc.

References LOG_DEBUG_VIDEO, LOG_TRACE_VIDEO, and OSDL::Video::Pixels::toString().

Referenced by DescribeAvailableDefinitions().

bool VideoModule::ColorFillsAccelerated (  )  [static]

Returns whether color fills are accelerated.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1747 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

string VideoModule::DescribeAvailableDefinitions ( Ceylan::Flags  flags,
Pixels::PixelFormat pixelFormat = 0 
) [static]

Returns a summary of available screen definitions for specified flags and pixel format.

Parameters:
flags describes a target screen surface, with the same meaning as the setMode flags.
format,: desired pixel format. If format is null (0), the definition list will correspond to the "best" mode available.
Exceptions:
VideoException if the operation failed.

Definition at line 2004 of file OSDLVideo.cc.

References AreDefinitionsRestricted(), LOG_TRACE_VIDEO, and OSDL::Video::Pixels::toString().

string VideoModule::DescribeEnvironmentVariables (  )  [static]

Returns a summary about the possible use of video-related environment variables, for the selected back-end, expressed in specified format.

Note:
The SDL back-end can be partly driven by a set of environment variables.

Definition at line 2172 of file OSDLVideo.cc.

References _SDLEnvironmentVariables, and toString().

string VideoModule::DescribeVideoCapabilities (  )  [static]
bool VideoModule::GetAntiAliasingState (  )  [static]

Tells whether antialiasing is wanted.

Note:
This method is static so that calling it is convenient: no need to explicitly retrieve the common module, then the video module, before knowing the result.

The need to retrieve the right module from scratch at each call is rather inefficient though.

Definition at line 1345 of file OSDLVideo.cc.

References _AntiAliasing, getAntiAliasingState(), OSDL::getExistingCommonModule(), OSDL::CommonModule::getVideoModule(), OSDL::hasExistingCommonModule(), OSDL::CommonModule::hasVideoModule(), and OSDL::Video::Pixels::toString().

Referenced by OSDL::Video::TwoDimensional::drawCircle(), OSDL::Video::TwoDimensional::drawEllipse(), OSDL::Video::TwoDimensional::drawPolygon(), OSDL::Video::TwoDimensional::drawTriangle(), and OSDL::Video::Surface::resize().

bool VideoModule::getAntiAliasingState (  )  const [virtual]

Tells whether graphics should be anti-aliased, if possible.

Note:
Belongs to the state machine settings.
Returns:
true if anti-aliasing mode is set, false otherwise.

Definition at line 1041 of file OSDLVideo.cc.

References _antiAliasing.

Referenced by GetAntiAliasingState().

Ceylan::Float32 VideoModule::getAverageRefreshRate (  )  [virtual]

Returns the current average refresh rate (in frames per second) of the screen surface, since its creation.

Exceptions:
VideoException if the operation failed, including if no screen surface is actually available.

Definition at line 1184 of file OSDLVideo.cc.

References _screen, _screenStartingMicrosecond, _screenStartingSecond, and OSDL::Video::Surface::getUpdateCount().

Referenced by ~VideoModule().

BitsPerPixel VideoModule::getBestColorDepthForMode ( Length  width,
Length  height,
BitsPerPixel  askedBpp,
Ceylan::Flags  flags 
) [virtual]

Returns what is the closest recommended bits per pixel choice for specified video mode, according to specified bits per pixel target.

Parameters are the same, and have the same meaning, as setMode's ones.

Returns:
0 if the requested mode is not supported under any bit depth, or returns the bits-per-pixel of the closest available mode with the given width, height and requested surface flags.

Definition at line 429 of file OSDLVideo.cc.

string VideoModule::GetDriverName (  )  [static]

Returns the name of the video driver being currently used (example: 'x11').

See also:
getDriverName.
Exceptions:
VideoException if the operation failed.

Definition at line 1393 of file OSDLVideo.cc.

References DriverNameMaximumLength.

Referenced by getDriverName().

std::string VideoModule::getDriverName (  )  const [virtual]

Returns the name of the video driver being currently used (example: 'x11').

See also:
GetDriverName
Exceptions:
VideoException if the operation failed.

Definition at line 1062 of file OSDLVideo.cc.

References GetDriverName().

bool VideoModule::GetEndPointDrawState (  )  [static]

Tells whether the last pixel of a segment of line should be drawn.

Note:
This method is static so that calling it is convenient: no need to explicitly retrieve the common module, then the video module, before knowing the result.

The need to retrieve the right module from scratch at each call is rather inefficient though.

Definition at line 1295 of file OSDLVideo.cc.

References _DrawEndPoint, getEndPointDrawState(), OSDL::getExistingCommonModule(), OSDL::CommonModule::getVideoModule(), OSDL::hasExistingCommonModule(), OSDL::CommonModule::hasVideoModule(), and OSDL::Video::Pixels::toString().

bool VideoModule::getEndPointDrawState (  )  const [virtual]

Tells whether line endpoint (final pixel) should be drawn.

Note:
Belongs to the state machine settings.
Returns:
true if draw-endpoint mode is set, false otherwise.

Definition at line 1020 of file OSDLVideo.cc.

References _drawEndPoint.

Referenced by GetEndPointDrawState().

OpenGL::OpenGLContext & VideoModule::getOpenGLContext (  )  const [virtual]

Returns the OpenGL context currently used.

Returns:
the current OpenGL context.
Exceptions:
VideoException if no OpenGL context was being used.

Definition at line 401 of file OSDLVideo.cc.

References _openGLcontext.

OSDL::Rendering::VideoRenderer & VideoModule::getRenderer (  )  const [virtual]

Returns the video renderer currently used.

Returns:
the current video renderer.
Exceptions:
VideoException if no renderer was being used.

Definition at line 367 of file OSDLVideo.cc.

References _renderer.

Surface & VideoModule::getScreenSurface (  )  const [virtual]

Returns the current screen surface, if any.

The video module keeps ownership of the returned surface: the caller should not deallocate it.

Exceptions:
VideoException if no screen surface is available.

Definition at line 329 of file OSDLVideo.cc.

References _screen.

Referenced by makeBMPScreenshot(), and OSDL::Video::Overlay::Overlay().

Pixels::PixelFormat VideoModule::GetVideoDevicePixelFormat (  )  [static]

Returns the native format of the video device.

Returns:
If the graphics system has already been initialized (using setMode), returns the pixel format of the current video mode, otherwise returns the pixel format of the "best" available video mode.
Exceptions:
VideoException if the information could not be obtained.

Definition at line 1797 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

Ceylan::Uint32 VideoModule::GetVideoMemorySize (  )  [static]

Returns the total amount of video memory, in kilobytes.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1773 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

void VideoModule::getWindowCaption ( std::string &  title,
std::string &  iconName 
) [virtual]

Gets the window title and icon name.

Parameters:
title the current window title.
iconName the icon name
Note:
Uses the specified strings to return title and icon.

Definition at line 1085 of file OSDLVideo.cc.

bool VideoModule::HardwareSurfacesCanBeCreated (  )  [static]

Returns whether hardware surfaces can be created.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1546 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

bool VideoModule::HardwareToHardwareAlphaBlitsAccelerated (  )  [static]

Returns whether hardware to hardware alpha blits are accelerated.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1646 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

bool VideoModule::HardwareToHardwareBlitsAccelerated (  )  [static]

Returns whether hardware to hardware blits are accelerated.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1594 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

bool VideoModule::HardwareToHardwareColorkeyBlitsAccelerated (  )  [static]

Returns whether hardware to hardware colorkey blits are accelerated.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1620 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

bool VideoModule::hasOpenGLContext (  )  const [virtual]

Tells whether this video module has an OpenGL context.

Definition at line 392 of file OSDLVideo.cc.

References _openGLcontext.

Referenced by isUsingOpenGL(), and setMode().

bool VideoModule::hasRenderer (  )  const [virtual]

Tells whether this video module uses a (video) renderer.

Definition at line 358 of file OSDLVideo.cc.

References _renderer.

bool VideoModule::hasScreenSurface (  )  const

Returns whether a screen surface is available.

Definition at line 320 of file OSDLVideo.cc.

References _screen.

bool VideoModule::iconifyWindow (  )  [virtual]

Iconifies (minimizes) the window.

Note:
If the application is running in a window managed environment, this method attempts to iconify (minimise) it. If this call is successful, the application will receive an ApplicationFocus loss event.
Returns:
true on success, false if iconification is not supported or was refused by the window manager.

Definition at line 1166 of file OSDLVideo.cc.

string VideoModule::InterpretFlags ( Ceylan::Flags  flags  )  [static]

Describes specified video flags according to the semantics used in setMode.

Note:
One shall not call this method on flags used with a surface. Use Surface::interpretFlags instead, since their meaning is different.
See also:
setMode.

Definition at line 1416 of file OSDLVideo.cc.

References AnyPixelFormat, AsynchronousBlit, DoubleBuffered, ExclusivePalette, FullScreen, HardwareSurface, NoFrame, OpenGL, Resizable, and toString().

Referenced by setMode().

bool VideoModule::IsDisplayInitialized (  )  [static]
bool VideoModule::isDisplayInitialized (  )  const [virtual]

Tells whether the display is currently running, i.e.

if it has already been initialized and not been shut down at the moment.

Definition at line 447 of file OSDLVideo.cc.

References _displayInitialized.

Referenced by IsDisplayInitialized(), and setWindowIcon().

bool VideoModule::isGUIEnabled (  )  const [virtual]

Tells whether a GUI (Graphical User Interface) is being managed by this video module.

Definition at line 455 of file OSDLVideo.cc.

References _isGuiEnabled.

bool VideoModule::IsUsingDrawingPrimitives (  )  [static]

Returns whether drawing primitives can be rendered.

Note:
This basically boils down to returning whether SDL_gfx is available. This is useful for example from a test which should not fail if the use of SDL_gfx was disabled.
Exceptions:
VideoException if the information could not be obtained.

Definition at line 2233 of file OSDLVideo.cc.

bool VideoModule::IsUsingOpenGL (  )  [static]

Returns whether OpenGL is being used, at least by one video module.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 2225 of file OSDLVideo.cc.

References _IsUsingOpenGL.

bool VideoModule::isUsingOpenGL (  )  const [virtual]

Tells whether OpenGL is being used currently by this video module.

Definition at line 1207 of file OSDLVideo.cc.

References hasOpenGLContext().

void VideoModule::makeBMPScreenshot ( const std::string &  screenshotFilename  )  [virtual]

Performs a screenshot of onscreen content, and saves it in a BMP file whose name is specified.

Parameters:
screenshotFilename the target screenshot filename
Exceptions:
VideoException if the operation failed.
Note:
This method exists mainly for platforms lacking Surface support (ex: the Nintendo DS, whose screenshots represent only the content of the main core), even if it will work on Surface-enabled platforms (in this case it will operate on the screen surface, if any).
See also:
Surface::savePNG, Surface::saveBMP.

Definition at line 875 of file OSDLVideo.cc.

References getScreenSurface(), and OSDL::Video::Surface::saveBMP().

VideoModule& OSDL::Video::VideoModule::operator= ( const VideoModule source  )  [private]

Assignment operator made private to ensure that it will never be called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void VideoModule::redraw (  )  [virtual]

This method should be called whenever the screen needs to be redrawn, for example if the window manager asks for it.

Depending on a renderer being used or not, the screen will be managed.

Definition at line 786 of file OSDLVideo.cc.

References _screen, and OSDL::Video::Surface::redraw().

Referenced by OSDL::Events::EventsModule::enterBasicMainLoop(), and OSDL::Events::EventsModule::onScreenNeedsRedraw().

void VideoModule::resize ( Length  newWidth,
Length  newHeight 
) [virtual]

Does everything needed when the application is resized, including calling setMode and updating OpenGL state if necessary.

Parameters:
newWidth the new width of the application window.
newHeight the new height of the application window.

Definition at line 749 of file OSDLVideo.cc.

References _openGLcontext, _screen, OSDL::Video::Surface::getBitsPerPixel(), OSDL::Video::Surface::getFlags(), OSDL::Video::OpenGL::None, OSDL::Video::OpenGL::Reload, setMode(), and OSDL::Video::Pixels::toString().

Referenced by OSDL::Events::EventsModule::onResizedWindow().

void VideoModule::setAntiAliasingState ( bool  newState  )  [virtual]

Sets the anti-aliasing mode.

Note:
Belongs to the state machine settings.
Parameters:
newState the new anti-aliasing mode, activated if and only if true.

Definition at line 1050 of file OSDLVideo.cc.

References _AntiAliasing, and _antiAliasing.

void VideoModule::setEndPointDrawState ( bool  newState  )  [virtual]

Sets the draw-endpoint mode.

Note:
Belongs to the state machine settings.
Parameters:
newState the new draw-endpoint mode, activated if and only if true.

Definition at line 1029 of file OSDLVideo.cc.

References _DrawEndPoint, and _drawEndPoint.

void VideoModule::setGUIEnableStatus ( bool  newStatus  )  [virtual]

Determines whether a GUI (Graphical User Interface) should be used.

Parameters:
newStatus the new enable status of the GUI.

Definition at line 464 of file OSDLVideo.cc.

References _isGuiEnabled.

Referenced by OSDL::CommonModule::enableGUI().

Ceylan::Flags VideoModule::setMode ( Length  width,
Length  height,
BitsPerPixel  askedBpp,
Ceylan::Flags  flags,
OpenGL::Flavour  flavour = OpenGL::None 
) [virtual]

Tries to sets up a video mode with the specified width, height and bits-per-pixel.

Requested flags will be respected on a best effort basis, actually obtained flags will be returned.

Parameters:
width the client width (not counting window manager decorations) of the application window.
height the client height (not counting window manager decorations) of the application window.
askedBpp the requested color depth, in bits per pixel. If UseCurrentColorDepth (null) is specified, then the color depth of the display will be used.
flags describes the desired features, such as SoftwareSurface, Resizable, etc. One particularly useful feature is DoubleBuffered, since it allows to suppress most of the tearing on most platforms. Flags must be OR'd together (ex: VideoModule::SoftwareSurface || VideoModule::Resizable), specify 0 if not wanting to activate any of these features.
flavour the selected OpenGL flavour, if any, and if OpenGL is being used (see VideoModule::OpenGL setMode flag). Flavours have to be selected no later than this call.
Returns:
the flags that were actually obtained
Exceptions:
VideoException if the setting of the new mode failed.
See also:
SDL counter-part, SDL_SetVideoMode (defined in http://sdldoc.csn.ul.ie/sdlsetvideomode.php)
Note:
If OpenGL is used, then asking for double-buffering (flag DoubleBuffered) is strongly recommended since it prevents nasty visual tearing.

Definition at line 475 of file OSDLVideo.cc.

References _displayInitialized, _isGuiEnabled, _openGLcontext, _screen, _screenStartingMicrosecond, _screenStartingSecond, OSDL::Video::Surface::ClassicalScreenSurface, DoubleBuffered, OSDL::Utils::getBackendLastError(), OSDL::Video::Surface::getBitsPerPixel(), OSDL::Video::Surface::getFlags(), OSDL::Video::Surface::getHeight(), OSDL::Video::Surface::getPixelFormat(), OSDL::Video::Surface::getWidth(), hasOpenGLContext(), InterpretFlags(), LOG_WARNING_VIDEO, OSDL::Video::OpenGL::None, OpenGL, OSDL::Video::OpenGL::OpenGLFor2D, OSDL::Video::OpenGL::OpenGLFor3D, OSDL::Video::Surface::OpenGLScreenSurface, OSDL::Video::OpenGL::OpenGLContext::reload(), OSDL::Video::OpenGL::Reload, OSDL::Video::OpenGL::OpenGLContext::selectFlavour(), setOpenGLContext(), OSDL::Video::OpenGL::OpenGLContext::setViewPort(), OSDL::Video::OpenGL::OpenGLContext::toString(), toString(), OSDL::Video::Surface::toString(), and OSDL::Video::Pixels::toString().

Referenced by resize().

void VideoModule::setOpenGLContext ( OpenGL::OpenGLContext newOpenGLContext  )  [virtual]

Sets a new OpenGL context.

If a previous OpenGL context was used, it will be deleted first.

Note:
The OpenGL context will be owned by this Video module and deallocated as such.

Definition at line 414 of file OSDLVideo.cc.

References _IsUsingOpenGL, and _openGLcontext.

Referenced by setMode().

void VideoModule::setRenderer ( Rendering::VideoRenderer newRenderer  )  [virtual]

Sets a new video renderer.

This renderer will be in charge of all the subsequently view graphical rendering.

If a previous renderer was used, it will be deleted.

Note:
The renderer will be owned by this Video module and deallocated as such.

Definition at line 380 of file OSDLVideo.cc.

References _renderer.

void VideoModule::setScreenSurface ( Surface newScreenSurface  )  [virtual]

Assigns a new surface to the screen surface.

Parameters:
newScreenSurface the new screen surface, which must already have a display type corresponding to a screen surface (i.e. not BackBuffer).
See also:
Surface::setDisplayType
Exceptions:
VideoException if the display type of the specified surface does not correspond to a screen surface.

Definition at line 342 of file OSDLVideo.cc.

References _screen, OSDL::Video::Surface::BackBuffer, OSDL::Video::Surface::getDisplayType(), and OSDL::Video::Surface::toString().

void VideoModule::setWindowCaption ( const std::string &  newTitle,
const std::string &  iconName 
) [virtual]

Sets the window title and icon name.

Parameters:
newTitle the new window title.
iconName the new icon name.

Definition at line 1071 of file OSDLVideo.cc.

void VideoModule::setWindowIcon ( const std::string &  filename  )  [virtual]

Sets the icon for the display window.

Parameters:
filename the name of the file containing the icon. Its format (ex: PNG) should be auto-detected.
Note:
Win32 icons must be 32x32.
This function must be called before the first call to setMode.
The specified surface will have to be deallocated on exit by the user code.
See also:
LoadImage

Definition at line 1106 of file OSDLVideo.cc.

References OSDL::Video::Surface::getSDLSurface(), isDisplayInitialized(), OSDL::Video::TwoDimensional::Image::LoadIcon(), and LOG_DEBUG_VIDEO.

bool VideoModule::SoftwareToHardwareAlphaBlitsAccelerated (  )  [static]

Returns whether software to hardware alpha blits are accelerated.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1721 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

bool VideoModule::SoftwareToHardwareBlitsAccelerated (  )  [static]

Returns whether software to hardware blits are accelerated.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1671 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

bool VideoModule::SoftwareToHardwareColorkeyBlitsAccelerated (  )  [static]

Returns whether software to hardware colorkey blits are accelerated.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1696 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().

void VideoModule::toggleFullscreen (  )  [virtual]

Toggles the application between windowed and fullscreen mode, if supported.

Note:
X11 is the only target currently supported, BeOS support is experimental.

Definition at line 806 of file OSDLVideo.cc.

References _screen, OSDL::Utils::getBackendLastError(), and OSDL::Video::Surface::getSDLSurface().

void VideoModule::ToScreenDimensions ( StandardScreenSize  screenSize,
Length screenWidth,
Length screenHeight 
) [static]

Returns (in specified variables) the screen dimensions corresponding to the specified physical standard screen size.

Parameters:
screenSize the screen size whose dimensions are to be determined (ex: Size_640x480).
screenWidth the variable that will be set to the width corresponding to the specified size
screenHeight the variable that will be set to the height corresponding to the specified size
Exceptions:
VideoException if the operation failed, i.e. if the specified screen size is not known, or if it corresponds to a logical size (ex: Size_FullScreen) rather instead of a physical one (ex: Size_640x480).

Definition at line 2122 of file OSDLVideo.cc.

References OSDL::Video::Size_1024x780, OSDL::Video::Size_1280x1024, OSDL::Video::Size_1680x1050, OSDL::Video::Size_640x480, OSDL::Video::Size_800x600, OSDL::Video::Size_FullScreen, and OSDL::Video::Pixels::toString().

StandardScreenSize VideoModule::ToStandardScreenSize ( const std::string &  standardScreenSizeInText  )  [static]

Returns the standard screen size corresponding to the specified text.

Parameters:
standardScreenSizeInText the textual description of the standard screen size
Exceptions:
VideoException if the operation failed, i.e. if the specified text could not be converted into a known screen size.

Definition at line 2078 of file OSDLVideo.cc.

References OSDL::Video::Size_1024x780, OSDL::Video::Size_1280x1024, OSDL::Video::Size_1680x1050, OSDL::Video::Size_640x480, OSDL::Video::Size_800x600, OSDL::Video::Size_FullScreen, and OSDL::Video::Pixels::toString().

const string VideoModule::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns an user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

Definition at line 1215 of file OSDLVideo.cc.

References _isGuiEnabled, _openGLcontext, _renderer, _screen, OSDL::Video::OpenGL::OpenGLContext::toString(), OSDL::Rendering::VideoRenderer::toString(), and OSDL::Video::Surface::toString().

Referenced by DescribeEnvironmentVariables(), InterpretFlags(), and setMode().

bool VideoModule::WindowManagerAvailable (  )  [static]

Returns whether there is a window manager available.

Exceptions:
VideoException if the information could not be obtained.

Definition at line 1570 of file OSDLVideo.cc.

Referenced by DescribeVideoCapabilities().


Friends And Related Function Documentation

friend class OSDL::CommonModule [friend]

Definition at line 129 of file OSDLVideo.h.


Member Data Documentation

Records the current antialiasing state.

Note:
Default value: true.
Private to ensure cache consistency is enforced.

Definition at line 1168 of file OSDLVideo.h.

Referenced by getAntiAliasingState(), and setAntiAliasingState().

bool VideoModule::_AntiAliasing = true [static, protected]

Caches the current state relative to antialiasing.

Note:
This cached value can be used to avoid overhead in case of very frequent reads with only one video module instanciated (the general case).

Definition at line 1124 of file OSDLVideo.h.

Referenced by GetAntiAliasingState(), and setAntiAliasingState().

Keeps tracks of setMode calls, be OpenGL used or not.

Definition at line 1073 of file OSDLVideo.h.

Referenced by isDisplayInitialized(), and setMode().

Records the current state relative to final pixel drawing for lines.

Note:
Default value: false.
Private to ensure cache consistency is enforced.

Definition at line 1156 of file OSDLVideo.h.

Referenced by getEndPointDrawState(), and setEndPointDrawState().

bool VideoModule::_DrawEndPoint = false [static, protected]

Caches the current state relative to final pixel drawing for lines.

Note:
This cached value can be used to avoid overhead in case of very frequent reads with only one video module instanciated (the general case).

Definition at line 1112 of file OSDLVideo.h.

Referenced by GetEndPointDrawState(), and setEndPointDrawState().

Tells whether a graphical user interface is to be managed.

Definition at line 1081 of file OSDLVideo.h.

Referenced by isGUIEnabled(), setGUIEnableStatus(), setMode(), and toString().

bool VideoModule::_IsUsingOpenGL = false [static, protected]

Caches the current state relative to the current use of OpenGL.

Note:
This cached value can be used to avoid overhead in case of very frequent reads with only one video module instanciated (the general case).

Definition at line 1099 of file OSDLVideo.h.

Referenced by IsUsingOpenGL(), and setOpenGLContext().

The current OpenGL context, if OpenGL is used.

Note:
Private to ensure cache consistency is enforced.

Definition at line 1143 of file OSDLVideo.h.

Referenced by getOpenGLContext(), hasOpenGLContext(), resize(), setMode(), setOpenGLContext(), toString(), and ~VideoModule().

The video renderer being used, if any.

Definition at line 1086 of file OSDLVideo.h.

Referenced by getRenderer(), hasRenderer(), setRenderer(), toString(), and ~VideoModule().

Internal surface corresponding to the screen.

Definition at line 1065 of file OSDLVideo.h.

Referenced by getAverageRefreshRate(), getScreenSurface(), hasScreenSurface(), redraw(), resize(), setMode(), setScreenSurface(), toggleFullscreen(), toString(), and ~VideoModule().

Ceylan::System::Microsecond OSDL::Video::VideoModule::_screenStartingMicrosecond [private]

Stores the microsecond at which the screen surface (if any) was created, to compute its average refresh rate (frames per second).

Definition at line 1195 of file OSDLVideo.h.

Referenced by getAverageRefreshRate(), and setMode().

Ceylan::System::Second OSDL::Video::VideoModule::_screenStartingSecond [private]

Stores the second at which the screen surface (if any) was created, to compute its average refresh rate (frames per second).

Definition at line 1186 of file OSDLVideo.h.

Referenced by getAverageRefreshRate(), and setMode().

const std::string VideoModule::_SDLEnvironmentVariables = {} [static, private]

Array of all known environment variables related to video, for SDL back-end.

See http://sdldoc.csn.ul.ie/sdlenvvars.php.

Definition at line 1247 of file OSDLVideo.h.

Referenced by DescribeEnvironmentVariables().

const Ceylan::Flags VideoModule::AnyPixelFormat = 0x10000000 [static]

Indicates that the screen surface may use any pixel format.

Definition at line 995 of file OSDLVideo.h.

Referenced by InterpretFlags().

const Ceylan::Flags VideoModule::AsynchronousBlit = 0x00000004 [static]

Enables the use of asynchronous updates of the display surface.

Definition at line 990 of file OSDLVideo.h.

Referenced by InterpretFlags().

const Ceylan::Flags VideoModule::DoubleBuffered = 0x40000000 [static]

Indicates that the screen surface is to be double buffered.

Works also if OpenGL is used.

Note:
The vast majority of applications should request that feature.

Definition at line 1013 of file OSDLVideo.h.

Referenced by InterpretFlags(), and setMode().

const Ceylan::Uint16 VideoModule::DriverNameMaximumLength = 50 [static, protected]

The maximum length for the name of the display driver.

Definition at line 1129 of file OSDLVideo.h.

Referenced by GetDriverName().

const Ceylan::Flags VideoModule::ExclusivePalette = 0x20000000 [static]

Indicates that a surface should have an exclusive palette.

Definition at line 1000 of file OSDLVideo.h.

Referenced by InterpretFlags().

const Ceylan::Flags VideoModule::FullScreen = 0x80000000 [static]

Indicates that the screen surface is to be full screen, not windowed.

Definition at line 1022 of file OSDLVideo.h.

Referenced by InterpretFlags().

const Ceylan::Flags VideoModule::HardwareSurface = 0x00000001 [static]

Indicates that the screen surface is to be stored in video memory.

Definition at line 981 of file OSDLVideo.h.

Referenced by InterpretFlags().

const Ceylan::Flags VideoModule::NoFrame = 0x00000020 [static]

Indicates that a window which would correspond to a screen surface should have no title bar nor frame decoration, if possible.

Definition at line 1049 of file OSDLVideo.h.

Referenced by InterpretFlags().

const Ceylan::Flags VideoModule::OpenGL = 0x00000002 [static]

Indicates that the screen surface should have an OpenGL context.

Definition at line 1031 of file OSDLVideo.h.

Referenced by InterpretFlags(), and setMode().

const Ceylan::Flags VideoModule::Resizable = 0x00000010 [static]

Indicates that the screen surface is to be resizable.

Definition at line 1039 of file OSDLVideo.h.

Referenced by InterpretFlags().

const Ceylan::Flags VideoModule::SoftwareSurface = 0x00000000 [static]

Indicates that the screen surface is to be stored in system memory.

Definition at line 972 of file OSDLVideo.h.

Referenced by OSDL::Video::OpenGL::GLTexture::setUpInternalSurfaceFrom().

Tells setMode that the color depth of the current display should be used.

Convenient for applications running into a window. This value is equal to zero.

Definition at line 351 of file OSDLVideo.h.


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 14:06:07 2010 for OSDL by  doxygen 1.6.3