Class WMeasurePaintDevice
- All Implemented Interfaces:
 WPaintDevice
public class WMeasurePaintDevice extends java.lang.Object implements WPaintDevice
WMeasurePaintDevice Wt/WMeasurePaintDevice Wt/WMeasurePaintDevice.
 This implements a (pseudo)-paintdevice which measures the bounding rect of whatever is being painted on it, using fontmetrics from the underlying device.
The only output of the device is the computation of a bounding rect which is returned by
 getBoundingRect().
- 
Nested Class Summary
Nested classes/interfaces inherited from interface eu.webtoolkit.jwt.WPaintDevice
WPaintDevice.ChangeFlag, WPaintDevice.FeatureFlag - 
Constructor Summary
Constructors Constructor Description WMeasurePaintDevice(WPaintDevice paintDevice)Creates a paint device to measure for the underlying device. - 
Method Summary
Modifier and Type Method Description voiddone()Finishes painting on the device.voiddrawArc(WRectF rect, double startAngle, double spanAngle)Draws an arc.voiddrawImage(WRectF rect, java.lang.String imageUri, int imgWidth, int imgHeight, WRectF sourceRect)Draws an image.voiddrawLine(double x1, double y1, double x2, double y2)Draws a line.voiddrawPath(WPainterPath path)Draws a path.voiddrawText(WRectF rect, java.util.EnumSet<AlignmentFlag> flags, TextFlag textFlag, java.lang.CharSequence text, WPointF clipPoint)Draws text.WRectFgetBoundingRect()Returns the bounding rectangle of everything painted so far.java.util.EnumSet<WPaintDevice.FeatureFlag>getFeatures()Returns device features.WFontMetricsgetFontMetrics()Returns font metrics.WLengthgetHeight()Returns the device height.WPaintergetPainter()Returns the painter that is currently painting on the device.WLengthgetWidth()Returns the device width.voidinit()Initializes the device for painting.booleanisPaintActive()Returns whether painting is active.WTextItemmeasureText(java.lang.CharSequence text)Measures rendered text size.WTextItemmeasureText(java.lang.CharSequence text, double maxWidth)Measures rendered text size.WTextItemmeasureText(java.lang.CharSequence text, double maxWidth, boolean wordWrap)Measures rendered text size.voidsetChanged(WPaintDevice.ChangeFlag flag, WPaintDevice.ChangeFlag... flags)Indicates changes in painter state.voidsetChanged(java.util.EnumSet<WPaintDevice.ChangeFlag> flags)Indicates changes in painter state.voidsetPainter(WPainter painter)Sets the painter.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Constructor Details
- 
WMeasurePaintDevice
Creates a paint device to measure for the underlying device. 
 - 
 - 
Method Details
- 
getBoundingRect
Returns the bounding rectangle of everything painted so far.The bounding rect is returned in device coordinates (i.e. after all transformations applied).
 - 
getFeatures
Description copied from interface:WPaintDeviceReturns device features.- Specified by:
 getFeaturesin interfaceWPaintDevice
 - 
setChanged
Description copied from interface:WPaintDeviceIndicates changes in painter state.The
flagsargument is the logical OR of one or more change flags.- Specified by:
 setChangedin interfaceWPaintDevice- See Also:
 WPaintDevice.ChangeFlag
 - 
setChanged
Description copied from interface:WPaintDeviceIndicates changes in painter state.- Specified by:
 setChangedin interfaceWPaintDevice
 - 
drawArc
Description copied from interface:WPaintDeviceDraws an arc.The arc describes the segment of an ellipse enclosed by the rect. The segment starts at
startAngle, and spans an angle given byspanAngle. 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.
- Specified by:
 drawArcin interfaceWPaintDevice
 - 
drawImage
public void drawImage(WRectF rect, java.lang.String imageUri, int imgWidth, int imgHeight, WRectF sourceRect)Description copied from interface:WPaintDeviceDraws an image.Draws sourceRect from the image with URL
imageUriand original dimensions imgWidth andimgHeightto the location, into the rectangle defined byrect.The image is transformed using the current painter settings.
- Specified by:
 drawImagein interfaceWPaintDevice
 - 
drawLine
public void drawLine(double x1, double y1, double x2, double y2)Description copied from interface:WPaintDeviceDraws a line.The line must be stroked and transformed using the current painter settings.
- Specified by:
 drawLinein interfaceWPaintDevice
 - 
drawPath
Description copied from interface:WPaintDeviceDraws a path.The path must be stroked, filled, and transformed using the current painter settings.
- Specified by:
 drawPathin interfaceWPaintDevice
 - 
drawText
public void drawText(WRectF rect, java.util.EnumSet<AlignmentFlag> flags, TextFlag textFlag, java.lang.CharSequence text, WPointF clipPoint)Description copied from interface:WPaintDeviceDraws 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.
- Specified by:
 drawTextin interfaceWPaintDevice
 - 
measureText
Description copied from interface:WPaintDeviceMeasures 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=truethen 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.
- Specified by:
 measureTextin interfaceWPaintDevice
 - 
measureText
Description copied from interface:WPaintDeviceMeasures rendered text size.Returns
measureText(text, - 1, false)- Specified by:
 measureTextin interfaceWPaintDevice
 - 
measureText
Description copied from interface:WPaintDeviceMeasures rendered text size.- Specified by:
 measureTextin interfaceWPaintDevice
 - 
getFontMetrics
Description copied from interface:WPaintDeviceReturns font metrics.This returns font metrics for the current font.
Throws a std::logic_error if the underlying device does not provide font metrics.
- Specified by:
 getFontMetricsin interfaceWPaintDevice
 - 
init
public void init()Description copied from interface:WPaintDeviceInitializes the device for painting.This method is called when a
WPainterstarts painting.- Specified by:
 initin interfaceWPaintDevice- See Also:
 WPainter.begin(WPaintDevice device),WPaintDevice.getPainter()
 - 
done
public void done()Description copied from interface:WPaintDeviceFinishes painting on the device.This method is called when a
WPainterstopped painting.- Specified by:
 donein interfaceWPaintDevice- See Also:
 WPainter.end()
 - 
isPaintActive
public boolean isPaintActive()Description copied from interface:WPaintDeviceReturns whether painting is active.- Specified by:
 isPaintActivein interfaceWPaintDevice- See Also:
 WPaintDevice.init(),WPaintDevice.getPainter()
 - 
getWidth
Description copied from interface:WPaintDeviceReturns the device width.The device width, in pixels, establishes the width of the device coordinate system.
- Specified by:
 getWidthin interfaceWPaintDevice
 - 
getHeight
Description copied from interface:WPaintDeviceReturns the device height.The device height, in pixels, establishes the height of the device coordinate system.
- Specified by:
 getHeightin interfaceWPaintDevice
 - 
getPainter
Description copied from interface:WPaintDeviceReturns the painter that is currently painting on the device.- Specified by:
 getPainterin interfaceWPaintDevice- See Also:
 WPaintDevice.init()
 - 
setPainter
Description copied from interface:WPaintDeviceSets the painter.- Specified by:
 setPainterin interfaceWPaintDevice
 
 -