os::Bitmap Class Reference
[The Syllable Graphical User Interface API]

Container for bitmap-image data. More...

List of all members.

Public Types

enum  {
  ACCEPT_VIEWS = 0x0001,
  SHARE_FRAMEBUFFER = 0x0002,
  NO_ALPHA_CHANNEL = 0x0004
}

Public Member Functions

 Bitmap (int nWidth, int nHeight, color_space eColorSpc, uint32 nFlags=SHARE_FRAMEBUFFER)
 Bitmap constructor.
 Bitmap (int hHandle)
 Create a bitmap from a handle.
virtual ~Bitmap ()
bool IsValid (void) const
int GetHandle (void) const
 Returns the appserver handle.
color_space GetColorSpace () const
 Returns the colorspace of the bitmap.
Rect GetBounds (void) const
 Returns the bounds of the bitmap.
int GetBytesPerRow () const
 Returns the numer of bytes in one bitmap row.
virtual void AddChild (View *pcView)
 Adds a view to the bitmap.
virtual bool RemoveChild (View *pcView)
 Removes a view from the bitmap.
ViewFindView (const char *pzName) const
 Returns the view with the given name.
void Sync (void)
 Flush rendering operations and wait until they have been finished.
void Flush (void)
 Flush rendering operations.
uint8 * LockRaster (void)
 Get a pointer to the raw raster data.
void UnlockRaster ()

Friends

class View
class Window
class Sprite
class Desktop


Detailed Description

Description:
The Bitmap class make it possible to render bitmap graphics into view's and to make view's render into an offscreen buffer to implement things like double-buffering.
The bitmap class have two different ways to communicate with the application server. If the SHARE_FRAMEBUFFER flag is set the bitmaps raster memory is created in a memory-area shared between the application and the appserver. This makes it possible for the appserver to blit graphics written directly to the bitmaps raster buffer by the application into views on the screen (or inside other bitmaps). If the ACCEPT_VIEWS flag is set the bitmap will accept views to be added much like a os::Window object. All rendering performed by the views will then go into the bitmap's offscreen buffer rather than the screen. The rendered image can then be read out by the application (requiers the SHARE_FRAMEBUFFER flag to be set aswell) or it can be blited into other views. The NO_ALPHA_CHANNEL flag disables the alpha channel for 32 bit bitmaps. This can improve performance if you render to this bitmap.

Note:
In most cases, the SHARE_FRAMEBUFFER flag should be used.
See also:
View, Window
Author:
Kurt Skauen ([email protected])


Member Enumeration Documentation

anonymous enum

Enumerator:
ACCEPT_VIEWS 
SHARE_FRAMEBUFFER 
NO_ALPHA_CHANNEL 


Constructor & Destructor Documentation

Bitmap::Bitmap ( int  nWidth,
int  nHeight,
color_space  eColorSpc,
uint32  nFlags = SHARE_FRAMEBUFFER 
)

Description:
This is the constructor used to create a standard bitmap.
Parameters:
nWidth - Width of the bitmap.
nHeight - Height of the bitmap.
eColorSpc - ColorSpace of the bitmap
nFlags - See description of the class.
Note:
An exception will be thrown if the bitmap could not be created.
Author:
Kurt Skauen ([email protected])

Bitmap::Bitmap ( int  hHandle  ) 

Description:
This constructor will create a handle from the appserver bitmap handle. This is only useful in special cases, e.g. to share bitmaps between two applications.
Parameters:
hHandle - The appserver handle of the bitmap.
Note:
An exception will be thrown if the bitmap could not be created.
Author:
Arno Klenke ([email protected])

Bitmap::~Bitmap (  )  [virtual]


Member Function Documentation

bool os::Bitmap::IsValid ( void   )  const

int Bitmap::GetHandle ( void   )  const

Description:
Returns the appserver handle. This method is only useful if you want to share a bitmap with another application.
Author:
Kurt Skauen ([email protected])

color_space Bitmap::GetColorSpace (  )  const

Description:
Returns the colorspace of the bitmap.
Author:
Kurt Skauen ([email protected])

Rect Bitmap::GetBounds ( void   )  const

Description:
Returns the bounds of the bitmap.
Author:
Kurt Skauen ([email protected])

int Bitmap::GetBytesPerRow (  )  const

Description:
Returns the numer of bytes in one bitmap row.
Note:
This value might differ from (Width of the bitmap) * (Number of bytes per pixel)!
Author:
Kurt Skauen ([email protected])

void Bitmap::AddChild ( View pcView  )  [virtual]

Description:
This method adds a view to the bitmap. This is only valid if the bitmap has been created with the ACCEPT_VIEWS flag.
Parameters:
pcView - The view.
Author:
Kurt Skauen ([email protected])

bool Bitmap::RemoveChild ( View pcView  )  [virtual]

Description:
This method removes a view from the bitmap. This is only valid if the bitmap has been created with the ACCEPT_VIEWS flag.
Parameters:
pcView - The view.
Author:
Kurt Skauen ([email protected])

View * Bitmap::FindView ( const char *  pzName  )  const

Description:
This method returns the (previously added) view with the given name. This is only valid if the bitmap has been created with the ACCEPT_VIEWS flag.
Author:
Kurt Skauen ([email protected])

void Bitmap::Sync ( void   ) 

Description:
This method works like Flush() but waits until all operations have been finished. This is only valid if the bitmap has been created with the ACCEPT_VIEWS flag.
Author:
Kurt Skauen ([email protected])

void Bitmap::Flush ( void   ) 

Description:
This method flushes all pending rendering commands of the views added to this bitmap. This is only valid if the bitmap has been created with the ACCEPT_VIEWS flag.
Author:
Kurt Skauen ([email protected])

uint8* os::Bitmap::LockRaster ( void   )  [inline]

Description:
This method gets a void* pointer to the raw raster data. The size of the raster data in bytes can be calculated by GetBytesPerLine()*(GetBounds().Height()+1). Since the raster data is allocated by the appserver, this method is only valid if the bitmap was created with the flag SHARE_FRAMEBUFFER.
Note:
Remember to call UnlockRaster() when finished accessing the raster.
Return values:
Returns a pointer to the raster data, or NULL if the bitmap was not created with the SHARE_FRAMEBUFFER flag.
See also:
UnlockRaster()
Author:
Kurt Skauen ([email protected])

void os::Bitmap::UnlockRaster (  )  [inline]


Friends And Related Function Documentation

friend class View [friend]

friend class Window [friend]

friend class Sprite [friend]

friend class Desktop [friend]


Generated on Sat May 9 22:51:20 2009 for Syllable higlevel API by  doxygen 1.5.1