MyScript Interactive Ink SDK 4.4.2
Public Member Functions | List of all members
myscript::iink::Renderer Class Referenceabstract

#include <Renderer.h>

Public Member Functions

virtual ~Renderer ()=default
 
virtual void addListener (std::shared_ptr< IRendererListener > listener)=0
 
virtual void removeListener (std::shared_ptr< IRendererListener > listener)=0
 
virtual float getDpiX () const noexcept=0
 
virtual float getDpiY () const noexcept=0
 
virtual float getPixelSize () const noexcept=0
 
virtual float getViewScale () noexcept=0
 
virtual void setViewScale (float scale)=0
 
virtual void zoom (float factor)=0
 
virtual void zoomAt (graphics::Point p, float factor)=0
 
virtual graphics::Point getViewOffset () const noexcept=0
 
virtual void setViewOffset (float x, float y)=0
 
virtual graphics::Transform getViewTransform () const noexcept=0
 
virtual std::shared_ptr< IRenderTarget > getRenderTarget () const noexcept=0
 
virtual void registerStroker (String name, std::shared_ptr< graphics::IStrokerFactory > factory)=0
 
virtual void unregisterStroker (String name) noexcept=0
 
virtual uint64_t drawModelAsync (int x, int y, int width, int height, graphics::ICanvas *canvas)=0
 
virtual void commitModelDraw (uint64_t id)=0
 
virtual void drawModel (int x, int y, int width, int height, graphics::ICanvas *canvas)=0
 
virtual void drawCaptureStrokes (int x, int y, int width, int height, graphics::ICanvas *canvas)=0
 

Detailed Description

The renderer triggers display updates to a IRenderTarget and implements rendering to a ICanvas.

Constructor & Destructor Documentation

◆ ~Renderer()

virtual myscript::iink::Renderer::~Renderer ( )
virtualdefault

Member Function Documentation

◆ addListener()

virtual void myscript::iink::Renderer::addListener ( std::shared_ptr< IRendererListener >  listener)
pure virtual

Adds the specified listener to this renderer.

Parameters
listenerthe listener to be added.
Exceptions
std::invalid_argumentwhen listener is nullptr.

◆ removeListener()

virtual void myscript::iink::Renderer::removeListener ( std::shared_ptr< IRendererListener >  listener)
pure virtual

Removes the specified listener from this renderer.

Parameters
listenerthe listener to be removed.
Exceptions
std::invalid_argumentwhen listener is nullptr.

◆ getDpiX()

virtual float myscript::iink::Renderer::getDpiX ( ) const
pure virtualnoexcept

Returns the physical horizontal resolution of the display in dots per inch, as given at creation of this renderer.

Returns
the horizontal resolution.

◆ getDpiY()

virtual float myscript::iink::Renderer::getDpiY ( ) const
pure virtualnoexcept

Returns the physical vertical resolution of the display in dots per inch, as given at creation of this renderer.

Returns
the vertical resolution.

◆ getPixelSize()

virtual float myscript::iink::Renderer::getPixelSize ( ) const
pure virtualnoexcept

Returns the size of a pixel in model coordinates.

Returns
the size of a pixel.

◆ getViewScale()

virtual float myscript::iink::Renderer::getViewScale ( )
pure virtualnoexcept

Returns the current zoom view scale.

Returns
the view scale.

◆ setViewScale()

virtual void myscript::iink::Renderer::setViewScale ( float  scale)
pure virtual

Sets the current zoom view scale.

Parameters
scalethe view scale.
Exceptions
std::invalid_argumentwhen scale is not a number or is negative.

◆ zoom()

virtual void myscript::iink::Renderer::zoom ( float  factor)
pure virtual

Increases zoom by a factor.

Parameters
factorthe zoom modification factor.
Exceptions
std::invalid_argumentwhen factor is not a number or is negative.

◆ zoomAt()

virtual void myscript::iink::Renderer::zoomAt ( graphics::Point  p,
float  factor 
)
pure virtual

Increases zoom by a factor around a given point.

Parameters
ppoint around which to adjust the view (view coordinates in pixel).
factorthe zoom modification factor.
Exceptions
std::invalid_argumentwhen factor is not a number or is negative.

◆ getViewOffset()

virtual graphics::Point myscript::iink::Renderer::getViewOffset ( ) const
pure virtualnoexcept

Returns the view offset.

Returns
the view offset (view coordinates in pixel).

◆ setViewOffset()

virtual void myscript::iink::Renderer::setViewOffset ( float  x,
float  y 
)
pure virtual

Sets the view offset.

Parameters
xthe x coordinate of the view offset (view coordinates in pixel).
ythe y coordinate of the view offset (view coordinates in pixel).
Exceptions
std::invalid_argumentwhen x is not a number.
std::invalid_argumentwhen y is not a number.

◆ getViewTransform()

virtual graphics::Transform myscript::iink::Renderer::getViewTransform ( ) const
pure virtualnoexcept

Returns the transform that maps model coordinates to view coordinates.

Returns
the view transform.

◆ getRenderTarget()

virtual std::shared_ptr< IRenderTarget > myscript::iink::Renderer::getRenderTarget ( ) const
pure virtualnoexcept

Returns the target that receives display update requests from this renderer.

Returns
the render target.

◆ registerStroker()

virtual void myscript::iink::Renderer::registerStroker ( String  name,
std::shared_ptr< graphics::IStrokerFactory >  factory 
)
pure virtual

Registers a custom stroker factory.

Parameters
namethe value of the -myscript-pen-brush css property that selects this stroker.
factorythe user provided stroker factory.
Exceptions
std::invalid_argumentwhen factory is nullptr.

◆ unregisterStroker()

virtual void myscript::iink::Renderer::unregisterStroker ( String  name)
pure virtualnoexcept

Unregister custom stroker factory.

Parameters
namethe stroker factory.

◆ drawModelAsync()

virtual uint64_t myscript::iink::Renderer::drawModelAsync ( int  x,
int  y,
int  width,
int  height,
graphics::ICanvas *  canvas 
)
pure virtual

Requests asynchronous drawing of a region of the Model layer. Completion of the drawing operation must be indicated by a call to commitModelDraw().

Parameters
xtop left x coordinate of the region to draw (view coordinates in pixel).
ytop left y coordinate of the region to draw (view coordinates in pixel).
widthwidth of the region to draw (view coordinates in pixel).
heightheight of the region to draw (view coordinates in pixel).
canvastarget canvas.
Returns
the identifier of the drawing request.
Exceptions
std::invalid_argumentwhen canvas is nullptr.

◆ commitModelDraw()

virtual void myscript::iink::Renderer::commitModelDraw ( uint64_t  id)
pure virtual

Indicates that an asynchronous drawing of the Model Layer is over.

Parameters
idthe identifier of the drawing request, as returned by drawModelAsync().

◆ drawModel()

virtual void myscript::iink::Renderer::drawModel ( int  x,
int  y,
int  width,
int  height,
graphics::ICanvas *  canvas 
)
pure virtual

Requests drawing of a region of the Model layer.

Parameters
xtop left x coordinate of the region to draw (view coordinates in pixel).
ytop left y coordinate of the region to draw (view coordinates in pixel).
widthwidth of the region to draw (view coordinates in pixel).
heightheight of the region to draw (view coordinates in pixel).
canvastarget canvas.
Exceptions
std::invalid_argumentwhen canvas is nullptr.

◆ drawCaptureStrokes()

virtual void myscript::iink::Renderer::drawCaptureStrokes ( int  x,
int  y,
int  width,
int  height,
graphics::ICanvas *  canvas 
)
pure virtual

Requests drawing of a region of the Capture layer.

Parameters
xtop left x coordinate of the region to draw (view coordinates in pixel).
ytop left y coordinate of the region to draw (view coordinates in pixel).
widthwidth of the region to draw (view coordinates in pixel).
heightheight of the region to draw (view coordinates in pixel).
canvastarget canvas.
Exceptions
std::invalid_argumentwhen canvas is nullptr.

The documentation for this class was generated from the following file: