第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何使用canvas.toDataURL()將畫布保存為圖像?

如何使用canvas.toDataURL()將畫布保存為圖像?

慕村225694 2019-10-16 12:09:09
如何使用canvas.toDataURL()將畫布保存為圖像?我目前正在構(gòu)建一個HTML 5 web應(yīng)用程序/Phonegap本地應(yīng)用程序,我似乎不知道如何將我的畫布保存為canvas.toDataURL()..有人能幫幫我嗎?這是密碼,怎么了?/我的畫布被命名為“canvassionalation”JavaScript:function putImage(){   var canvas1 = document.getElementById("canvasSignature");           if (canvas1.getContext) {      var ctx = canvas1.getContext("2d");                      var myImage = canvas1.toDataURL("image/png");         }   var imageElement = document.getElementById("MyPix");     imageElement.src = myImage;                           }HTML 5:<div id="createPNGButton">     <button onclick="putImage()">Save as Image</button>        </div>
查看完整描述

3 回答

?
慕勒3428872

TA貢獻(xiàn)1848條經(jīng)驗 獲得超6個贊

這是一些代碼。沒有任何錯誤。

var image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); 
 // here is the most important part because if you dont replace you will get a DOM 18 exception.window.location.href=image;
  // it will save locally



查看完整回答
反對 回復(fù) 2019-10-17
  • 3 回答
  • 0 關(guān)注
  • 531 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號