Wt
3.3.8
|
A paint device for rendering using the HTML 5 <canvas> element. More...
#include <Wt/WCanvasPaintDevice>
Public Member Functions | |
WCanvasPaintDevice (const WLength &width, const WLength &height, WObject *parent=0, bool paintUpdate=false) | |
Create a canvas paint device. | |
virtual WFlags< FeatureFlag > | features () const |
Returns device features. | |
virtual void | drawArc (const WRectF &rect, double startAngle, double spanAngle) |
Draws an arc. More... | |
virtual void | drawImage (const WRectF &rect, const std::string &imgUri, int imgWidth, int imgHeight, const WRectF &sourceRect) |
Draws an image. More... | |
virtual void | drawLine (double x1, double y1, double x2, double y2) |
Draws a line. More... | |
virtual void | drawPath (const WPainterPath &path) |
Draws a path. More... | |
virtual void | drawText (const WRectF &rect, WFlags< AlignmentFlag > alignmentFlags, TextFlag textFlag, const WString &text, const WPointF *clipPoint) |
Draws text. More... | |
virtual WTextItem | measureText (const WString &text, double maxWidth=-1, bool wordWrap=false) |
Measures rendered text size. More... | |
virtual WFontMetrics | fontMetrics () |
Returns font metrics. More... | |
virtual void | init () |
Initializes the device for painting. More... | |
virtual void | done () |
Finishes painting on the device. More... | |
virtual bool | paintActive () const |
Returns whether painting is active. More... | |
virtual WLength | width () const |
Returns the device width. More... | |
virtual WLength | height () const |
Returns the device height. More... | |
Public Member Functions inherited from Wt::WObject | |
WObject (WObject *parent=0) | |
Create a WObject with a given parent object. More... | |
virtual | ~WObject () |
Destructor. More... | |
virtual const std::string | id () const |
Returns the (unique) identifier for this object. More... | |
virtual void | setObjectName (const std::string &name) |
Sets an object name. More... | |
virtual std::string | objectName () const |
Returns the object name. More... | |
void | resetLearnedSlots () |
Resets learned stateless slot implementations. More... | |
template<class T > | |
void | resetLearnedSlot (void(T::*method)()) |
Resets a learned stateless slot implementation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)()) |
Declares a slot to be stateless and learn client-side behaviour on first invocation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
Declares a slot to be stateless and learn client-side behaviour in advance. More... | |
void | isNotStateless () |
Marks the current function as not stateless. More... | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. More... | |
void | addChild (WObject *child) |
Adds a child object. More... | |
virtual void | removeChild (WObject *child) |
Removes a child object. More... | |
const std::vector< WObject * > & | children () const |
Returns the children. | |
WObject * | parent () const |
Returns the parent object. | |
Public Member Functions inherited from Wt::WPaintDevice | |
virtual | ~WPaintDevice () |
Destructor. More... | |
virtual void | setChanged (WFlags< ChangeFlag > flags)=0 |
Indicates changes in painter state. More... | |
Protected Member Functions | |
virtual WPainter * | painter () const |
Returns the painter that is currently painting on the device. More... | |
virtual void | setPainter (WPainter *painter) |
Sets the painter. | |
Protected Member Functions inherited from Wt::WObject | |
virtual WStatelessSlot * | getStateless (Method method) |
On-demand stateless slot implementation. More... | |
Additional Inherited Members | |
Public Types inherited from Wt::WObject | |
typedef void(WObject::* | Method) () |
Typedef for a WObject method without arguments. | |
Public Types inherited from Wt::WPaintDevice | |
Static Protected Member Functions inherited from Wt::WObject | |
static WObject * | sender () |
Returns the sender of the current slot call. More... | |
A paint device for rendering using the HTML 5 <canvas> element.
The WCanvasPaintDevice is used by WPaintedWidget to render to the browser using the HTML 5 <canvas> element. You usually will not use the device directly, but rather rely on WPaintedWidget to use this device when appropriate.
|
virtual |
Finishes painting on the device.
This method is called when a WPainter stopped painting.
Implements Wt::WPaintDevice.
|
virtual |
Draws an arc.
The arc describes the segment of an ellipse enclosed by the rect. The segment starts at startAngle
, and spans an angle given by spanAngle
. These angles have as unit degree, and are measured counter-clockwise starting from the 3 o'clock position.
The arc must be stroked, filled, and transformed using the current painter settings.
Implements Wt::WPaintDevice.
|
virtual |
Draws 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.
|
virtual |
Draws a line.
The line must be stroked and transformed using the current painter settings.
Implements Wt::WPaintDevice.
|
virtual |
Draws a path.
The path must be stroked, filled, and transformed using the current painter settings.
Implements Wt::WPaintDevice.
|
virtual |
Draws text.
The text must be rendered, stroked and transformed using the current painter settings.
If clipPoint is not null, a check is performed whether the point is inside of the current clip area. If not, the text is not drawn.
Implements Wt::WPaintDevice.
|
virtual |
Returns font metrics.
This returns font metrics for the current font.
Throws a std::logic_error if the underlying device does not provide font metrics.
Implements Wt::WPaintDevice.
|
virtual |
Returns the device height.
The device height, in pixels, establishes the height of the device coordinate system.
Implements Wt::WPaintDevice.
|
virtual |
Initializes the device for painting.
This method is called when a WPainter starts painting.
Implements Wt::WPaintDevice.
|
virtual |
Measures rendered text size.
Returns the bounding rect of the given text when rendered using the current font.
If maxWidth
!= -1, then the text is truncated to fit in the width.
If wordWrap
= true
then text is truncated only at word boundaries. Note that in this case the whitespace at the truncated position is included in the text but not accounted for by the returned width (since usually you will not render the whitespace at the end of a line).
Throws a std::logic_error if the underlying device does not provide font metrics.
Implements Wt::WPaintDevice.
|
virtual |
|
protectedvirtual |
Returns the painter that is currently painting on the device.
Implements Wt::WPaintDevice.
|
virtual |
Returns the device width.
The device width, in pixels, establishes the width of the device coordinate system.
Implements Wt::WPaintDevice.