2
我無法找到線索如何將圖像複製到剪貼板。 我的代碼如下所示:xul/xpcom將圖像從字符串複製到剪貼板
var image = "data:image/png;base64,..."
var io = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var channel = io.newChannel(image, null, null);
var input = channel.open();
var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
trans.addDataFlavor("image/png");
trans.setTransferData("image/png", input, input.available());
var clipid = Components.interfaces.nsIClipboard;
var clip = Components.classes["@mozilla.org/widget/clipboard;1"].getService(clipid);
clip.setData(trans, null, clipid.kGlobalClipboard);
你從哪裏得到(base64編碼)的圖像數據? – Neil 2011-06-19 23:46:10
canvas.toDataURL – nweb 2011-06-23 11:00:05