#include <WPaintDevice>
Public Types | |
enum | ChangeFlags { Pen = 0x1, Brush = 0x2, Font = 0x4, Hints = 0x8, Transform = 0x10, Clipping = 0x20 } |
Enumeration to communicate painter state changes. More... | |
Public Member Functions | |
virtual | ~WPaintDevice () |
Destructor. | |
WLength | width () const |
Return the device width. | |
WLength | height () const |
Return the device height. | |
virtual void | setChanged (int flags)=0 |
Indicate changes in painter state. | |
virtual void | drawArc (const WRectF &rect, double startAngle, double spanAngle)=0 |
Draw an arc. | |
virtual void | drawImage (const WRectF &rect, const std::string &imageUri, int imgWidth, int imgHeight, const WRectF &sourceRect)=0 |
Draw an image. | |
virtual void | drawLine (double x1, double y1, double x2, double y2)=0 |
Draw a line. | |
virtual void | drawPath (const WPainterPath &path)=0 |
Draw a path. | |
virtual void | drawText (const WRectF &rect, int flags, const WString &text)=0 |
Draw text. | |
virtual void | init ()=0 |
Initialize the device for painting. | |
virtual void | done ()=0 |
Finish painting on the device. | |
bool | paintActive () const |
Return whether painting is active. | |
Protected Member Functions | |
WPaintDevice (const WLength &width, const WLength &height) | |
Create a paint device with given dimensions. | |
WPainter * | painter () const |
Return the painter that is currently painting on the device. |
A WPaintDevice is a device on which may be painted using a WPainter. You should never paint directly on a paint device.
The device defines the size of the drawing area, using width() and height(). These dimensions must be defined in pixel units. In the future, additional information will be included to convert these pixel units to lengths (using DPI information).
You should reimplement this class if you wish to extend the Wt paint system to paint on other devices.
Note: this interface is subject to changes, which are likely to happen to increase optimization possibilities for the painting using different devices.
Wt::WPaintDevice::~WPaintDevice | ( | ) | [virtual] |
Destructor.
Frees all resources associated with this device.
WLength Wt::WPaintDevice::width | ( | ) | const [inline] |
Return the device width.
The device width, in pixels, establishes the width of the device coordinate system.
WLength Wt::WPaintDevice::height | ( | ) | const [inline] |
Return the device height.
The device height, in pixels, establishes the height of the device coordinate system.
virtual void Wt::WPaintDevice::setChanged | ( | int | flags | ) | [pure virtual] |
Indicate changes in painter state.
The flags argument is the logical OR of one or more change flags.
Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.
virtual void Wt::WPaintDevice::drawArc | ( | const WRectF & | rect, | |
double | startAngle, | |||
double | spanAngle | |||
) | [pure 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.
Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.
virtual void Wt::WPaintDevice::drawImage | ( | const WRectF & | rect, | |
const std::string & | imageUri, | |||
int | imgWidth, | |||
int | imgHeight, | |||
const WRectF & | sourceRect | |||
) | [pure 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.
Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.
virtual void Wt::WPaintDevice::drawLine | ( | double | x1, | |
double | y1, | |||
double | x2, | |||
double | y2 | |||
) | [pure virtual] |
Draw a line.
The line must be stroked and transformed using the current painter settings.
Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.
virtual void Wt::WPaintDevice::drawPath | ( | const WPainterPath & | path | ) | [pure virtual] |
Draw a path.
The path must be stroked, filled, and transformed using the current painter settings.
Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.
virtual void Wt::WPaintDevice::drawText | ( | const WRectF & | rect, | |
int | flags, | |||
const WString & | text | |||
) | [pure virtual] |
Draw text.
The text must be rendered, stroked and transformed using the current painter settings.
Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.
virtual void Wt::WPaintDevice::init | ( | ) | [pure virtual] |
Initialize the device for painting.
This method is called when a WPainter starts painting.
Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.
virtual void Wt::WPaintDevice::done | ( | ) | [pure virtual] |
Finish painting on the device.
This method is called when a WPainter stopped painting.
Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.
bool Wt::WPaintDevice::paintActive | ( | ) | const [inline] |
WPainter* Wt::WPaintDevice::painter | ( | ) | const [inline, protected] |