校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > html5 更新圖片顏色示例代碼

html5 更新圖片顏色示例代碼

熱門標(biāo)簽:申請400電話流程簡介 阜陽企業(yè)外呼系統(tǒng) 外呼線穩(wěn)定線路 地圖標(biāo)注位置能賺錢嗎 外呼系統(tǒng)電話怎么投訴 呼和浩特外呼電銷系統(tǒng)排名 pageadm實(shí)現(xiàn)地圖標(biāo)注 南通數(shù)據(jù)外呼系統(tǒng)推廣 邢臺縣地圖標(biāo)注app

復(fù)制代碼
代碼如下:

<canvas id="c1" width="1220" height = "880" style="background: none repeat scroll 0% 0% transparent; "></canvas>
<script>
var cID = "c1";
var image = new Image();
image.src = "Eye/item_eye_1.png";
image.onload = function () {
recolorImage(cID,image, 0, 0, 0, 255, 0, 0);
}
function recolorImage(c,img, oldRed, oldGreen, oldBlue, newRed, newGreen, newBlue) {
var c = document.getElementById(c);
var ctx = c.getContext("2d");
var w = img.width;
var h = img.height;
c.width = w;
c.height = h;
// draw the image on the temporary canvas
ctx.drawImage(img, 0, 0, w, h);
// pull the entire image into an array of pixel data
var imageData = ctx.getImageData(0, 0, w, h);
// examine every pixel,
// change any old rgb to the new-rgb
for (var i = 0; i < imageData.data.length; i += 4) {
// is this pixel the old rgb?
if (imageData.data[i] == oldRed && imageData.data[i + 1] == oldGreen && imageData.data[i + 2] == oldBlue) {
// change to your new rgb
imageData.data[i] = newRed;
imageData.data[i + 1] = newGreen;
imageData.data[i + 2] = newBlue;
}
}
// put the altered data back on the canvas
ctx.putImageData(imageData, 0, 0);
}
</script>

標(biāo)簽:蚌埠 德州 鶴崗 撫順 楊凌 黃山 內(nèi)蒙古 辛集

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《html5 更新圖片顏色示例代碼》,本文關(guān)鍵詞  html5,更新,圖片,顏色,示例,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《html5 更新圖片顏色示例代碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于html5 更新圖片顏色示例代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 行唐县| 正阳县| 库尔勒市| 高淳县| 抚顺市| 横峰县| 巨鹿县| 丰台区| 宁德市| 黑龙江省| 平山县| 鹰潭市| 宁海县| 定兴县| 察雅县| 云阳县| 葵青区| 江门市| 广宗县| 阜南县| 应用必备| 鸡东县| 都匀市| 梅州市| 岳普湖县| 涿鹿县| 东乡族自治县| 和龙市| 祁门县| 盘锦市| 贵阳市| 苍山县| 清河县| 祁阳县| 木里| 古交市| 温宿县| 黄浦区| 海口市| 凤凰县| 汤阴县|