Wt: Wt::WVmlImage Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
Wt::WVmlImage Class Reference
Painting system

A paint device for rendering using the VML pseudo-standard. More...

`#include <Wt/WVmlImage.h>`

Inheritance diagram for Wt::WVmlImage:
[legend]

## Public Member Functions
| WVmlImage (const WLength &width, const WLength &height, bool paintUpdate)
| Create a VML paint device.
virtual WFlags< PaintDeviceFeatureFlag > | features () const override
| Returns device features.
virtual void | setChanged (WFlags< PainterChangeFlag > flags) override
| Indicates changes in painter state.
virtual void | drawArc (const WRectF &rect, double startAngle, double spanAngle) override
| Draws an arc.
virtual void | drawImage (const WRectF &rect, const std::string &imgUri, int imgWidth, int imgHeight, const WRectF &sourceRect) override
| Draws an image.
virtual void | drawLine (double x1, double y1, double x2, double y2) override
| Draws a line.
virtual void | drawRect (const WRectF &rectangle) override
| Draws a rectangle.
virtual void | drawPath (const WPainterPath &path) override
| Draws a path.
virtual void | drawText (const WRectF &rect, WFlags< AlignmentFlag > alignmentFlags, TextFlag textFlag, const WString &text, const WPointF *clipPoint) override
| Draws text.
virtual WTextItem | measureText (const WString &text, double maxWidth=-1, bool wordWrap=false) override
| Measures rendered text size.
virtual WFontMetrics | fontMetrics () override
| Returns font metrics.
virtual void | init () override
| Initializes the device for painting.
virtual void | done () override
| Finishes painting on the device.
virtual bool | paintActive () const override
| Returns whether painting is active.
virtual std::string | rendered () override
| Internal method.
virtual WLength | width () const override
| Returns the device width.
virtual WLength | height () const override
| Returns the device height.
Public Member Functions inherited from Wt::WVectorImage
Public Member Functions inherited from Wt::WPaintDevice
virtual | ~WPaintDevice ()
| Destructor.

## Protected Member Functions
virtual WPainter * | painter () const override
| Returns the painter that is currently painting on the device.
virtual void | setPainter (WPainter *painter) override
| Sets the painter.
Protected Member Functions inherited from Wt::WPaintDevice

## Additional Inherited Members
Public Types inherited from Wt::WPaintDevice
typedef PaintDeviceFeatureFlag | FeatureFlag
| Typedef for enum Wt::PaintDeviceFeatureFlag.

## Detailed Description

A paint device for rendering using the VML pseudo-standard.

The WVmlImage is used by WPaintedWidget to render to the browser using the Vector Markup Language (VML) (to support graphics on Internet Explorer browsers).

Note
  The current implementation has only limited support for clipping: only rectangular areas aligned with the X/Y axes can be used as clipping path.

## Constructor & Destructor Documentation

## ◆ WVmlImage()

Wt::WVmlImage::WVmlImage | ( | const WLength & | width,
|  | const WLength & | height,
|  | bool | paintUpdate )

Create a VML paint device.

If `paintUpdate` is `true`, then only a VML fragment will be rendered that can be used to update the DOM of an existing VML image, instead of a full VML image.

## Member Function Documentation

## ◆ done()

virtual void Wt::WVmlImage::done | ( |  | ) |
| overridevirtual

Finishes painting on the device.

This method is called when a WPainter stopped painting.

See also
  WPainter::end()

Implements Wt::WPaintDevice.

## ◆ drawArc()

virtual void Wt::WVmlImage::drawArc | ( | const WRectF & | rect,
|  | double | startAngle,
|  | double | spanAngle )
| overridevirtual

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.

## ◆ drawImage()

virtual void Wt::WVmlImage::drawImage | ( | const WRectF & | rect,
|  | const std::string & | imageUri,
|  | int | imgWidth,
|  | int | imgHeight,
|  | const WRectF & | sourceRect )
| overridevirtual

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.

## ◆ drawLine()

virtual void Wt::WVmlImage::drawLine | ( | double | x1,
|  | double | y1,
|  | double | x2,
|  | double | y2 )
| overridevirtual

Draws a line.

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

Implements Wt::WPaintDevice.

## ◆ drawPath()

virtual void Wt::WVmlImage::drawPath | ( | const WPainterPath & | path | ) |
| overridevirtual

Draws a path.

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

Implements Wt::WPaintDevice.

## ◆ drawRect()

virtual void Wt::WVmlImage::drawRect | ( | const WRectF & | rectangle | ) |
| overridevirtual

Draws a rectangle.

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

Implements Wt::WPaintDevice.

## ◆ drawText()

virtual void Wt::WVmlImage::drawText | ( | const WRectF & | rect,
|  | WFlags< AlignmentFlag > | alignmentFlags,
|  | TextFlag | textFlag,
|  | const WString & | text,
|  | const WPointF * | clipPoint )
| overridevirtual

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.

## ◆ fontMetrics()

virtual WFontMetrics Wt::WVmlImage::fontMetrics | ( |  | ) |
| overridevirtual

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.

## ◆ height()

virtual WLength Wt::WVmlImage::height | ( |  | ) | const
| overridevirtual

Returns the device height.

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

Implements Wt::WPaintDevice.

## ◆ init()

virtual void Wt::WVmlImage::init | ( |  | ) |
| overridevirtual

Initializes the device for painting.

This method is called when a WPainter starts painting.

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

Implements Wt::WPaintDevice.

## ◆ measureText()

virtual WTextItem Wt::WVmlImage::measureText | ( | const WString & | text,
|  | double | maxWidth = -1,
|  | bool | wordWrap = false )
| overridevirtual

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.

## ◆ paintActive()

virtual bool Wt::WVmlImage::paintActive | ( |  | ) | const
| overridevirtual

Returns whether painting is active.

See also
  init(), painter()

Implements Wt::WPaintDevice.

## ◆ painter()

virtual WPainter * Wt::WVmlImage::painter | ( |  | ) | const
| overrideprotectedvirtual

Returns the painter that is currently painting on the device.

See also
  init()

Implements Wt::WPaintDevice.

## ◆ setChanged()

virtual void Wt::WVmlImage::setChanged | ( | WFlags< PainterChangeFlag > | flags | ) |
| overridevirtual

Indicates changes in painter state.

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

See also
  ChangeFlag

Implements Wt::WPaintDevice.

## ◆ width()

virtual WLength Wt::WVmlImage::width | ( |  | ) | const
| overridevirtual

Returns the device width.

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

Implements Wt::WPaintDevice.