#include <vstgui.h>
class COffscreenContext : public CDrawContext;
An offscreen context is a drawing device which uses a pixmap
as its drawing surface. The creation of this pixmap for drawing is supplied by
the application, which allows the creation of bitmaps on the fly using normal
drawing methods defined in the CDrawContext
class.
COffscreenContext |
1.0 |
Create an offscreen context with the given pixmap.
context |
|
---|---|
bitmap |
A background pixmap.Its size will determine the size of the offscreen. |
COffscreenContext |
1.0 |
Create an offscreen context with the given height, width and background color.
frame |
The frame this offscreen context is attached to. |
---|---|
width |
The width of this offscreen context. |
height |
The height of this offscreen context. |
backgroundColor |
The background color of this offscreen context. |
~COffscreenContext |
1.0 |
Destroy an offscreenContext object.
copyFrom |
2.1 |
Copy the offscreen pixmap to the given context with a given destination rectangle and an offset position in the source.
pContext |
The target context. |
---|---|
destRect |
The destination rectangle in the target context. |
srcOffset |
An offset position in the source. |
bitmapOc = new CBitmap (128);
...
void ScoView::draw (CDrawContext *pContext)
{
// this must be local
COffscreenContext *oc = new COffscreenContext (
getParent (), 80, 100, kBlackCColor
);
CRect rctScreen (0, 0, 80, 100);
// draw the background
if (bitmapOc)
bitmapOc>draw (oc, rctScreen);
long x, y;
CPoint p;
CColor greenColor = {0, 255, 0, 0};
oc->setFrameColor (greenColor);
oc->moveTo (p(x, y));
...
// draw the line
oc->lineTo (p(x, y));
...
// copyFrom the offscreen to the current context
CRect rect (20, 50, 100, 150);
oc->copyFrom (context, rect, p (0, 0));
// don't forget to delete the offscreen
delete oc;
}
copyTo |
2.2 |
This is the copyFrom' s opposite : it is used to make the area offscreen.
transfert |
1.0 |
Tranfers the offscreen pixmap to the given context.
context |
The target context. |
---|---|
destRect |
The destination rectangle in the target context. |
srcOffset |
An offset position in the source. |
This method is depreciated and will be replaced by copyFrom
.
getWidth |
1.0 |
Returns the width of this offscreen.
getHeight |
1.0 |
Returns the height of this offscreen.