Beispiel #1
0
export default function SetPixel (context, x, y, red = 0, green = 0, blue = 0, alpha = 255) {

    const imageData = GetImageData(context, x, y, 1, 1);

    if (SetPixelData(imageData, 0, 0, red, green, blue, alpha))
    {
        PutImageData(context, imageData, x, y);
    }

    return context;
    
}
    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);

    }
    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);

    }
Beispiel #4
0
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
    );

}