Wt::WSvgImage Class Reference
[Painting system]

A paint device for rendering using Scalable Vector Graphics (SVG). More...

#include <Wt/WSvgImage>

Inheritance diagram for Wt::WSvgImage:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 WSvgImage (const WLength &width, const WLength &height, WObject *parent=0)
 Create an SVG paint device.
 ~WSvgImage ()
 Destructor.
virtual void drawArc (const WRectF &rect, double startAngle, double spanAngle)
 Draws an arc.
virtual void drawImage (const WRectF &rect, const std::string &imgUri, int imgWidth, int imgHeight, const WRectF &sourceRect)
 Draws an image.
virtual void drawLine (double x1, double y1, double x2, double y2)
 Draws a line.
virtual void drawPath (const WPainterPath &path)
 Draws a path.
virtual void drawText (const WRectF &rect, WFlags< AlignmentFlag > flags, const WString &text)
 Draws text.
virtual void init ()
 Initializes the device for painting.
virtual void done ()
 Finishes painting on the device.
virtual bool paintActive () const
 Returns whether painting is active.
virtual std::string rendered ()
 Internal method.
virtual WLength width () const
 Returns the device width.
virtual WLength height () const
 Returns the device height.
virtual WFlags< PaintFlagpaintFlags () const
 Returns the paint flags.

Protected Member Functions

virtual WPainterpainter () const
 Returns the painter that is currently painting on the device.
virtual void setPainter (WPainter *painter)
 Sets the painter.
virtual void setPaintFlags (WFlags< PaintFlag > paintFlags)
 Sets paint flags.
virtual void handleRequest (const Http::Request &request, Http::Response &response)
 Handles a request.


Detailed Description

A paint device for rendering using Scalable Vector Graphics (SVG).

The WSvgImage is primarily used by WPaintedWidget to render to the browser in Support Vector Graphics (SVG) format.

You may also use the WSvgImage as an independent resource, for example in conjunction with a WAnchor or WImage, or to make a hard copy of an image in SVG format, using write():

 Wt::Chart::WCartesianChart *chart = ...

 Wt::WSvgImage svgImage(800, 400);
 Wt::WPainter p(&svgImage);
 chart->paint(p);
 p.end();
 std::ofstream f("chart.svg");
 svgImage.write(f);

Member Function Documentation

void Wt::WSvgImage::drawArc ( const WRectF rect,
double  startAngle,
double  spanAngle 
) [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.

Implements Wt::WPaintDevice.

void Wt::WSvgImage::drawImage ( const WRectF rect,
const std::string &  imageUri,
int  imgWidth,
int  imgHeight,
const WRectF sourceRect 
) [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.

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

Draws a line.

The line must be stroked and transformed using the current painter settings.

Implements Wt::WPaintDevice.

void Wt::WSvgImage::drawPath ( const WPainterPath path  )  [virtual]

Draws a path.

The path must be stroked, filled, and transformed using the current painter settings.

Implements Wt::WPaintDevice.

void Wt::WSvgImage::drawText ( const WRectF rect,
WFlags< AlignmentFlag flags,
const WString text 
) [virtual]

Draws text.

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

Implements Wt::WPaintDevice.

void Wt::WSvgImage::init (  )  [virtual]

Initializes the device for painting.

This method is called when a WPainter starts painting.

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

Implements Wt::WPaintDevice.

void Wt::WSvgImage::done (  )  [virtual]

Finishes painting on the device.

This method is called when a WPainter stopped painting.

See also:
WPainter::end()

Implements Wt::WPaintDevice.

virtual bool Wt::WSvgImage::paintActive (  )  const [inline, virtual]

Returns whether painting is active.

See also:
init(), painter()

Implements Wt::WPaintDevice.

virtual WLength Wt::WSvgImage::width (  )  const [inline, virtual]

Returns the device width.

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

Implements Wt::WPaintDevice.

virtual WLength Wt::WSvgImage::height (  )  const [inline, virtual]

Returns the device height.

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

Implements Wt::WPaintDevice.

virtual WPainter* Wt::WSvgImage::painter (  )  const [inline, protected, virtual]

Returns the painter that is currently painting on the device.

See also:
init()

Implements Wt::WPaintDevice.

void Wt::WSvgImage::handleRequest ( const Http::Request request,
Http::Response response 
) [protected, virtual]

Handles a request.

Reimplement this method so that a proper response is generated for the given request. From the request object you can access request parameters and whether the request is a continuation request. In the response object, you should set the mime type and stream the output data.

A request may also concern a continuation, indicated in Http::Request::continuation(), in which case the next part for a previously created continuation should be served.

While handling a request, which may happen at any time together with event handling, the library makes sure that the resource is not being concurrently deleted, but multiple requests may happend simultaneously for a single resource.

Implements Wt::WResource.


Generated on Thu May 20 18:14:49 2010 for Wt by doxygen 1.5.6