|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface WPaintDevice
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
getWidth() and
getHeight(). 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 JWt 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.
WPainter| Nested Class Summary | |
|---|---|
static class |
WPaintDevice.ChangeFlag
Enumeration to communicate painter state changes. |
static class |
WPaintDevice.FeatureFlag
Enumeration to indicate paint device features. |
| Method Summary | |
|---|---|
void |
done()
Finishes painting on the device. |
void |
drawArc(WRectF rect,
double startAngle,
double spanAngle)
Draws an arc. |
void |
drawImage(WRectF rect,
java.lang.String imageUri,
int imgWidth,
int imgHeight,
WRectF sourceRect)
Draws an image. |
void |
drawLine(double x1,
double y1,
double x2,
double y2)
Draws a line. |
void |
drawPath(WPainterPath path)
Draws a path. |
void |
drawText(WRectF rect,
java.util.EnumSet<AlignmentFlag> alignmentFlags,
TextFlag textFlag,
java.lang.CharSequence text)
Draws text. |
java.util.EnumSet<WPaintDevice.FeatureFlag> |
getFeatures()
Returns device features. |
WFontMetrics |
getFontMetrics()
Returns font metrics. |
WLength |
getHeight()
Returns the device height. |
WPainter |
getPainter()
Returns the painter that is currently painting on the device. |
WLength |
getWidth()
Returns the device width. |
void |
init()
Initializes the device for painting. |
boolean |
isPaintActive()
Returns whether painting is active. |
WTextItem |
measureText(java.lang.CharSequence text)
Measures rendered text size. |
WTextItem |
measureText(java.lang.CharSequence text,
double maxWidth)
Measures rendered text size. |
WTextItem |
measureText(java.lang.CharSequence text,
double maxWidth,
boolean wordWrap)
Measures rendered text size. |
void |
setChanged(java.util.EnumSet<WPaintDevice.ChangeFlag> flags)
Indicates changes in painter state. |
void |
setChanged(WPaintDevice.ChangeFlag flag,
WPaintDevice.ChangeFlag... flags)
Indicates changes in painter state. |
void |
setPainter(WPainter painter)
Sets the painter. |
| Method Detail |
|---|
java.util.EnumSet<WPaintDevice.FeatureFlag> getFeatures()
WLength getWidth()
The device width, in pixels, establishes the width of the device coordinate system.
WLength getHeight()
The device height, in pixels, establishes the height of the device coordinate system.
void setChanged(java.util.EnumSet<WPaintDevice.ChangeFlag> flags)
The flags argument is the logical OR of one or more change
flags.
WPaintDevice.ChangeFlag
void setChanged(WPaintDevice.ChangeFlag flag,
WPaintDevice.ChangeFlag... flags)
Calls setChanged(EnumSet.of(flag,
flags))
void drawArc(WRectF rect,
double startAngle,
double spanAngle)
The arc is defined as in
WPainter#drawArc()
The arc must be stroked, filled, and transformed using the current painter settings.
void drawImage(WRectF rect,
java.lang.String imageUri,
int imgWidth,
int imgHeight,
WRectF sourceRect)
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.
void drawLine(double x1,
double y1,
double x2,
double y2)
The line must be stroked and transformed using the current painter settings.
void drawPath(WPainterPath path)
The path must be stroked, filled, and transformed using the current painter settings.
void drawText(WRectF rect,
java.util.EnumSet<AlignmentFlag> alignmentFlags,
TextFlag textFlag,
java.lang.CharSequence text)
The text must be rendered, stroked and transformed using the current painter settings.
WTextItem measureText(java.lang.CharSequence text,
double maxWidth,
boolean wordWrap)
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.
WTextItem measureText(java.lang.CharSequence text)
Returns
measureText(text, - 1, false)
WTextItem measureText(java.lang.CharSequence text,
double maxWidth)
Returns
measureText(text, maxWidth, false)
WFontMetrics getFontMetrics()
This returns font metrics for the current font.
Throws a std::logic_error if the underlying device does not provide font metrics.
void init()
This method is called when a WPainter starts painting.
WPainter.begin(WPaintDevice device),
getPainter()void done()
This method is called when a WPainter stopped painting.
WPainter.end()boolean isPaintActive()
init(),
getPainter()WPainter getPainter()
init()void setPainter(WPainter painter)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||