tencent cloud

Feedback

Last updated: 2024-03-04 23:11:34

    Attributes

    Canvas Width: The breadth of the canvas.
    Canvas Height: The vertical extent of the canvas.

    Method Set

    cancelAnimationFrame

    The method is utilized as follows: Canvas.cancelAnimationFrame(number requestID)
    Function Description: Cancels the animation frame request scheduled by requestAnimationFrame. It is compatible with both 2D Canvas and WebGL Canvas, however, it does not support the concurrent use of 2D and WebGL methods.
    Parameters and Description: Number requestID.

    createImageData

    The method is utilized as follows: Image Canvas.createImage()
    Function Description: Creates an image object. It is compatible with both 2D Canvas and WebGL Canvas, however, it does not support the concurrent use of 2D and WebGL methods.
    Parameters and Description: Image.

    createImage

    The method is utilized as follows: ImageData Canvas.createImageData()
    Function Description: Creates an ImageData object. It is exclusively compatible with 2D Canvas.
    Parameters and Description: ImageData.

    createPathe2D

    The method is utilized as follows: Path2D Canvas.createPath2D(Path2D path)
    Function Description: Creates a Path2D object.
    Parameters and Description: Path2D path.
    Return Value: Path2D.

    getContext

    The method is utilized as follows: RenderingContext Canvas.getContext(string contextType)
    Function Description: This method returns the drawing context of the Canvas.
    Parameters and Description: string contextType, the context type.
    Value
    Note
    2d
    2D drawing context
    webgl
    WebGL drawing context
    webgl2
    WebGL2 drawing context
    Return Value:RenderingContext, facilitating the acquisition of 2D and WebGL drawing contexts.

    requestAnimationFrame

    The method is utilized as follows: number Canvas.requestAnimationFrame(function callback)
    Function Description: Executes upon the next redraw. Compatible with both 2D Canvas and WebGL Canvas, however, the methods of 2D and WebGL cannot be used interchangeably.
    Parameters and Description: function callback, the callback to be executed.
    Return Value: number, the request ID.

    toDataURL

    The method is employed as follows: string Canvas.toDataURL(string type, number encoderOptions)
    Function Description: Returns a data URI that displays the image. The type parameter can be used to specify its format, with PNG as the default.
    Parameters and Descriptions:
    string type: The image format, default is image/png.
    number encoderOptions: When the image format is specified as image/jpeg or image/webp, the image quality can be selected within the range of 0 to 1. If it exceeds the value range, the default value of 0.92 will be used. Other parameters will be disregarded.
    Return Value: string.
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support