Table of Contents

Interface IHtmlCanvasElement

Namespace
AngleSharp.Html.Dom
Assembly
AngleSharp.dll

Represents the canvas HTML element.

[DomName("HTMLCanvasElement")]
public interface IHtmlCanvasElement : IHtmlElement, IElement, INode, IEventTarget, IMarkupFormattable, IParentNode, IChildNode, INonDocumentTypeChildNode, IGlobalEventHandlers
Inherited Members
Extension Methods

Properties

Height

Gets or sets the pixel height of the canvas element.

[DomName("height")]
int Height { get; set; }

Property Value

int

Width

Gets or sets the pixel width of the canvas element.

[DomName("width")]
int Width { get; set; }

Property Value

int

Methods

GetContext(string)

Gets the drawing context.

[DomName("getContext")]
IRenderingContext GetContext(string contextId)

Parameters

contextId string

A context id like 2d.

Returns

IRenderingContext

An object that defines the drawing context.

IsSupportingContext(string)

Gets an indicator if a context with the given parameters could be created.

[DomName("probablySupportsContext")]
bool IsSupportingContext(string contextId)

Parameters

contextId string

A context id like 2d.

Returns

bool

True if the context is supported, otherwise false.

SetContext(IRenderingContext)

Changes the context the element is related to the given one.

[DomName("setContext")]
void SetContext(IRenderingContext context)

Parameters

context IRenderingContext

The new context.

ToBlob(Action<Stream>, string?)

Creates a BLOB out of the canvas pixel data and passes it to the given callback.

[DomName("toBlob")]
void ToBlob(Action<Stream> callback, string? type = null)

Parameters

callback Action<Stream>

The callback function.

type string

The type of object to create.

ToDataUrl(string?)

Returns a Data URI with the bitmap data of the context.

[DomName("toDataURL")]
string ToDataUrl(string? type = null)

Parameters

type string

The type of image e.g image/png.

Returns

string

A data URI with the data if any.