jsjpeg.js
/**
 * Draw the component to the page, scaled up to the size of the image
 * 
 * @param {*} component 
 */
Draw the component to the page, scaled up to the size of the image

@param {*} component
Draw the component to the page scaled up to the size of the image @param { * } component
function drawComponentFullSize(component) {
    let id = component.componentID;
    let canvas = document.getElementById("component" + id + "ScaledCanvas");
    canvas.setAttribute("width", img.frame.outputX);
    canvas.setAttribute("height", img.frame.outputY);
    let ctx = canvas.getContext("2d");
    let imgData = ctx.createImageData(canvas.width, canvas.height);
    let data = imgData.data;
    let pixel = [0, 0, 0, 255];   
    for (let y = 0; y < img.frame.outputY; y++) {
        let srcLineStart = y * img.frame.outputX;
        for (let x = 0; x < img.frame.outputX; x++) {
            pixel[0] = pixel[1] = pixel[2] = component.outputBuff[srcLineStart + x];
            setPixel(data, img.frame.outputX, x, y, pixel);
        }
    }
    ctx.putImageData(imgData, 0, 0);
}
function drawComponentFullSize ( component ) { let id = component . componentID ; let canvas = document . getElementById ( "component" + id + "ScaledCanvas" ) ; canvas . setAttribute ( "width" , img . frame . outputX ) ; canvas . setAttribute ( "height" , img . frame . outputY ) ; let ctx = canvas . getContext ( "2d" ) ; let imgData = ctx . createImageData ( canvas . width , canvas . height ) ; let data = imgData . data ; let pixel = [ 0 , 0 , 0 , 255 ] ; for ( let y = 0 ; y < img . frame . outputY ; y ++ ) { let srcLineStart = y * img . frame . outputX ; for ( let x = 0 ; x < img . frame . outputX ; x ++ ) { pixel [ 0 ] = pixel [ 1 ] = pixel [ 2 ] = component . outputBuff [ srcLineStart + x ] ; setPixel ( data , img . frame . outputX , x , y , pixel ) ; } } ctx . putImageData ( imgData , 0 , 0 ) ; }
Draw the component to the page, scaled up to the size of the image
Draw the component to the page scaled up to the size of the image
// 255 for alpha channel