Class WSvgImage
- All Implemented Interfaces:
WPaintDevice
,WVectorImage
The WSvgImage is primarily used by WPaintedWidget
to render to the browser in Support
Vector Graphics (SVG) format.
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WResource
WResource.DispositionType
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
done()
Finishes painting on the device.void
Draws an arc.void
Draws an image.void
drawLine
(double x1, double y1, double x2, double y2) Draws a line.void
drawPath
(WPainterPath path) Draws a path.void
Draws a rectangle.void
drawText
(WRectF rect, EnumSet<AlignmentFlag> flags, TextFlag textFlag, CharSequence text, WPointF clipPoint) Draws text.Returns device features.Returns font metrics.Returns the device height.Returns the painter that is currently painting on the device.Internal method.getWidth()
Returns the device width.void
handleRequest
(WebRequest request, WebResponse response) Handles a request.void
init()
Initializes the device for painting.boolean
Returns whether painting is active.measureText
(CharSequence text, double maxWidth, boolean wordWrap) Measures rendered text size.void
setChanged
(EnumSet<PainterChangeFlag> flags) Indicates changes in painter state.void
setPainter
(WPainter painter) Sets the painter.Methods inherited from class eu.webtoolkit.jwt.WResource
dataChanged, dataExceeded, dataReceived, generateUrl, getDispositionType, getInternalPath, getSuggestedFileName, getUrl, getVersion, incrementVersion, isInvalidAfterChanged, setChanged, setDispositionType, setInternalPath, setInvalidAfterChanged, setTakesUpdateLock, setUploadProgress, suggestFileName, suggestFileName, takesUpdateLock, write, write
Methods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, setObjectName, tr
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface eu.webtoolkit.jwt.WPaintDevice
measureText, measureText, setChanged
-
Constructor Details
-
WSvgImage
Create an SVG paint device.If
paintUpdate
istrue
, then only an SVG fragment will be rendered that can be used to update the DOM of an existing SVG image, instead of a full SVG image. -
WSvgImage
Create an SVG paint device.
-
-
Method Details
-
getFeatures
Description copied from interface:WPaintDevice
Returns device features.- Specified by:
getFeatures
in interfaceWPaintDevice
-
setChanged
Description copied from interface:WPaintDevice
Indicates changes in painter state.The
flags
argument is the logical OR of one or more change flags.- Specified by:
setChanged
in interfaceWPaintDevice
-
drawArc
Description copied from interface:WPaintDevice
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 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:
drawArc
in interfaceWPaintDevice
-
drawImage
Description copied from interface:WPaintDevice
Draws an image.Draws sourceRect from the image with URL
imageUri
and original dimensions imgWidth andimgHeight
to the location, into the rectangle defined byrect
.The image is transformed using the current painter settings.
- Specified by:
drawImage
in interfaceWPaintDevice
-
drawLine
public void drawLine(double x1, double y1, double x2, double y2) Description copied from interface:WPaintDevice
Draws a line.The line must be stroked and transformed using the current painter settings.
- Specified by:
drawLine
in interfaceWPaintDevice
-
drawRect
Description copied from interface:WPaintDevice
Draws a rectangle.The rect must be stroked, filled, and transformed using the current painter settings.
- Specified by:
drawRect
in interfaceWPaintDevice
-
drawPath
Description copied from interface:WPaintDevice
Draws a path.The path must be stroked, filled, and transformed using the current painter settings.
- Specified by:
drawPath
in interfaceWPaintDevice
-
drawText
public void drawText(WRectF rect, EnumSet<AlignmentFlag> flags, TextFlag textFlag, CharSequence text, WPointF clipPoint) Description copied from interface:WPaintDevice
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.
- Specified by:
drawText
in interfaceWPaintDevice
-
measureText
Description copied from interface:WPaintDevice
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.
- Specified by:
measureText
in interfaceWPaintDevice
-
getFontMetrics
Description copied from interface:WPaintDevice
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.
- Specified by:
getFontMetrics
in interfaceWPaintDevice
-
init
public void init()Description copied from interface:WPaintDevice
Initializes the device for painting.This method is called when a
WPainter
starts painting.- Specified by:
init
in interfaceWPaintDevice
- See Also:
-
done
public void done()Description copied from interface:WPaintDevice
Finishes painting on the device.This method is called when a
WPainter
stopped painting.- Specified by:
done
in interfaceWPaintDevice
- See Also:
-
isPaintActive
public boolean isPaintActive()Description copied from interface:WPaintDevice
Returns whether painting is active.- Specified by:
isPaintActive
in interfaceWPaintDevice
- See Also:
-
getRendered
Description copied from interface:WVectorImage
Internal method.- Specified by:
getRendered
in interfaceWVectorImage
-
getWidth
Description copied from interface:WPaintDevice
Returns the device width.The device width, in pixels, establishes the width of the device coordinate system.
- Specified by:
getWidth
in interfaceWPaintDevice
-
getHeight
Description copied from interface:WPaintDevice
Returns the device height.The device height, in pixels, establishes the height of the device coordinate system.
- Specified by:
getHeight
in interfaceWPaintDevice
-
handleRequest
Description copied from class:WResource
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.
- Specified by:
handleRequest
in classWResource
- Parameters:
request
- The request informationresponse
- The response object- Throws:
IOException
-
getPainter
Description copied from interface:WPaintDevice
Returns the painter that is currently painting on the device.- Specified by:
getPainter
in interfaceWPaintDevice
- See Also:
-
setPainter
Description copied from interface:WPaintDevice
Sets the painter.- Specified by:
setPainter
in interfaceWPaintDevice
-