“kanvas mengubah ukuran kanvas” Kode Jawaban

kanvas mengubah ukuran kanvas

(window.onresize = () => {
	canvas.width = innerWidth, canvas.height = innerHeight;
})();

// Condensed
(window.onresize=e=>{canvas.width=innerWidth,canvas.height=innerHeight})()
Pandata

JS mengubah resolusi kanvas

canvasElement.width = 1920;
canvasElement.height = 1080;
// note, canvasElement.style.width != canvasElement.width
// cE.style.width is the size of the canvas and cE.width is it's resolution
KhanKudo

kanvas mengubah ukuran kanvas

function imresize(org_img,w,h) {
    var img_new = document.createElement("canvas") // Create New image
    // Set New Size
    img_new.width  = w  
    img_new.height = h
    img_context = res.getContext("2d")
    img_context.drawImage(org_img, 0, 0, w, h)//Fill new picture using orginal img
    // use img_new 
    return img_new;
}
Atlantes Land

kanvas mengubah ukuran kanvas

var img_new = document.createElement("canvas") // Create New image
// Set New Size
img_new.width = 224  
img_new.height = 224

img_context = res.getContext("2d")
img_context.drawImage(orginal_image, 0, 0, 224, 224)//Fill new picture using orginal img
// chick img_new if True
// like that (base64)
console.log(img_new.toDataURL())
Atlantes Land

Jawaban yang mirip dengan “kanvas mengubah ukuran kanvas”

Pertanyaan yang mirip dengan “kanvas mengubah ukuran kanvas”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya