HTML အကိုးအကား

အက္ခရာဖြင့် HTML HTML အမျိုးအစားအလိုက် HTML Browser ပံ့ပိုးမှု HTML အရည်အချင်းများ HTML ကမ္ဘာလုံးဆိုင်ရာ အရည်အချင်းများ HTML ပွဲများ HTML အရောင်များ HTML Canvas HTML အသံ/ဗီဒီယို HTML အက္ခရာအစုံများ HTML Doctypes HTML URL ကုဒ် HTML ဘာသာစကားကုဒ်များ HTML နိုင်ငံကုဒ်များ HTTP မက်ဆေ့ခ်ျများ HTTP နည်းလမ်းများ PX မှ EM Converter ကီးဘုတ်ဖြတ်လမ်းများ


HTML canvas putImageData() နည်းလမ်း

❮ HTML Canvas အကိုးအကား

ဥပမာ

အောက်ပါကုဒ်သည် getImageData() ဖြင့် ကင်းဗတ်ပေါ်တွင် သတ်မှတ်ထားသော ထောင့်မှန်စတုဂံတစ်ခုအတွက် pixel ဒေတာကို မိတ္တူကူးပြီး ပုံဒေတာကို putImageData() ဖြင့် ကင်းဗတ်ပေါ်သို့ ပြန်တင်ပါ။

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.fillStyle = "red";
ctx.fillRect(10, 10, 50, 50);

function copy() {
  var imgData = ctx.getImageData(10, 10, 50, 50);
  ctx.putImageData(imgData, 10, 70);
}

Browser ပံ့ပိုးမှု

ဇယားရှိ နံပါတ်များသည် နည်းလမ်းကို အပြည့်အဝထောက်ခံသည့် ပထမဆုံးဘရောက်ဆာဗားရှင်းကို သတ်မှတ်ပေးသည်။

Method
putImageData() Yes 9.0 Yes Yes Yes

အဓိပ္ပါယ်နှင့် အသုံးပြုမှု

putImageData() နည်းလမ်းသည် ပုံဒေတာ (သတ်မှတ်ထားသော ImageData အရာဝတ္ထုမှ) ကို ကင်းဗတ်စ်ပေါ်သို့ ပြန်တင်သည်။

အကြံပြုချက်- ကင်းဗတ်စ်ပေါ်တွင် သတ်မှတ်ထားသော စတုဂံတစ်ခုအတွက် pixel ဒေတာကို ကူးယူသည့် getImageData() နည်းလမ်း အကြောင်း ဖတ်ပါ ။

အကြံပြုချက်- အလွတ် ImageData အရာဝတ္ထုအသစ်ကို ဖန်တီးသည့် createImageData () နည်းလမ်း အကြောင်း ဖတ်ပါ ။


JavaScript Syntax

JavaScript syntax- ဆက်စပ်အကြောင်းအရာ .putImageData( imgData၊x၊y ၊ dirtyX၊dirtyY၊dirtyWidth၊dirtyHeight );

ကန့်သတ်တန်ဖိုးများ

Parameter Description
imgData Specifies the ImageData object to put back onto the canvas
x The x-coordinate, in pixels, of the upper-left corner of the ImageData object
y The y-coordinate, in pixels, of the upper-left corner of the ImageData object
dirtyX Optional. The horizontal (x) value, in pixels, where to place the image on the canvas
dirtyY Optional. The vertical (y) value, in pixels, where to place the image on the canvas
dirtyWidth Optional. The width to use to draw the image on the canvas
dirtyHeight Optional. The height to use to draw the image on the canvas

❮ HTML Canvas အကိုးအကား