VSTGUI 4.10 Graphical User Interface Framework not only for VST plugins

Public Types | Public Member Functions | List of all members
CBitmap Class Reference

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

`#include <cbitmap.h>`

Inheritance diagram for CBitmap:

## Public Types
using | BitmapVector = std::vector< PlatformBitmapPtr >
using | const_iterator = BitmapVector::const_iterator

## Public Member Functions
| CBitmap (const CResourceDescription &desc)
| Create an image from a resource identifier. More...
| CBitmap (CCoord width, CCoord height)
| Create an image with a given size. More...
| CBitmap (CPoint size, double scaleFactor=1.)
| Create an image with a given size and scale factor. More...
| CBitmap (const PlatformBitmapPtr &platformBitmap)
| ~CBitmap () noexcept override=default
Public Member Functions inherited from ReferenceCounted< T >
| ReferenceCounted ()=default
virtual | ~ReferenceCounted () noexcept=default
| ReferenceCounted (const ReferenceCounted &)
ReferenceCounted & | operator= (const ReferenceCounted &)
void | forget () override
| decrease refcount and delete object if refcount == 0 More...
void | remember () override
| increase refcount More...
virtual int32_t | getNbReference () const
| get refcount More...
virtual void | forget ()=0
| decrease refcount and delete object if refcount == 0 More...
virtual void | remember ()=0
| increase refcount More...

## CBitmap Methods
CResourceDescription | resourceDesc
BitmapVector | bitmaps
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 More...
CCoord | getHeight () const
| get the height of the image More...
CPoint | getSize () const
| get size of image More...
bool | isLoaded () const
| check if image is loaded More...
const CResourceDescription & | getResourceDescription () const
PlatformBitmapPtr | getPlatformBitmap () const
void | setPlatformBitmap (const PlatformBitmapPtr &bitmap)
bool | addBitmap (const PlatformBitmapPtr &platformBitmap)
PlatformBitmapPtr | getBestPlatformBitmapForScaleFactor (double scaleFactor) const
const_iterator | begin () const
const_iterator | end () const
| CBitmap ()

## 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
VSTGUI::CBitmap::CBitmap
CBitmap()
Definition: cbitmap.cpp:41

## Member Typedef Documentation

## ◆ BitmapVector

using BitmapVector = std::vector<PlatformBitmapPtr>

## ◆ const_iterator

using const_iterator = BitmapVector::const_iterator

## Constructor & Destructor Documentation

## ◆ CBitmap() [1/5]

CBitmap | ( | const CResourceDescription & | desc | ) |
| explicit

Create an image from a resource identifier.

## ◆ CBitmap() [2/5]

CBitmap | ( | CCoord | width,
|  | CCoord | height
| ) |  |

Create an image with a given size.

## ◆ CBitmap() [3/5]

CBitmap | ( | CPoint | size,
|  | double | scaleFactor = `1.`
| ) |  |

Create an image with a given size and scale factor.

## ◆ CBitmap() [4/5]

CBitmap | ( | const PlatformBitmapPtr & | platformBitmap | ) |
| explicit

## ◆ ~CBitmap()

~CBitmap | ( |  | ) |
| override default noexcept

## ◆ CBitmap() [5/5]

CBitmap | ( |  | ) |
| protected

## Member Function Documentation

## ◆ addBitmap()

bool addBitmap | ( | const PlatformBitmapPtr & | platformBitmap | ) |

## ◆ begin()

const_iterator begin | ( |  | ) | const
| inline

## ◆ draw()

void draw | ( | CDrawContext * | context,
|  | const CRect & | rect,
|  | const CPoint & | offset = `CPoint (0, 0)`,
|  | float | alpha = `1.f`
| ) |  |
| virtual

Reimplemented in CNinePartTiledBitmap.

## ◆ end()

const_iterator end | ( |  | ) | const
| inline

## ◆ getBestPlatformBitmapForScaleFactor()

auto getBestPlatformBitmapForScaleFactor | ( | double | scaleFactor | ) | const

## ◆ getHeight()

CCoord getHeight | ( |  | ) | const

get the height of the image

## ◆ getPlatformBitmap()

auto getPlatformBitmap | ( |  | ) | const

## ◆ getResourceDescription()

const CResourceDescription & getResourceDescription | ( |  | ) | const
| inline

## ◆ getSize()

CPoint getSize | ( |  | ) | const

get size of image

## ◆ getWidth()

CCoord getWidth | ( |  | ) | const

get the width of the image

## ◆ isLoaded()

bool isLoaded | ( |  | ) | const
| inline

check if image is loaded

## ◆ setPlatformBitmap()

void setPlatformBitmap | ( | const PlatformBitmapPtr & | bitmap | ) |

## Member Data Documentation

## ◆ bitmaps

BitmapVector bitmaps
| protected

## ◆ resourceDesc

CResourceDescription resourceDesc
| protected

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

- cbitmap.h
- cbitmap.cpp