Skip to main content

alphaTab.rendering.IScoreRenderer

Represents the public interface of the component that can render scores.

 interface IScoreRenderer

Properties​

boundsLookup​

Gets or sets the lookup which allows fast access to beats at a given position.

readonly boundsLookup: BoundsLookup | null;

error​

This event is fired when an error within alphatab occurred. This event is fired when an error within alphatab occurred. Use this event as global error handler to show errors to end-users. Due to the asynchronous nature of alphaTab, no call to the API will directly throw an error if it fails. Instead a signal to this error handlers will be sent.

readonly error: IEventEmitterOfT<Error>;

width​

The width of the rendered score. For layouts that grow from top to bottom (like page), it is required to specify a width for the renderer. The renderer will fit then the bars into this area for rendering. The alphaTab API object uses a link to the graphical user interface via a IUiFacade to get the available width for rendering. When using the low-level APIs this width must be specified manually.

For layouts that grow from left to right the width and height are usually calculated automatically based on the contents.

width: number;

Methods​

destroy​

Destroys the renderer and all related components. This method destroys the full renderer and by this closes all potentially opened contexts and shuts down any worker.

If you dynamically create/destroy renderers it is recommended to always call this method to ensure all resources are leaked.

destroy(): void

render​

Initiates a re-rendering of the current setup.

render(renderHints?: RenderHints): void
ParameterSummary
renderHintsAll

Additional hints to respect during layouting and rendering.

renderResult​

Requests the rendering of a chunk which was layed out before. This method initiates the rendering of a layed out chunk advertised through partialLayoutFinished

renderResult(resultId: string): void
ParameterSummary
resultIdAll

the result ID as provided by the partialLayoutFinished event.

renderScore​

Initiates the rendering of the specified tracks of the given score.

renderScore(score: Score | null, trackIndexes: number[] | null, renderHints?: RenderHints): void
ParameterSummary
scoreAll

The score defining the tracks.

trackIndexesAll

The indexes of the tracks to draw.

renderHintsAll

Additional hints to respect during layouting and rendering.

resizeRender​

Initiates a resize-optimized re-rendering of the score using the current settings. This method can be used if only re-fitting of the score into a new width should be done. alphaTab internally keeps all the information about the music notation elements like where they are placed and how they are connected. This is a rather expensive operation but it is only required to be done once.

In case the UI is resized, this method can be used to trigger a rearrangement of the existing elements into the newly available space.

resizeRender(): void

updateSettings​

Updates the settings to the given object. This method updates the settings to the given object. On some platforms like JavaScript the settings object will need to be passed on to the corresponding worker to be really updated. It is recommended to make this call after updating any properties of the settings object to ensure it is really passed on to all components.

This method will not trigger automatically any re-rendering.

updateSettings(settings: Settings): void
ParameterSummary
settingsAll

(no description)

Events​

partialLayoutFinished​

Occurs whenever a part of the whole music sheet is layed out but not yet rendered. AlphaTab does not render the whole music sheet into a single canvas but rather splits it down into smaller chunks. This allows faster display of results to the user and avoids issues related to browser restrictions (like maximum canvas sizes).

This event is fired whenever one chunk of the music sheet was fully layed out.

Occurs whenever a part of the whole music sheet is layed out but not yet rendered. AlphaTab does not render the whole music sheet into a single canvas but rather splits it down into smaller chunks. This allows faster display of results to the user and avoids issues related to browser restrictions (like maximum canvas sizes).

This event is fired whenever one chunk of the music sheet was fully layed out.

readonly partialLayoutFinished: IEventEmitterOfT<RenderFinishedEventArgs>;

partialRenderFinished​

Occurs whenever a part of the whole music sheet is rendered and can be displayed. AlphaTab does not render the whole music sheet into a single canvas but rather splits it down into smaller chunks. This allows faster display of results to the user and avoids issues related to browser restrictions (like maximum canvas sizes).

This event is fired whenever one chunk of the music sheet is fully rendered.

since 1.2.3 the rendering of a chunk needs to be requested via the renderResult method after a chunk was advertised through the partialLayoutFinished .

Occurs whenever a part of the whole music sheet is rendered and can be displayed. AlphaTab does not render the whole music sheet into a single canvas but rather splits it down into smaller chunks. This allows faster display of results to the user and avoids issues related to browser restrictions (like maximum canvas sizes).

This event is fired whenever one chunk of the music sheet is fully rendered.

since 1.2.3 the rendering of a chunk needs to be requested via the renderResult method after a chunk was advertised through the partialLayoutFinished .

readonly partialRenderFinished: IEventEmitterOfT<RenderFinishedEventArgs>;

postRenderFinished​

This event is fired when the rendering of the whole music sheet is finished, and all handlers of renderFinished ran. This event is fired when the rendering of the whole music sheet is finished, and all handlers of renderFinished ran. When this handlers are called, the whole rendering and display pipeline is completed.

This event is fired when the rendering of the whole music sheet is finished, and all handlers of renderFinished ran. This event is fired when the rendering of the whole music sheet is finished, and all handlers of renderFinished ran. When this handlers are called, the whole rendering and display pipeline is completed.

readonly postRenderFinished: IEventEmitter;

preRender​

Occurs before the rendering of the tracks starts This event is fired when the rendering of the whole music sheet is starting. All preparations are completed and the layout and render sequence is about to start.

The provided boolean indicates the rendering is triggered from a resize

Occurs before the rendering of the tracks starts This event is fired when the rendering of the whole music sheet is starting. All preparations are completed and the layout and render sequence is about to start.

The provided boolean indicates the rendering is triggered from a resize

readonly preRender: IEventEmitterOfT<boolean>;

renderFinished​

This event is fired when the rendering of the whole music sheet is finished. This event is fired when the rendering of the whole music sheet is finished from the render engine side. There might be still tasks open for the display component to visually display the rendered components when this event is notified.

This event is fired when the rendering of the whole music sheet is finished. This event is fired when the rendering of the whole music sheet is finished from the render engine side. There might be still tasks open for the display component to visually display the rendered components when this event is notified.