HTML::O...:Canvas(3)

πŸ“¦ version 0.6.0, in alpine 3.24

🌸 NAME 🌸

okay so this is the User Contributed Perl Documentation page for HTML::Object::DOM::Element::Canvas β€” the header squishes that whole thing down to HTML::O...:Canvas(3), which is giving β€œwe ran out of room bestie” 😭. It’s the HTML Object DOM Canvas Class, and yes, we’re doing this together 🫢.

πŸŽ€ SYNOPSIS πŸŽ€

The β€œmake it exist or die trying” starter pack is literally:

use HTML::Object::DOM::Element::Canvas;
my $canvas = HTML::Object::DOM::Element::Canvas->new ||
    die( HTML::Object::DOM::Element::Canvas->error, "\n" );

✨ VERSION ✨

Current version: v0.2.0, periodt ✨.

πŸ¦‹ DESCRIPTION πŸ¦‹

This interface provides properties and methods that are used for the "<canvas"> element. But β€” major plot twist β€” since this is a perl framework, there is no such capability, and it is provided here only to implement the properties and methods as accessors. So it’s accessor city, not actual canvas-painting magic 🎨.

This interface also inherits the properties and methods of the HTML::Object::Element interface. Family business, iykyk.

πŸ‘‘ INHERITANCE πŸ‘‘

The whole bloodline is a long chain, no cap, and it goes exactly like this:

+-----------------------+     +---------------------------+     +-------------------------+     +----------------------------+     +------------------------------------+
| HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::Canvas |
+-----------------------+     +---------------------------+     +-------------------------+     +----------------------------+     +------------------------------------+

πŸ“ PROPERTIES πŸ“

Inherits properties from its parent HTML::Object::DOM::Element.

The description provided here is from Mozilla documentation. Credit to Mozilla, always 🫢.

πŸ“ height πŸ“

The height HTML attribute of the "<canvas"> element is a positive integer reflecting the number of logical pixels (or RGBA values) going down one column of the canvas. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used. If no [separate] CSS height is assigned to the "<canvas">, then this value will also be used as the height of the canvas in the length-unit CSS Pixel.

Example:

<canvas id="canvas" width="300" height="300"></canvas>

my $canvas = $doc->getElementById('$canvas');
say( $canvas->height ); # 300

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/height

πŸ“ mozOpaque πŸ“

Is a boolean value reflecting the moz-opaque HTML attribute of the <canvas> element. It lets the canvas know whether or not translucency will be a factor. If the canvas knows there’s no translucency, painting performance can be optimized. This is only supported in Mozilla-based browsers; use the standardized canvas.getContext('2d', { alpha: false }) instead.

Example:

<canvas id="canvas" width="300" height="300" moz-opaque></canvas>

my $canvas = $doc->getElementById('$canvas');
say( $canvas->mozOpaque ); # true
# deactivate it
$canvas->mozOpaque = 0;

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/mozOpaque

πŸ“ mozPrintCallback πŸ“

Is a function that is initially "undef". Web content can set this to a JavaScript function that will be called when the canvas is to be redrawn while the page is being printed. When called, the callback is passed a "printState" object that implements the "MozCanvasPrintState" interface. The callback can get the context to draw to from the "printState" object and must then call done() on it when finished. The purpose of "mozPrintCallback" is to obtain a higher resolution rendering of the canvas at the resolution of the printer being used. See this blog post: https://blog.mozilla.org/labs/2012/09/a-new-way-to-control-printing-output/.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/mozPrintCallback

πŸ“ width πŸ“

The width HTML attribute of the <canvas> element is a positive integer reflecting the number of logical pixels (or RGBA values) going across one row of the canvas. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used. If no [separate] CSS width is assigned to the <canvas>, then this value will also be used as the width of the canvas in the length-unit CSS Pixel.

Example:

<canvas id="canvas" width="300" height="300"></canvas>

my $canvas = $doc->getElementById('$canvas');
say( $canvas->width ); # 300

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/width

πŸ’… METHODS πŸ’…

Inherits methods from its parent HTML::Object::DOM::Element.

Keep in mind that none of those methods do anything and they all return "undef". The description provided here is from Mozilla documentation. So yes, it’s giving all vibes, no implementation πŸ’€.

πŸ’… captureStream πŸ’…

Returns "undef" since this feature is unavailable under perl.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/captureStream

πŸ’… getContext πŸ’…

Returns "undef" since this feature is unavailable under perl.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext

πŸ’… toBlob πŸ’…

Returns "undef" since this feature is unavailable under perl.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob

πŸ’… toDataURL πŸ’…

Returns "undef" since this feature is unavailable under perl.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL

πŸ’… transferControlToOffscreen πŸ’…

Returns "undef" since this feature is unavailable under perl.

See also Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen

πŸ’– AUTHOR πŸ’–

Jacques Deguest <jack@deguest.jp> β€” iconic.

🌈 SEE ALSO 🌈

Copyright(c) 2021 DEGUEST Pte. Ltd.

All rights reserved

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Footer energy, since we’re wrapping up: perl v5.42.2 Β· 2026-02-15 Β· HTML::O...:Canvas(3) β€” byeeee, bestie πŸ«Άβœ¨πŸ’…

πŸ“¦ where this page comes from