Public Types | Public Member Functions | Protected Member Functions

Wt::WPaintDevice Class Reference
[Painting system]

The abstract base class for a paint device. More...

#include <Wt/WPaintDevice>

Inherited by Wt::WCanvasPaintDevice, and Wt::WVectorImage.

List of all members.

Public Types

enum  ChangeFlag {
  Pen = 0x1, Brush = 0x2, Font = 0x4, Hints = 0x8,
  Transform = 0x10, Clipping = 0x20, Shadow = 0x40
}
 

Enumeration to communicate painter state changes.

More...

Public Member Functions

virtual ~WPaintDevice ()
 Destructor.
virtual WLength width () const =0
 Returns the device width.
virtual WLength height () const =0
 Returns the device height.
virtual void setChanged (WFlags< ChangeFlag > flags)=0
 Indicates changes in painter state.
virtual void drawArc (const WRectF &rect, double startAngle, double spanAngle)=0
 Draws an arc.
virtual void drawImage (const WRectF &rect, const std::string &imageUri, int imgWidth, int imgHeight, const WRectF &sourceRect)=0
 Draws an image.
virtual void drawLine (double x1, double y1, double x2, double y2)=0
 Draws a line.
virtual void drawPath (const WPainterPath &path)=0
 Draws a path.
virtual void drawText (const WRectF &rect, WFlags< AlignmentFlag > flags, const WString &text)=0
 Draws text.
virtual void init ()=0
 Initializes the device for painting.
virtual void done ()=0
 Finishes painting on the device.
virtual bool paintActive () const =0
 Returns whether painting is active.
virtual WFlags< PaintFlagpaintFlags () const =0
 Returns the paint flags.

Protected Member Functions

virtual WPainterpainter () const =0
 Returns the painter that is currently painting on the device.
virtual void setPainter (WPainter *painter)=0
 Sets the painter.
virtual void setPaintFlags (WFlags< PaintFlag > paintFlags)=0
 Sets paint flags.

Detailed Description

The abstract base class for a paint 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 than the ones provided by the library.

Note: this interface is subject to changes to increase optimization possibilities for the painting using different devices.

See also:
WPainter

Member Enumeration Documentation

Enumeration to communicate painter state changes.

See also:
setChanged(WFlags<ChangeFlag>)
Enumerator:
Pen 

Properties of the pen have changed.

Brush 

Properties of the brush have changed.

Font 

Properties of the font have changed.

Hints 

Some render hints have changed.

Transform 

The transformation has changed.

Clipping 

The clipping has changed.

Shadow 

Properties of the shadow have changed.


Constructor & Destructor Documentation

Wt::WPaintDevice::~WPaintDevice (  )  [virtual]

Destructor.

Frees all resources associated with this device.


Member Function Documentation

virtual void Wt::WPaintDevice::done (  )  [pure virtual]

Finishes painting on the device.

This method is called when a WPainter stopped painting.

See also:
WPainter::end()

Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.

virtual void Wt::WPaintDevice::drawArc ( const WRectF rect,
double  startAngle,
double  spanAngle 
) [pure virtual]

Draws 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]

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.

Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.

virtual void Wt::WPaintDevice::drawLine ( double  x1,
double  y1,
double  x2,
double  y2 
) [pure virtual]

Draws 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]

Draws 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,
WFlags< AlignmentFlag flags,
const WString text 
) [pure virtual]

Draws text.

The text must be rendered, stroked and transformed using the current painter settings.

Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.

virtual WLength Wt::WPaintDevice::height (  )  const [pure virtual]

Returns the device height.

The device height, in pixels, establishes the height of the device coordinate system.

Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.

virtual void Wt::WPaintDevice::init (  )  [pure virtual]

Initializes the device for painting.

This method is called when a WPainter starts painting.

See also:
WPainter::begin(WPaintDevice *), painter()

Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.

virtual bool Wt::WPaintDevice::paintActive (  )  const [pure virtual]

Returns whether painting is active.

See also:
init(), painter()

Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.

virtual WPainter* Wt::WPaintDevice::painter (  )  const [protected, pure virtual]

Returns the painter that is currently painting on the device.

See also:
init()

Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.

virtual void Wt::WPaintDevice::setChanged ( WFlags< ChangeFlag flags  )  [pure virtual]

Indicates changes in painter state.

The flags argument is the logical OR of one or more change flags.

See also:
ChangeFlag

Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.

virtual WLength Wt::WPaintDevice::width (  )  const [pure virtual]

Returns the device width.

The device width, in pixels, establishes the width of the device coordinate system.

Implemented in Wt::WCanvasPaintDevice, Wt::WSvgImage, and Wt::WVmlImage.


Generated on Mon Nov 29 2010 08:03:19 for Wt by doxygen 1.7.1