#include <WCanvasPaintDevice>
Public Member Functions | |
WCanvasPaintDevice (const WLength &width, const WLength &height, WObject *parent=0) | |
Create a canvas paint device. | |
virtual void | setChanged (int flags) |
Indicate changes in painter state. | |
virtual void | drawArc (const WRectF &rect, double startAngle, double spanAngle) |
Draw an arc. | |
virtual void | drawImage (const WRectF &rect, const std::string &imgUri, int imgWidth, int imgHeight, const WRectF &sourceRect) |
Draw an image. | |
virtual void | drawLine (double x1, double y1, double x2, double y2) |
Draw a line. | |
virtual void | drawPath (const WPainterPath &path) |
Draw a path. | |
virtual void | drawText (const WRectF &rect, int flags, const WString &text) |
Draw text. | |
virtual void | init () |
Initialize the device for painting. | |
virtual void | done () |
Finish painting on the device. |
The WCanvasPaintDevice is used by WPaintedWidget to render to the browser using the HTML 5 <canvas> element.
Note: the current implementation has only limited support for text, which is rendered in an overlayed DIV. As a consequence text is not subject to rotation and scaling components of the current transformation. This will be fixed in the future (some way, some how!).
void Wt::WCanvasPaintDevice::setChanged | ( | int | flags | ) | [virtual] |
Indicate changes in painter state.
The flags argument is the logical OR of one or more change flags.
Implements Wt::WPaintDevice.
void Wt::WCanvasPaintDevice::drawArc | ( | const WRectF & | rect, | |
double | startAngle, | |||
double | spanAngle | |||
) | [virtual] |
Draw an arc.
The arc is defined as in WPainter::drawArc(const WRectF&, startAngle, spanAngle), but the angle is expressed in degrees.
The arc must be stroked, filled, and transformed using the current painter settings.
Implements Wt::WPaintDevice.
void Wt::WCanvasPaintDevice::drawImage | ( | const WRectF & | rect, | |
const std::string & | imageUri, | |||
int | imgWidth, | |||
int | imgHeight, | |||
const WRectF & | sourceRect | |||
) | [virtual] |
Draw an image.
Draws sourceRect from the image with URL imageUri and original dimensions imgWidth and imgHeight to the location, into the rectangle defined by rect.
The image is transformed using the current painter settings.
Implements Wt::WPaintDevice.
void Wt::WCanvasPaintDevice::drawLine | ( | double | x1, | |
double | y1, | |||
double | x2, | |||
double | y2 | |||
) | [virtual] |
Draw a line.
The line must be stroked and transformed using the current painter settings.
Implements Wt::WPaintDevice.
void Wt::WCanvasPaintDevice::drawPath | ( | const WPainterPath & | path | ) | [virtual] |
Draw a path.
The path must be stroked, filled, and transformed using the current painter settings.
Implements Wt::WPaintDevice.
void Wt::WCanvasPaintDevice::drawText | ( | const WRectF & | rect, | |
int | flags, | |||
const WString & | text | |||
) | [virtual] |
Draw text.
The text must be rendered, stroked and transformed using the current painter settings.
Implements Wt::WPaintDevice.
void Wt::WCanvasPaintDevice::init | ( | ) | [virtual] |
Initialize the device for painting.
This method is called when a WPainter starts painting.
Implements Wt::WPaintDevice.
void Wt::WCanvasPaintDevice::done | ( | ) | [virtual] |
Finish painting on the device.
This method is called when a WPainter stopped painting.
Implements Wt::WPaintDevice.