VSTGUI  3.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CBitmap Class Reference

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

#include <vstgui.h>

+ Inheritance diagram for CBitmap:

Public Member Functions

virtual ~CBitmap ()
 
void setTransparencyMask (CDrawContext *pContext, const CPoint &offset=CPoint(0, 0))
 

Protected Member Functions

 CBitmap ()
 
virtual void dispose ()
 
virtual bool loadFromResource (const CResourceDescription &resourceDesc)
 
virtual bool loadFromPath (const void *platformPath)
 

Protected Attributes

CResourceDescription resourceDesc
 
CCoord width
 
CCoord height
 
CColor transparentCColor
 
bool noAlpha
 
void * pHandle
 
void * pMask
 

Reference Counting Methods

virtual void forget ()
 decrease refcount and delete object if refcount == 0 More...
 
virtual void remember ()
 increase refcount More...
 
long getNbReference () const
 get refcount More...
 

Message Methods

virtual CMessageResult notify (CBaseObject *sender, const char *message)
 

Constructors

 CBitmap (const CResourceDescription &desc)
 Create a pixmap from a resource identifier. More...
 
 CBitmap (CFrame &frame, CCoord width, CCoord height)
 Create a pixmap with a given size. More...
 

CBitmap Methods

virtual void draw (CDrawContext *pContext, CRect &rect, const CPoint &offset=CPoint(0, 0))
 Draw the pixmap using a given rect as output position and a given offset of its source pixmap. More...
 
virtual void drawTransparent (CDrawContext *pContext, CRect &rect, const CPoint &offset=CPoint(0, 0))
 
virtual void drawAlphaBlend (CDrawContext *pContext, CRect &rect, const CPoint &offset=CPoint(0, 0), unsigned char alpha=128)
 Same as CBitmap::draw except that it uses the alpha value to draw the bitmap alpha blended. More...
 
CCoord getWidth () const
 get the width of the image More...
 
CCoord getHeight () const
 get the height of the image More...
 
bool isLoaded () const
 check if image is loaded More...
 
void * getHandle () const
 get a platform image object. Normally you don't need this More...
 
void setTransparentColor (const CColor color)
 set the color of the image which should not be drawn. Works only once on some implementations/platforms. More...
 
CColor getTransparentColor () const
 get the current transparent color More...
 
void setNoAlpha (bool state)
 
bool getNoAlpha () const
 
const CResourceDescriptiongetResourceDescription () const
 

Detailed Description

Encapsulates various platform depended kinds of bitmaps.

Alpha Blend and Transparency

With Version 3.0 of VSTGUI it is possible to use alpha blended bitmaps. This comes free on Mac OS X and with Windows you need to include libpng. Per default PNG images will be rendered alpha blended. If you want to use a transparency color with PNG Bitmaps, you need to call setNoAlpha(true) on the bitmap and set the transparency color.

Apple Mac OS X

The Bitmaps can be of type PNG, JPEG, PICT, BMP and are stored in the Resources folder of the plugin bundle. With the latest version VSTGUI supports all image types supported by the Image I/O Framework.

Microsoft Windows

The Bitmaps are .bmp files and must be included in the plug (usually using a .rc file). It's also possible to use png as of version 3.0 if you define the macro USE_LIBPNG and include the libpng and zlib libraries/sources to your project.

New since 3.0

There is a new way to name the bitmaps in the latest version. Instead of using a number identifier for the bitmaps you can now use real names for it. The CResourceDescription works with both names and numbers. 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.

// Old way
1001 BITMAP DISCARDABLE "bmp01001.bmp"
// New way with GDIPlus
RealFileName.bmp DATA "RealFileName.bmp"
// New way without GDIPlus
RealFileName.bmp BITMAP DISCARDABLE "RealFileName.bmp"
CBitmap* bitmap1 = new CBitmap (1001);
CBitmap* bitmap2 = new CBitmap ("RealFileName.bmp");

Constructor & Destructor Documentation

CBitmap ( const CResourceDescription desc)

Create a pixmap from a resource identifier.

CBitmap ( CFrame frame,
CCoord  width,
CCoord  height 
)

Create a pixmap with a given size.

~CBitmap ( )
virtual
CBitmap ( )
protected

Member Function Documentation

void dispose ( )
protectedvirtual
void draw ( CDrawContext pContext,
CRect rect,
const CPoint offset = CPoint (0, 0) 
)
virtual

Draw the pixmap using a given rect as output position and a given offset of its source pixmap.

void drawAlphaBlend ( CDrawContext pContext,
CRect rect,
const CPoint offset = CPoint (0, 0),
unsigned char  alpha = 128 
)
virtual

Same as CBitmap::draw except that it uses the alpha value to draw the bitmap alpha blended.

void drawTransparent ( CDrawContext pContext,
CRect rect,
const CPoint offset = CPoint (0, 0) 
)
virtual
virtual void forget ( )
inlinevirtualinherited

decrease refcount and delete object if refcount == 0

Reimplemented in CDrawContext.

void * getHandle ( ) const

get a platform image object. Normally you don't need this

CCoord getHeight ( ) const
inline

get the height of the image

long getNbReference ( ) const
inlineinherited

get refcount

bool getNoAlpha ( ) const
inline
const CResourceDescription& getResourceDescription ( ) const
inline
CColor getTransparentColor ( ) const
inline

get the current transparent color

CCoord getWidth ( ) const
inline

get the width of the image

bool isLoaded ( ) const

check if image is loaded

bool loadFromPath ( const void *  platformPath)
protectedvirtual
bool loadFromResource ( const CResourceDescription resourceDesc)
protectedvirtual
virtual CMessageResult notify ( CBaseObject sender,
const char *  message 
)
inlinevirtualinherited
virtual void remember ( )
inlinevirtualinherited

increase refcount

void setNoAlpha ( bool  state)
inline
void setTransparencyMask ( CDrawContext pContext,
const CPoint offset = CPoint (0, 0) 
)
void setTransparentColor ( const CColor  color)

set the color of the image which should not be drawn. Works only once on some implementations/platforms.

Member Data Documentation

CCoord height
protected
bool noAlpha
protected
void* pHandle
protected
void* pMask
protected
CResourceDescription resourceDesc
protected
CColor transparentCColor
protected
CCoord width
protected

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