CBitmap Class Reference

Encapsulates various platform depended kinds of bitmaps. More...

Inheritance diagram for CBitmap:
Inheritance graph
[legend]
Collaboration diagram for CBitmap:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CBitmap (const CResourceDescription &desc)
 Create a pixmap from a resource identifier.
 CBitmap (CCoord width, CCoord height)
 Create a pixmap with a given size.
 CBitmap (IPlatformBitmap *platformBitmap)
 ~CBitmap ()
CBitmap Methods



virtual void draw (CDrawContext *context, const CRect &rect, const CPoint &offset=CPoint(0, 0), float alpha=1.f)
CCoord getWidth () const
 get the width of the image
CCoord getHeight () const
 get the height of the image
bool isLoaded () const
 check if image is loaded
const CResourceDescriptiongetResourceDescription () const
IPlatformBitmap * getPlatformBitmap () const
void setPlatformBitmap (IPlatformBitmap *bitmap)
Reference Counting Methods



virtual void forget ()
 decrease refcount and delete object if refcount == 0
virtual void remember ()
 increase refcount
virtual int32_t getNbReference () const
 get refcount
Message Methods



virtual CMessageResult notify (CBaseObject *sender, IdStringPtr message)

Protected Member Functions

 CBitmap ()

Protected Attributes

CResourceDescription resourceDesc
IPlatformBitmap * platformBitmap

Detailed Description

Encapsulates various platform depended kinds of bitmaps.

Changes in 4.0

In Version 4.0 CBitmap was simplified. Previous versions supported drawing a color transparent of the bitmap. Since CBitmap supports alpha drawing of bitmaps since some time, it's now the only way of drawing a bitmap with some parts transparent.

Supported file formats

File format support is handled in a platform dependent way. On Windows GDI+ is used to import images. On Mac OS X CoreGraphics is used to import them. For cross platform compatibility it is recommended to use PNG files.

Loading Bitmaps

You load a bitmap via a CResourceDescription which can hold a string or a number. If you use names, you need to use the real filename with extension. Then it gets automaticly loaded on Mac OS X out of the Resources folder of the vst bundle. On Windows you also specify the resource in the .rc file with the real filename.

// using a number
1001                    PNG  DISCARDABLE     "bmp01001.png"
// using a string
RealFileName.png        PNG  DISCARDABLE     "RealFileName.png"
CBitmap* bitmap1 = new CBitmap (1001); // number
CBitmap* bitmap2 = new CBitmap ("RealFileName.png"); // string

Constructor & Destructor Documentation

CBitmap ( const CResourceDescription desc  ) 

Create a pixmap from a resource identifier.

CBitmap ( CCoord  width,
CCoord  height 
)

Create a pixmap with a given size.

CBitmap ( IPlatformBitmap *  platformBitmap  ) 
~CBitmap (  ) 
CBitmap (  )  [protected]

Member Function Documentation

void draw ( CDrawContext context,
const CRect rect,
const CPoint offset = CPoint (0, 0),
float  alpha = 1.f 
) [virtual]

Reimplemented in CNinePartTiledBitmap.

virtual void forget (  )  [inline, virtual, inherited]

decrease refcount and delete object if refcount == 0

CCoord getHeight (  )  const

get the height of the image

virtual int32_t getNbReference (  )  const [inline, virtual, inherited]

get refcount

IPlatformBitmap* getPlatformBitmap (  )  const [inline]
const CResourceDescription& getResourceDescription (  )  const [inline]
CCoord getWidth (  )  const

get the width of the image

bool isLoaded (  )  const [inline]

check if image is loaded

virtual CMessageResult notify ( CBaseObject sender,
IdStringPtr  message 
) [inline, virtual, inherited]
virtual void remember (  )  [inline, virtual, inherited]

increase refcount

void setPlatformBitmap ( IPlatformBitmap *  bitmap  ) 

Member Data Documentation

IPlatformBitmap* platformBitmap [protected]

The documentation for this class was generated from the following files:

Generated on Fri Nov 22 11:09:30 2013 for VSTGUI by  doxygen 1.6.1