public class Renderer extends java.lang.Object implements IAutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
addListener(IRendererListener listener)
Adds the specified listener to this renderer.
|
void |
close()
Deletes native counterpart of this auto closable object
|
void |
commitModelDraw(long id)
Indicates that an asynchronous drawing of the Model Layer is over.
|
void |
drawBackground(int x,
int y,
int width,
int height,
ICanvas canvas)
Requests drawing of a region of the Background layer.
|
void |
drawCaptureStrokes(int x,
int y,
int width,
int height,
ICanvas canvas)
Requests drawing of a region of the Capture layer.
|
void |
drawModel(int x,
int y,
int width,
int height,
ICanvas canvas)
Requests drawing of a region of the Model layer.
|
long |
drawModelAsync(int x,
int y,
int width,
int height,
ICanvas canvas)
Requests asynchronous drawing of a region of the Model layer.
|
void |
drawTemporaryItems(int x,
int y,
int width,
int height,
ICanvas canvas)
Requests drawing of a region of the Temporary layer.
|
float |
getDpiX()
Returns the horizontal DPI resolution of the renderer.
|
float |
getDpiY()
Returns the vertical DPI resolution of the renderer.
|
float |
getPixelSize()
Returns the size of a pixel, in millimeters.
|
IRenderTarget |
getRenderTarget()
Returns the target to which this renderer draws.
|
Point |
getViewOffset()
Returns the view offset.
|
float |
getViewScale()
Returns the current zoom view scale.
|
Transform |
getViewTransform()
Returns the transform that is used to map model coordinates into view
coordinates.
|
boolean |
isClosed()
Tells whether the
close() method has been called. |
void |
registerStroker(java.lang.String name,
IStrokerFactory factory)
Registers a custom stroker factory.
|
void |
removeListener(IRendererListener listener)
Removes the specified listener from this renderer.
|
void |
setViewOffset(float x,
float y)
Sets the view offset.
|
void |
setViewScale(float scale)
Sets the current zoom view scale.
|
void |
unregisterStroker(java.lang.String name)
Unregister custom stroker factory.
|
void |
zoom(float factor)
Increase zoom by a factor.
|
void |
zoomAt(Point p,
float factor)
Increase zoom by a factor around a given point.
|
public final void close()
IAutoCloseable
close
in interface IAutoCloseable
public final boolean isClosed()
close()
method has been called. Once an object
is closed any method will throw IllegalStateException
.true
if this object is closed.public final void addListener(IRendererListener listener)
listener
- the listener to be added.java.lang.IllegalStateException
- when this editor is closed.java.lang.IllegalArgumentException
- when listener
is null.public final void removeListener(IRendererListener listener)
listener
- the listener to be removed.java.lang.IllegalStateException
- when this editor is closed.java.lang.IllegalArgumentException
- when listener
is null.public float getDpiX()
public float getDpiY()
public float getPixelSize()
public final float getViewScale()
public final void setViewScale(float scale) throws java.lang.IllegalArgumentException
scale
- the view scale.java.lang.IllegalArgumentException
- when scale
is not a number.java.lang.IllegalArgumentException
- when scale
is negative.java.lang.IllegalArgumentException
- when scale
is zero.public final void zoom(float factor) throws java.lang.IllegalArgumentException
factor
- the zoom modification factor.java.lang.IllegalArgumentException
- when factor
is not a number.java.lang.IllegalArgumentException
- when factor
is negative.java.lang.IllegalArgumentException
- when factor
is zero.public final void zoomAt(Point p, float factor) throws java.lang.IllegalArgumentException
p
- point around which to adjust the view.factor
- the zoom modification factor.java.lang.IllegalArgumentException
- when factor
is not a number.java.lang.IllegalArgumentException
- when factor
is negative.java.lang.IllegalArgumentException
- when factor
is zero.public final Point getViewOffset()
public final void setViewOffset(float x, float y)
x
- the x coordinate of the view offset.y
- the y coordinate of the view offset.java.lang.IllegalArgumentException
- when x
is not a number.java.lang.IllegalArgumentException
- when x
is negative.java.lang.IllegalArgumentException
- when x
is zero.java.lang.IllegalArgumentException
- when y
is not a number.java.lang.IllegalArgumentException
- when y
is negative.java.lang.IllegalArgumentException
- when y
is zero.public Transform getViewTransform()
public IRenderTarget getRenderTarget()
public final void registerStroker(java.lang.String name, IStrokerFactory factory)
name
- the value of the -myscript-pen-brush css property that selects
this stroker.factory
- the user provided stroker factory.java.lang.IllegalArgumentException
- when factory
is null.public final void unregisterStroker(java.lang.String name)
name
- the stroker factory.public final long drawModelAsync(int x, int y, int width, int height, ICanvas canvas)
commitModelDraw()
.x
- top left x coordinate of the region to draw.y
- top left y coordinate of the region to draw.width
- width of the region to draw.height
- height of the region to draw.canvas
- target canvas.java.lang.IllegalArgumentException
- when canvas
is null.public final void commitModelDraw(long id)
id
- the identifier of the drawing request, as returned by
drawModelAsync()
.public final void drawBackground(int x, int y, int width, int height, ICanvas canvas)
x
- top left x coordinate of the region to draw.y
- top left y coordinate of the region to draw.width
- width of the region to draw.height
- height of the region to draw.canvas
- target canvas.java.lang.IllegalArgumentException
- when canvas
is null.public final void drawModel(int x, int y, int width, int height, ICanvas canvas)
x
- top left x coordinate of the region to draw.y
- top left y coordinate of the region to draw.width
- width of the region to draw.height
- height of the region to draw.canvas
- target canvas.java.lang.IllegalArgumentException
- when canvas
is null.public final void drawTemporaryItems(int x, int y, int width, int height, ICanvas canvas)
x
- top left x coordinate of the region to draw.y
- top left y coordinate of the region to draw.width
- width of the region to draw.height
- height of the region to draw.canvas
- target canvas.java.lang.IllegalArgumentException
- when canvas
is null.public final void drawCaptureStrokes(int x, int y, int width, int height, ICanvas canvas)
x
- top left x coordinate of the region to draw.y
- top left y coordinate of the region to draw.width
- width of the region to draw.height
- height of the region to draw.canvas
- target canvas.java.lang.IllegalArgumentException
- when canvas
is null.