Image

Image handling.

var img = new Image();
var c = new Canvas(200, 200);
var ctx = c.getContext("2d");

document.canvas.add(c);

img.addEventListener("load", function() {
    ctx.drawImage(img, 0, 0);
});

img.addEventListener("error", function(ev) {
    console.log(ev.error);
});

img.src = "http://tests.nidium.com/http/image";

new Image()

Image loader.

height(readonly)

  • Type: Integer

Height of the image in pixels.

src

  • Type: String

Path to the image files.

width(readonly)

  • Type: Integer

Width of the image in pixels.

Event: error(event)

Event triggered when an error happen during the loading of the image.

Parameters:
event (Object)

Event object

error (String)

Description of the error

Event: load(event)

Event triggered when the image is loaded.

Parameters:
event (Object)

Event object


Caught a mistake or want to contribute to the documentation? Edit this page on GitHub!