@microsoft/live-share-canvas package
Dry |
Represents a canvas suitable for "dry ink", i.e. the persistent drawing. DryCanvas renders synchonously. |
Dry |
Represents the base class from wet and dry canvases, implementing the common rendering logic. |
Inking |
Represents the base class for all canvases. InkingCanvas provides resizing, coordinate tramnslation and base drawingprimitives. |
Inking |
Handles user interaction with a canvas, and manages the rendering of wet and dry strokes. |
Input |
Defines an input filter. Input filters are used to transform input points on the fly. |
Input |
Represents a collection of input filters. |
Input |
A basic input event provider implementation. |
Jitter |
Implements a jitter reduction filter, which straightens stroke by ignoring micro movements detected by the input device, mainly pens. |
Laser |
Represents a canvas that implements the laser pointer behavior. |
Live |
Enables live and collaborative inking. |
Live |
Represents a live (shared) cursor. Applications that want to customize
the appearance of cursors on the screen should extend |
Multicast |
Implements a simple typed multicast event. |
Pointer |
InputProvider implementation that hooks into a DOM element's pointer events. |
Stroke |
Represents a concrete stroke object. |
Wet |
Represents a canvas suitable for "wet ink", i.e. an ongoing stroke. |
IAdd |
Defines the arguments of the AddPointsEvent. |
IAdd |
Defines options used by |
IBegin |
Defines the arguments of the BeginStrokeEvent. |
IBrush |
Defines a brush as used to draw strokes. |
IColor |
Defines an RGB color |
IMulticast |
Defines a typed multicast event, i.e. an event that can have multiple listeners. |
IPoint |
Defines a 2D point. |
IPointer |
Represents a pointer event such as up, down or enter. |
IPointer |
Representes a a pointer move event. |
IPointer |
Defines the arguments of the PointerMovedEvent. |
IPointer |
Defines a 2D point with pointer pressure. |
IRaw |
Represents the raw data of a stroke. |
IRect |
Defines a rectangle. |
ISegment |
Defines a segment between two points. |
IStroke |
Defines a stroke, i.e. a collection of points that can be rendered on a canvas. |
IStroke |
Defines a set of options when creating new strokes. |
IUser |
Encapsulates information about a user. |
IWet |
Defines a "wet" stroke, i.e. a stroke as it's being drawn. |
Arrow |
|
Brush |
Defines the shape of a brush's tip. |
Brush |
Defines brush types. |
Canvas |
Defines the refernece point of a canvas. The reference point is the origin used for panning and zooming operations. |
Event |
Defines a typed callback function used by multicast events. |
Inking |
Defines available inking tools. |
Stroke |
|
Stroke |
Stroke modes. |
Stroke |
Stroke types. |
combine |
|
darken |
Darkens the given color by a certain intensity. |
expand |
Expands the specified rectangle so it contains the specified point. |
from |
Converts a CSS color expressed in the #RRGGBB format into an IColor object |
get |
Computes the distance between two points. |
get |
Adjusts a size given a pointer pressure. |
get |
Computes the square of the distance between two points. This provides a cheaper way to compare multiple distances since it doesn't compute any square root. |
lighten |
Lightens the given color by a certain intensity. |
screen |
Converts screen coordinates to viewport coordinates. |
to |
Converts an IColor object into its CSS rgba() representation. |
viewport |
Converts viewport coordinates to screen coordinates. |
function combineRects(rect1: IRect, rect2: IRect): IRect
Parameters
- rect1
- IRect
- rect2
- IRect
Returns
Darkens the given color by a certain intensity.
function darkenColor(color: IColor, intensity: number): IColor
Parameters
- color
- IColor
The color to darken.
- intensity
-
number
The intensity of the darkening. Must be between 0 and 100.
Returns
The darkened color.
Expands the specified rectangle so it contains the specified point.
function expandRect(rect: IRect, point: IPoint): IRect
Parameters
- rect
- IRect
The rectangle to extend.
- point
- IPoint
The point to extend the rectangle to.
Returns
The expanded rectangle.
Converts a CSS color expressed in the #RRGGBB format into an IColor object
function fromCssColor(color: string): IColor
Parameters
- color
-
string
The CSS color to convert.
Returns
The converted color as an IColor object, or a default color if the provided color string isn't valid.
Computes the distance between two points.
function getDistanceBetweenPoints(p1: IPoint, p2: IPoint): number
Parameters
- p1
- IPoint
The first point.
- p2
- IPoint
The second point.
Returns
number
The distance between p1
and p2
.
Adjusts a size given a pointer pressure.
function getPressureAdjustedSize(baseSize: number, pressure: number): number
Parameters
- baseSize
-
number
The size to adjust.
- pressure
-
number
The pressure.
Returns
number
The adjusted size.
Computes the square of the distance between two points. This provides a cheaper way to compare multiple distances since it doesn't compute any square root.
function getSquaredDistanceBetweenPoints(p1: IPoint, p2: IPoint): number
Parameters
- p1
- IPoint
The first point.
- p2
- IPoint
The second point.
Returns
number
The square of the distance between p1
and p2
.
Lightens the given color by a certain intensity.
function lightenColor(color: IColor, intensity: number): IColor
Parameters
- color
- IColor
The color to lighten.
- intensity
-
number
The intensity of the lightening. Must be between 0 and 100.
Returns
The lightened color.
Converts screen coordinates to viewport coordinates.
function screenToViewport(p: IPoint, viewportReferencePoint: IPoint, viewportOffset: IPoint, scale: number): IPoint
Parameters
- p
- IPoint
The point to convert.
- viewportReferencePoint
- IPoint
The videwport's reference point.
- viewportOffset
- IPoint
The viewport offset.
- scale
-
number
The viewport scale. Defaults to 1 if the provided value is less than or equal to 0.
Returns
The converted point.
Converts an IColor object into its CSS rgba() representation.
function toCssRgbaColor(color: IColor, alpha?: number): string
Parameters
- color
- IColor
The color to convert.
- alpha
-
number
Returns
string
A string representing the CSS rgba() representation of the color.
Converts viewport coordinates to screen coordinates.
function viewportToScreen(p: IPoint, viewportReferencePoint: IPoint, viewportOffset: IPoint, scale: number): IPoint
Parameters
- p
- IPoint
The point to convert.
- viewportReferencePoint
- IPoint
The viewport's reference point.
- viewportOffset
- IPoint
The viewport offset.
- scale
-
number
The viewport scale. Defaults to 1 if the provided value is less than or equal to 0.
Returns
The converted point.