How to use the canvas/imagedata/PutImageData.js function in canvas

To help you get started, we’ve selected a few canvas examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github photonstorm / lazer-dev / src / filter / filter01-flipHorizontal.js View on Github external
loadComplete (file) {

        //  Draw the image

        const ctx = GetContext(this.canvas);

        ctx.drawImage(file.data, 0, 0);

        const imageData = GetImageData(ctx);

        FlipHorizontal(imageData);

        ctx.clearRect(0, 0, 320, 200);

        PutImageData(ctx, imageData);

    }
github photonstorm / lazer-dev / src / filter / filter02-flipVertical.js View on Github external
loadComplete (file) {

        //  Draw the image

        const ctx = GetContext(this.canvas);

        ctx.drawImage(file.data, 0, 0);

        const imageData = GetImageData(ctx);

        FlipVertical(imageData);

        ctx.clearRect(0, 0, 320, 200);

        PutImageData(ctx, imageData);

    }
github photonstorm / lazer-dev / src / filter / filter05-meanRemoval.js View on Github external
loadComplete (file) {

        const ctx = GetContext(this.canvas);

        ctx.drawImage(file.data, 0, 0);

        const imageData = GetImageData(ctx, 0, 0, 256, 256);

        MeanRemoval(imageData);

        PutImageData(ctx, imageData, 256, 0);

    }
github photonstorm / lazer-dev / src / filter / filter08-emboss.js View on Github external
loadComplete (file) {

        const ctx = GetContext(this.canvas);

        ctx.drawImage(file.data, 0, 0);

        const imageData = GetImageData(ctx, 0, 0, 256, 256);

        Emboss(imageData);

        PutImageData(ctx, imageData, 256, 0);

    }
github photonstorm / lazer-dev / src / filter / filter03-distort.js View on Github external
loadComplete (file) {

        const ctx = GetContext(this.canvas);

        ctx.drawImage(file.data, 0, 0);

        const imageData = GetImageData(ctx, 0, 0, 256, 256);

        Distort(imageData, 0.5, 0.5);

        PutImageData(ctx, imageData, 256, 0);

    }
github photonstorm / lazer-dev / src / filter / filter09-embossSubtle.js View on Github external
loadComplete (file) {

        const ctx = GetContext(this.canvas);

        ctx.drawImage(file.data, 0, 0);

        const imageData = GetImageData(ctx, 0, 0, 256, 256);

        EmbossSubtle(imageData);

        PutImageData(ctx, imageData, 256, 0);

    }
github photonstorm / lazer-dev / src / filter / filter11-edgeDetectDark.js View on Github external
loadComplete (file) {

        const ctx = GetContext(this.canvas);

        ctx.drawImage(file.data, 0, 0);

        const imageData = GetImageData(ctx, 0, 0, 256, 256);

        EdgeDetectDark(imageData);

        PutImageData(ctx, imageData, 256, 0);

    }
github photonstorm / lazer-dev / src / filter / filter10-edgeDetect.js View on Github external
loadComplete (file) {

        const ctx = GetContext(this.canvas);

        ctx.drawImage(file.data, 0, 0);

        const imageData = GetImageData(ctx, 0, 0, 256, 256);

        EdgeDetect(imageData);

        PutImageData(ctx, imageData, 256, 0);

    }
github photonstorm / lazer / src / canvas / pixels / SetPixels.js View on Github external
export function write () {

    if (!this.imageData)
    {
        return;
    }

    return PutImageData(
        this.context, 
        this.imageData, 
        this.offset.x, 
        this.offset.y, 
        this.tl.x,
        this.tl.y,
        this.br.x - this.tl.x,
        this.br.y - this.tl.y
    );

}