Constructor
new ViewRenderer(target)
Initializes a new instance of
ViewRenderer
.
Parameters:
Name | Type | Description |
---|---|---|
target |
pureweb.client.View | The target view to render. |
Extends
- pureweb.events.EventTarget
Members
-
<static> EventType → string
-
Types of events for which client applications can listen on
ViewRenderer
.Properties:
Name Type Default Description VIEW_UPDATED
string The event that gets dispatched when ViewRenderer
has rendered the view.VIEW_SIZE_CHANGED
string The event that gets dispatched when the size of the view being rendered to changes. IMAGE_SIZE_CHANGED
string The event that gets dispatched when imageSize
is set.ACTIVATED
string The event that gets dispatched when this renderer is activated on a view. DEACTIVATED
string The event that gets dispatched when this renderer is deactivated from a view. TRANSFORMS_CHANGED
string The event that gets dispatched when the source or client geometry has changed. -
<protected> logger → goog.debug.Logger
-
Define logger.
-
renderBytes
-
Called when bytes are received and should be rendered. It is HIGHLY RECOMMENDED that you override this in your implementation to render display data.
Method Detail
activate()
Called when a
ViewRenderer
is being used by a view.
It is best to use the ViewRenderer.ACTIVATE
event in implementations rather than overriding this method.
If you override this method, you MUST call the base method first.
beginRendering(canvas, opt_sourceSize)
Prepares the rendering canvas for the external implementation to draw on.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
canvas |
Element | The canvas that will receive the rendering. | |
opt_sourceSize |
Object |
<optional> |
The size of the source; if not supplied here, the client size must be set before calling this method. |
clear()
Clears the view image data.
It is HIGHLY RECOMMENDED that your implementation override this method in order to properly clear the view.
deactivate()
Called when a
ViewRenderer
will stop being used by the view.
If you override this method you MUST call the base method last.
doneRendering(canvas, parameters)
Restores the canvas after rendering. Also fires an event to indicate that rendering is complete on the view.
Passes the parameters provided by
renderBytes
.
Parameters:
Name | Type | Description |
---|---|---|
canvas |
Element | The canvas to restore. |
parameters |
Object | Additional rendering parameters. |
getProfilerInfo() → {string}
Returns the profiler information, expressed as a string.
This will be attached to the view's profiler when the view is attached.
Sub-classes should override with their specific profiler information tag.
getSourceSize() → {Object}
Returns the dimensions (width and height) of source service application (image) size.
getTarget() → {pureweb.client.View}
Returns the target view for this renderer.
getViewSize() → {Object}
Returns the dimensions (width and height) of the view.
isActivated() → {boolean}
Returns a Boolean value that indicates whether this
ViewRenderer
is activated.
Will return true
if it is, or false
otherwise.
isActivatingNextUpdate() → {boolean}
Returns a Boolean value that indicates whether this
ViewRenderer
is going to be activated on
the next update.
Will return true
if it will be, or false
otherwise.
localToNormalized(local) → {Object}
Converts a point from local coordinates to normalized coordinates.
Parameters:
Name | Type | Description |
---|---|---|
local |
Object | The point in local coordinates. |
localToSource(point) → {Object}
Converts a point from local coordinates to coordinates of the source image (service coordinates).
Parameters:
Name | Type | Description |
---|---|---|
point |
Object | The point in local coordinates. |
normalizedToLocal(normalized) → {Object}
Converts a point from normalized coordinates to local coordinates.
Parameters:
Name | Type | Description |
---|---|---|
normalized |
Object | The point in normalized coordinates. |
setActivatingNextUpdate(activating)
Sets a Boolean flag that indicates whether this
ViewRenderer
is going to be activated on
the next update.
Parameters:
Name | Type | Description |
---|---|---|
activating |
boolean | Set to true if activating on next update, or to false otherwise. |
setSourceSize(sourceSize)
Sets the dimensions (width and height) of image of the client, based on the dimensions of the source.
Parameters:
Name | Type | Description |
---|---|---|
sourceSize |
Object | The dimensions of the source. |
sourceToLocal(sourceCoords) → {Object}
Converts a point from source image coordinates (i.e. service coordinates) to local coordinates.
Parameters:
Name | Type | Description |
---|---|---|
sourceCoords |
Object | The point in source image coordinates. |
toString() → {string}
Returns a string representation of the view renderer.
It is recommended that sub-classes override the
toString
method to declare the sub-class name.
<protected> updateTransforms(sourceW, sourceH)
Updates the transformation matrix based on the new size.
The size of the view (local size) at runtime must already be known.
Parameters:
Name | Type | Description |
---|---|---|
sourceW |
number | The width of the service source image. |
sourceH |
number | The height of the service source image. |