|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WResource
eu.webtoolkit.jwt.WRasterPaintDevice
public class WRasterPaintDevice
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WResource |
|---|
WResource.DispositionType |
| Nested classes/interfaces inherited from interface eu.webtoolkit.jwt.WPaintDevice |
|---|
WPaintDevice.ChangeFlag, WPaintDevice.FeatureFlag |
| Constructor Summary | |
|---|---|
WRasterPaintDevice(java.lang.String format,
WLength width,
WLength height)
|
|
| Method Summary | |
|---|---|
void |
clear()
Clears the image (resets the background to solid white). |
static java.awt.Color |
createColor(WColor color)
Converts a jwt.WColor to an awt.Color |
static java.awt.Shape |
createShape(WPainterPath path)
Converts a jwt.WPainterPath to an awt.Shape |
static java.awt.Stroke |
createStroke(WPainter painter,
WPen pen)
converts a jwt.WPen to an awt.Stroke |
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> flags,
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. |
protected void |
handleRequest(WebRequest request,
WebResponse response)
Handles a request. |
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. |
| Methods inherited from class eu.webtoolkit.jwt.WResource |
|---|
dataChanged, dataReceived, generateUrl, getDispositionType, getInternalPath, getSuggestedFileName, getUrl, setChanged, setDispositionType, setInternalPath, setUploadProgress, suggestFileName, suggestFileName, write, write |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getId, getObjectName, remove, setObjectName, tr |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WRasterPaintDevice(java.lang.String format,
WLength width,
WLength height)
| Method Detail |
|---|
protected void handleRequest(WebRequest request,
WebResponse response)
throws java.io.IOException
WResourceReimplement 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.
handleRequest in class WResourcerequest - The request informationresponse - The response object
java.io.IOExceptionpublic void done()
WPaintDevice
This method is called when a WPainter stopped painting.
done in interface WPaintDeviceWPainter.end()
public void drawArc(WRectF rect,
double startAngle,
double spanAngle)
WPaintDevice
The arc is defined as in
WPainter#drawArc()
The arc must be stroked, filled, and transformed using the current painter settings.
drawArc in interface WPaintDevice
public void drawImage(WRectF rect,
java.lang.String imageUri,
int imgWidth,
int imgHeight,
WRectF sourceRect)
WPaintDevice
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.
drawImage in interface WPaintDevice
public void drawLine(double x1,
double y1,
double x2,
double y2)
WPaintDeviceThe line must be stroked and transformed using the current painter settings.
drawLine in interface WPaintDevicepublic void drawPath(WPainterPath path)
WPaintDeviceThe path must be stroked, filled, and transformed using the current painter settings.
drawPath in interface WPaintDevicepublic static java.awt.Shape createShape(WPainterPath path)
path -
public void drawText(WRectF rect,
java.util.EnumSet<AlignmentFlag> flags,
TextFlag textFlag,
java.lang.CharSequence text)
WPaintDeviceThe text must be rendered, stroked and transformed using the current painter settings.
drawText in interface WPaintDevicepublic WLength getHeight()
WPaintDeviceThe device height, in pixels, establishes the height of the device coordinate system.
getHeight in interface WPaintDevicepublic WPainter getPainter()
WPaintDevice
getPainter in interface WPaintDeviceWPaintDevice.init()public WLength getWidth()
WPaintDeviceThe device width, in pixels, establishes the width of the device coordinate system.
getWidth in interface WPaintDevicepublic void init()
WPaintDevice
This method is called when a WPainter starts painting.
init in interface WPaintDeviceWPainter.begin(WPaintDevice device),
WPaintDevice.getPainter()public boolean isPaintActive()
WPaintDevice
isPaintActive in interface WPaintDeviceWPaintDevice.init(),
WPaintDevice.getPainter()public void setChanged(java.util.EnumSet<WPaintDevice.ChangeFlag> flags)
WPaintDevice
The flags argument is the logical OR of one or more change
flags.
setChanged in interface WPaintDeviceWPaintDevice.ChangeFlag
public void setChanged(WPaintDevice.ChangeFlag flag,
WPaintDevice.ChangeFlag... flags)
WPaintDevice
Calls setChanged(EnumSet.of(flag,
flags))
setChanged in interface WPaintDevicepublic void setPainter(WPainter painter)
WPaintDevice
setPainter in interface WPaintDevicepublic static java.awt.Color createColor(WColor color)
color - the JWt color
public static java.awt.Stroke createStroke(WPainter painter,
WPen pen)
painter - the painter used to take into account transformations for the pen widthpen - the JWt pen
public void clear()
public WFontMetrics getFontMetrics()
WPaintDeviceThis returns font metrics for the current font.
Throws a std::logic_error if the underlying device does not provide font metrics.
getFontMetrics in interface WPaintDevice
public WTextItem measureText(java.lang.CharSequence text,
double maxWidth,
boolean wordWrap)
WPaintDeviceReturns 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.
measureText in interface WPaintDevicepublic WTextItem measureText(java.lang.CharSequence text)
WPaintDevice
Returns
measureText(text, - 1, false)
measureText in interface WPaintDevice
public WTextItem measureText(java.lang.CharSequence text,
double maxWidth)
WPaintDevice
Returns
measureText(text, maxWidth, false)
measureText in interface WPaintDevicepublic java.util.EnumSet<WPaintDevice.FeatureFlag> getFeatures()
WPaintDevice
getFeatures in interface WPaintDevice
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||