Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CascadeScreen Class Reference

represents the physical screen More...

#include <cascade/graphics/CascadeScreen.h>

Inheritance diagram for CascadeScreen:

CascadeBitmap CascadeObject List of all members.

Public Types

enum  VideoConnector {
  kVGA = 0, kComponent = 1, kSVideo = 2, kComposite = 3,
  kNumConnectors = kComposite + 1
}
enum  VideoMode { kNTSC = 0, kPAL = 1, kRGB = 2, kNumModes = kRGB + 1 }

Public Member Functions

 CascadeScreen ()
virtual ~CascadeScreen ()
virtual void LockScreen ()
virtual void UnlockScreen ()
virtual bool SetScreenResolution (u32 index)
virtual void GetCurrentScreenResolution (u32 &index)
virtual u32 GetNumScreenResolutionsSupported ()
virtual bool GetSupportedScreenResolutionAt (u32 nIndex, u32 &nWidthToSet, u32 &nHeightToSet, u8 &nBitDepthToSet, bool &bDoubleBufferedToSet)
virtual void SwapBuffers (const CascadeRect &afterSwapCopyRect)
virtual bool SetOutputResolution (u32 nIndex)
virtual void GetCurrentOutputResolution (u32 &nIndexToSet)
virtual u32 GetNumOutputResolutionsSupported ()
virtual bool GetSupportedOutputResolutionAt (u32 nIndex, u32 &nWidthToSet, u32 &nHeightToSet, bool &bProgressiveToSet, VideoConnector &connectorToSet, VideoMode &modeToSet, u32 &nRefreshRateToSet)
virtual bool GetOutputResolutionScaleRect (u32 nIndex, CascadeRect &scaleRectToSet)
virtual bool SetOutputResolutionScaleRect (u32 nIndex, const CascadeRect &scaleRect)
virtual bool WaitForVBILineZero ()
virtual bool SetBypassMode (bool bBypass)
virtual bool GetBypassMode ()
virtual bool Create (const CascadeDims &dims, CascadeBitmap::RamType=CascadeBitmap::kEither)
virtual bool CreateFromBitmapFile (CascadeFile &bitmapFile, CascadeBitmap::RamType=CascadeBitmap::kEither)
virtual bool Destroy ()
virtual void FrameRect (const CascadeRect &rect, const CascadeColor &color)
virtual void FillRect (const CascadeRect &rect, const CascadeColor &color)
virtual void DrawLine (const CascadePoint &start, const CascadePoint &end, const CascadeColor &color)
virtual void TextOut (const CascadePoint &point, const CascadeString &string, const CascadeFont &font, const CascadeColor &color, u32 nFlags=TEXTOUT_TOP)
virtual bool DrawText (CascadeFont &font, const CascadeRect &rect, const CascadeString &string, const CascadeColor &color, u32 nFlags)
virtual void Blit (const CascadePoint &point, const CascadeBitmap &source, const CascadeRect &sourceRect)
virtual void Blit (const CascadePoint &point, CascadeSharedMemZone &sourceZone, u32 nZoneOffset, u32 nPixelWidth, u32 nPixelHeight, u32 nBitDepth, const CascadeRect &sourceRect)
virtual bool GrabBits (const CascadeRect &sourceRect, CascadeSharedMemZone &destZone, u32 nZoneOffset)
virtual void GetPixel (const CascadePoint &point, CascadeColor &colorToSet) const
virtual void SetPixel (const CascadePoint &point, const CascadeColor &color)
virtual CascadeDims GetDims () const
virtual u8 GetColorDepth () const
virtual void Flush ()
virtual void * GetMemory ()

Detailed Description

represents the physical screen

Skip the description

CascadeScreen represents the physical screen and provides drawing onto the physical screen using the same semantics as drawing on a CascadeBitmap, from which CascadeScreen is derived. Drawing directly on a CascadeScreen results in drawing directly on the screen. Clients can instantiate as many instances of CascadeScreen as they like - each instance represents the same physical screen. Before the client can draw on or otherwise use the screen it must be locked. Only one instance of CascadeScreen can lock the screen at a time. After drawing is complete, clients must unlock the screen before anyone else can use on the screen. If a client calls a function with the screen unlocked, the function will lock the screen, perform the function, and unlock the screen. As a result it is usually a good idea to manually lock the screen around multiple consecutive drawing operations as it will yield better performance.

    Example usage:
    MyDrawProc()
    {
        CascadeScreen screen;
        screen.Lock();
        screen.FillRect(screen.GetRect(), CascadeColor(255, 0, 0));
        screen.Unlock();    // unlock happens automatically when screen is destructed
    }


class CascadeScreen


Member Enumeration Documentation

enum CascadeScreen::VideoConnector
 

represents a type of Connector graphics output is being sent to

VideoConnector is used as an argument to the GetSupportedOutputResolutionAt() function.

See also:
GetNumOutputResolutionSupported(), SetOutputResolution(), GetCurrentOutputResolution()
Enumeration values:
kVGA  VGA connector.
kComponent  Component (YPrPb).
kSVideo  S-Video.
kComposite  Composite.
kNumConnectors 

enum CascadeScreen::VideoMode
 

Enumeration values:
kNTSC  NTSC (Never Twice the Same Color).
kPAL  PAL (Palsy Approaching Line-rate).
kRGB  RGB (RGB).
kNumModes 


Constructor & Destructor Documentation

CascadeScreen::CascadeScreen  ) 
 

The CascadeScreen constructor - lightweight.

This base class constructor is lightweight.

virtual CascadeScreen::~CascadeScreen  )  [virtual]
 

Destructor.

This destructor will automatically unlock the screen if it is locked.


Member Function Documentation

virtual void CascadeScreen::Blit const CascadePoint point,
CascadeSharedMemZone sourceZone,
u32  nZoneOffset,
u32  nPixelWidth,
u32  nPixelHeight,
u32  nBitDepth,
const CascadeRect sourceRect
[virtual]
 

copies bits from a shared memory zone to the bitmap

This version of Blit() operates on a source bitmap that is contained in a CascadeSharedMemZone and defined by the following parameters:

Parameters:
point the destination point where to place the copied bits
sourceZone the shared memory zone to copy bits from
nZoneOffset the byte offset from the start of the zone where the bitmap bits start
nPixelWidth the width in pixels of the source bitmap
nPixelHeight the height in pixels of the source bitmap
nBitDepth the number of bits per pixel of the bits in the source bitmap
sourceRect the source rectangle of bits to be copied from the sourceZone
Note:
Currently the only pixel format supported is 32bpp RGBA.

the sourceZone passed in must be an Open() zone, but not MapLocked().

Reimplemented from CascadeBitmap.

virtual void CascadeScreen::Blit const CascadePoint point,
const CascadeBitmap source,
const CascadeRect sourceRect
[virtual]
 

copies bits from bitmap to bitmap

Blit does a simple SRCCOPY bit block transfer from the sourceRect on the bitmap described by source to the destination point.

Parameters:
point the destination point where to place the copied bits
source the source bitmap containing the bits to be copied
sourceRect the source rectangle of bits to be copied from the source bitmap

Reimplemented from CascadeBitmap.

virtual bool CascadeScreen::Create const CascadeDims dims,
CascadeBitmap::RamType  = CascadeBitmap::kEither
[inline, virtual]
 

overriden to make Create() a noop on screens

Create() is overridden from CascadeBitmap to be a noop for CascadeScreen

See also:
CascadeBitmap::Create()

virtual bool CascadeScreen::CreateFromBitmapFile CascadeFile bitmapFile,
CascadeBitmap::RamType  = CascadeBitmap::kEither
[inline, virtual]
 

overriden to make CreateFromBitmapFile() a noop on screens

CreateFromBitmapFile() is overridden from CascadeBitmap to be a noop for CascadeScreen

See also:
CascadeBitmap::CreateFromBitmapFile()

virtual bool CascadeScreen::Destroy  )  [inline, virtual]
 

overriden to make Destroy() a noop on screens

Destroy() is overridden from CascadeBitmap to be a noop for CascadeScreen

See also:
CascadeBitmap::Destroy()

Reimplemented from CascadeBitmap.

virtual void CascadeScreen::DrawLine const CascadePoint start,
const CascadePoint end,
const CascadeColor color
[virtual]
 

draws a 1 pixel line

DrawLine() draws a 1 pixel width line from start to end in the color color

Parameters:
start the starting point of the line
end the ending point of the line
color the color to draw the line with

Reimplemented from CascadeBitmap.

virtual bool CascadeScreen::DrawText CascadeFont font,
const CascadeRect rect,
const CascadeString string,
const CascadeColor color,
u32  nFlags
[virtual]
 

formats and draws a text string on the bitmap

DrawText() is a text rendering primitive that allows the client to specify alignment, clipping, and wrapping of the text string. The output text is positioned relative to rectangle rect.

		    The following flags are supported:
		    TEXT_CENTER_VERTICALLY
		    TEXT_CENTER_HORIZONTALLY
		    TEXT_JUSTIFY_LEFT
		    TEXT_JUSTIFY_TOP
		    TEXT_JUSTIFY_BOTTOM
		    TEXT_JUSTIFY_RIGHT
		    TEXT_WORD_WRAP
		    TEXT_CLIP
		    TEXT_CLIP_WITH_DOTDOTDOT
		    TEXT_MEASURE_ONLY
		    
Parameters:
font the font to use to output the text
rect the rect with which to position the text
string the text to output
color the color to use to output the text
nFlags the flags to use TEXT_CENTER_VERTICALLY
See also:
TEXT_CENTER_HORIZONTALLY, TEXT_JUSTIFY_LEFT, TEXT_JUSTIFY_TOP, TEXT_JUSTIFY_BOTTOM, TEXT_JUSTIFY_RIGHT, TEXT_WORD_WRAP, TEXT_CLIP, TEXT_CLIP_WITH_DOTDOTDOT, TEXT_MEASURE_ONLY

Reimplemented from CascadeBitmap.

virtual void CascadeScreen::FillRect const CascadeRect rect,
const CascadeColor color
[virtual]
 

fills a rectangle with a color

FillRect() fills the rectangle described by rect with the color color

Parameters:
rect the rectangle to fill
color the color to fill the rectangle with
See also:
FrameRect()

Reimplemented from CascadeBitmap.

virtual void CascadeScreen::Flush  )  [virtual]
 

flushes the pipeline of graphics drawing calls

Flush() flushes the pipeline of graphics calls. It should only be needed in certain circumstances when writing to graphics memory directly.

See also:
CascadeScreen::GetMemory()

Reimplemented from CascadeBitmap.

virtual void CascadeScreen::FrameRect const CascadeRect rect,
const CascadeColor color
[virtual]
 

draws a 1 pixel wide rectangle frame

FrameRect() draws the 1-pixel outline of the rectangle described by rect with the color color

Parameters:
rect the rectangle to draw
color the color to draw the rectangle
See also:
FillRect()

Reimplemented from CascadeBitmap.

virtual bool CascadeScreen::GetBypassMode  )  [virtual]
 

returns whether or not the screen is in video bypass mode

GetBypassMode() returns true if the unit is in video bypass mode, false if the unit is not in video bypass mode (the default).

Returns:
true if in bypass mode, false if not in bypass mode

virtual u8 CascadeScreen::GetColorDepth  )  const [virtual]
 

gets the color depth of the bitmap in bits-per-pixel

GetColorDepth() returns the color depth of the bitmap in bits per pixel.

Returns:
the color depth of the bitmap in bits per pixel

Reimplemented from CascadeBitmap.

virtual void CascadeScreen::GetCurrentOutputResolution u32 nIndexToSet  )  [virtual]
 

gets the current output resolution

GetCurrentOutputResolution() sets the parameters passed in with the current output resolution settings.

Parameters:
nIndexToSet the variable to receive the index of the current output resolution
See also:
SetOutputResolution()

GetNumOutputResolutionsSupported(), GetSupportedOutputResolutionAt()

virtual void CascadeScreen::GetCurrentScreenResolution u32 index  )  [virtual]
 

gets the current screen resolution

GetCurrentScreenResolution() sets the reference parameters passed in with the current screen resolution settings.

Parameters:
index the variable to receive the index of the current screen resolution
See also:
SetScreenResolution()

GetNumScreenResolutionsSupported(), GetSupportedScreenResolutionAt()

virtual CascadeDims CascadeScreen::GetDims  )  const [virtual]
 

gets the dimensions of the bitmap

GetDims() returns the dimensions of the bitmap.

Returns:
the dimensions of the bitmap

Reimplemented from CascadeBitmap.

virtual void* CascadeScreen::GetMemory  )  [virtual]
 

returns a pointer to the screen memory

GetMemory() is overridden from CascadeBitmap and returns a pointer to the screen memory. The screen memory is layed out as 32bpp ARGB with GetDims().h rows of GetDims().w 32 bit pixels. (Each row is GetDims().w * 4 bytes). The total number of bytes of memory is therefore 4 * GetDims().w * GetDims().h.

Note:
CAUTION: This screen memory pointer is only valid while the screen is locked and until SwapBuffers() is called (handled automatically during a CascadeApp OnPaint() cycle. The screen is automatically locked during the entire CascadeApp OnPaint() cycle, or between times when you explicitly call Lock() and Unlock().

If you want to write to the screen outside of a CascadeApp OnPaint() cycle (not recommended), then you should do this: CascadeScreen screen; CascadeRect scribbleRect; // set this to the rectangle you're going to modify screen.Lock(); void * pMemory = screen.GetMemory(); // do optional screen drawing calls (confined within scribbleRect). screen.Flush(); // if you did drawing flush to make sure the drawing calls get to the screen before the scribble // scribble on pMemory (confined within scribbleRect) screen.SwapBuffers(scribbleRect); // to see your changes; note pMemory IS NOW INVALID!!! screen.SwapBuffers(CascadeRect(0, 0, 0, 0)); // this is temporary, currently necessary due to unresolved interaction with the window manager screen.Unlock();

CAUTION: Don't write off the end of this memory or you will crash the entire system!!

CAUTION: Check the return value to ensure you get a non-NULL pointer!

Returns:
a pointer to the screen memory or NULL if memory not accessible.
See also:
LockScreen()

UnlockScreen()

CascadeBitmap::OnPaint()

Reimplemented from CascadeBitmap.

virtual u32 CascadeScreen::GetNumOutputResolutionsSupported  )  [virtual]
 

gets the number of output resolutions supported

GetNumOutputResolutionsSupported() returns the number of discrete output resolutions supported. Use the return value from this function minus one as the upper bound to the function GetSupportedOutputResolutionAt().

Returns:
the number of output resolutions supported
See also:
GetCurrentOutputResolution(), SetOutputResolution()

GetSupportedOutputResolutionAt()

virtual u32 CascadeScreen::GetNumScreenResolutionsSupported  )  [virtual]
 

gets the number of screen resolutions that are supported

GetNumScreenResolutionsSupported() returns the number of discrete screen resolutions supported. Use the return value from this function minus one as the upper bound to the function GetSupportedScreenResolutionAt().

Returns:
the number of screen resolutions supported
See also:
SetScreenResolution(), GetScreenResolution()

GetSupportedScreenResolutionAt()

virtual bool CascadeScreen::GetOutputResolutionScaleRect u32  nIndex,
CascadeRect scaleRectToSet
[virtual]
 

gets the output scale rect for a given output resolution

GetOutputResolutionScaleRect() sets scaleRectToSet with the output resolution scaling rectangle for the output resolution identified by nIndex. For example, if the output resolution is set to 720p (1280x720), the output resolution scale rect by default will be CascadeRect(0, 0, 1280, 720). The output resolution scale rect is the rectangle that the output resolution will be scaled to on the display. The purpose for setting the output resolution scale rect is to center and size the output resolution on a display device.

Parameters:
nIndex the index of the output resolution
scaleRectToSet the CascadeRect to receive the scale rect
Returns:
true if nIndex is a valid output resolution, false otherwise
See also:
SetOutputResolutionScaleRect

virtual void CascadeScreen::GetPixel const CascadePoint point,
CascadeColor colorToSet
const [virtual]
 

gets the color of a pixel located at a specific point

GetPixel() sets colorToSet with the color value of the pixel located at point.

Parameters:
point the point of the pixel to retrieve
colorToSet a reference to the
See also:
SetPixel()

Reimplemented from CascadeBitmap.

virtual bool CascadeScreen::GetSupportedOutputResolutionAt u32  nIndex,
u32 nWidthToSet,
u32 nHeightToSet,
bool &  bProgressiveToSet,
VideoConnector connectorToSet,
VideoMode modeToSet,
u32 nRefreshRateToSet
[virtual]
 

gets the parameters of a specific supported output resolution

GetSupportedOutputResolutionAt() sets the reference parameters passed in with the output resolution parameters for the supported output resolution at index nIndex. Valid values for nIndex are 0 to (the return value of GetNumOutputResolutionsSupported() - 1).

Parameters:
nIndex the index of the supported output resolution to get info about
nWidthToSet the variable to receive the width of the output resolution at nIndex
nHeightToSet the variable to receive the height of the output resolution at nIndex
bProgressiveToSet the variable to receive whether or not the output resolution at nIndex is progressive
connectorToSet the variable to receive the VideoConnector of the output resolution at nIndex
modeToSet the variable to receive the VideoMode of the output resolution at nIndex
nRefreshRateToSet the variable to receive the refresh rate in HZ of the output resolution at nIndex
Returns:
true if nIndex was valid and variables were set, false otherwise
See also:
GetCurrentOutputResolution(), SetOutputResolution()

GetNumOutputResolutionsSupported()

virtual bool CascadeScreen::GetSupportedScreenResolutionAt u32  nIndex,
u32 nWidthToSet,
u32 nHeightToSet,
u8 nBitDepthToSet,
bool &  bDoubleBufferedToSet
[virtual]
 

gets the parameters of a specific supported screen resolution

GetSupportedResolutionAt() sets the reference parameters passed in with the screen resolution parameters for the supported screen resolution at index nIndex. Valid values for nIndex are 0 to (the return value of GetNumScreenResolutionsSupported() - 1).

Parameters:
nIndex the index of the supported resolution to get info about
nWidthToSet the variable to receive the width of the screen resolution at nIndex
nHeightToSet the variable to receive the height of the screen resolution at nIndex
nBitDepthToSet the variable to receive the bit depth of the screen resolution at nIndex
bDoubleBufferedToSet the variable to receive whether or not the screen resolution at nIndex is double buffered
Returns:
true if nIndex was valid and variables were set, false otherwise
See also:
SetScreenResolution(), GetScreenResolution()

GetNumScreenResolutionsSupported()

virtual bool CascadeScreen::GrabBits const CascadeRect sourceRect,
CascadeSharedMemZone destZone,
u32  nZoneOffset
[virtual]
 

copies bits from the bitmap to a shared memory zone

GrabBits() copies bits from the sourceRect of this bitmap to the shared memory zone identified by destZone using the following parameters. If GrabBits() returns true, sourceRect.w * sourceRect.h 32bit RGBA words were copied to destZone starting at nZoneOffset.

Parameters:
sourceRect the rectangle on this bitmap to grab bits from
sourceZone the shared memory zone to copy bits top
nZoneOffset the byte offset from the start of the zone where the bitmap bits should be copied
Note:
Currently the only pixel format supported is 32bpp RGBA.

the sourceZone passed in must be an Open() zone, but not MapLocked().

Reimplemented from CascadeBitmap.

virtual void CascadeScreen::LockScreen  )  [virtual]
 

locks the screen

Call LockScreen() to lock the screen. LockScreen() will block the calling process until the screen lock is acquired. Calls to LockScreen() nest.

See also:
UnlockScreen()

virtual bool CascadeScreen::SetBypassMode bool  bBypass  )  [virtual]
 

sets video bypass mode on or off

SetBypassMode turns on or off bypass mode. If bypass mode is on, video input will be routed directly to video output (bypassing the internal video processor). If bypass mode is off (the default), then the internal video processor outputs to the video output.

Parameters:
bBypass whether or not bypass mode should be on (true) or off (false - the default).
Returns:
true if successful, false otherwise

virtual bool CascadeScreen::SetOutputResolution u32  nIndex  )  [virtual]
 

sets the output resolution

SetOutputResolution() causes the hardware output resolution (that sent to the output display device) to be set to the indexed resolution SetOutputResolution() returns true if successful, false otherwise. Call GetNumOutputResolutionsSupported() and GetSupportedOutputResolutionAt() to determine what output resolutions are supported. When the output resolution is changed successfully, a CascadeScreenMessage so indicating is broadcast to all wormholes on the local host.

Note:
If SetOutputResolution() is called with the parameters of the current output resolution setting, then SetOutputResolution() returns true without broadcasting a CascadeScreenMessage.
Parameters:
nIndex the new index of the screen output
Returns:
true if successful, false otherwise
See also:
GetCurrentOutputResolution()

GetNumOutputResolutionsSupported(), GetSupportedOutputResolutionAt()

virtual bool CascadeScreen::SetOutputResolutionScaleRect u32  nIndex,
const CascadeRect scaleRect
[virtual]
 

sets the output scale rect for a given output resolution

SetOutputResolutionScaleRect() sets the output resolution scale rect for a particular output resolution. The output resolution scale rect is the rectangle that the output resolution will be scaled to on the display. The output resolution scale rect is used to adjust the output resolution to fit on a particular display. By default the output resolution scale rect is set to the same as the output resolution. Once the output resolution scale rect is modified for a particular output resolution, that scale rect is remembered across boot sessions.

Parameters:
nIndex the index of the output resolution for which to set the output scale rect
scaleRect the output scale rect
Returns:
true if nIndex is a valid output resolution and the scale rect was set successfully, false otherwise
See also:
GetOutputResolutionScaleRect

virtual void CascadeScreen::SetPixel const CascadePoint point,
const CascadeColor color
[virtual]
 

sets the color for a pixel located at a specific point

SetPixel() sets the pixel located at point with the color value of color.

Parameters:
point the point of the pixel to set
color the color value for the pixel to set
See also:
GetPixel()

Reimplemented from CascadeBitmap.

virtual bool CascadeScreen::SetScreenResolution u32  index  )  [virtual]
 

sets the screen resolution

SetScreenResolution() causes the screen resolution to be set to nWidth x nHeight x nBitDepth returning true if successful, false otherwise. The SCREEN resolution is the resolution used for drawing onto the screen. Contrast this with the OUTPUT resolution which may be different (scaled) to match the resolution of the display device. Call GetNumScreenResolutionsSupported() and GetSupportedScreenResolutionAt() to determine what SCREEN resolutions are supported. When the screen changes resolution successfully, a CascadeScreenMessage so indicating is broadcast to all wormholes on the local host.

Note:
If SetScreenResolution() is called with the parameters of the current settings, then SetScreenResolution() returns true without broadcasting a CascadeScreenMessage.
Parameters:
index is the index of the screen resolution supported
Returns:
true if successful, false otherwise
See also:
GetCurrentScreenResolution()

GetNumScreenResolutionsSupported(), GetSupportedScreenResolutionAt()

virtual void CascadeScreen::SwapBuffers const CascadeRect afterSwapCopyRect  )  [virtual]
 

swaps the buffers of a double-buffered screen

SwapBuffers() causes double-buffered screens to swap their buffers. If the screen is not double buffered, SwapBuffers() has no effect. After the buffers are swapped, afterSwapCopyRect bits are copied from the new front buffer to the new back buffer, so that subsequent drawing operations on the new back buffer are correct. To do a swap with no copy, pass in CascadeRect(0, 0, 0, 0) as your afterSwapCopyRect.

Parameters:
afterSwapCopyRect the rectangle to copy from the new front buffer to the new back buffer
See also:
SetScreenResolution()

virtual void CascadeScreen::TextOut const CascadePoint point,
const CascadeString string,
const CascadeFont font,
const CascadeColor color,
u32  nFlags = TEXTOUT_TOP
[virtual]
 

draws a text string on the bitmap

TextOut() is a simple text output function that outputs the string string in the font font in the color color at the location point.

Reimplemented from CascadeBitmap.

virtual void CascadeScreen::UnlockScreen  )  [virtual]
 

unlocks the screen

Call UnlockScreen() when you are finished using a screen for drawing.

Note:
be sure to call UnlockScreen() for every time you call LockScreen().
See also:
LockScreen()

virtual bool CascadeScreen::WaitForVBILineZero  )  [virtual]
 

blocks the calling process until VBI line 0 is reached

WaitForVBILineZero() causes the calling process to block until the screen refresh reaches vbi line zero returning true if successful, false if the underlying hardware doesn't support waiting until VBI line zero is reached.

Returns:
whether or not the wait was successful and VBI line zero was reached


The documentation for this class was generated from the following file:
Generated on Sun Jul 24 14:27:20 2005 for Cascade Library by  doxygen 1.4.1