如何在画布中获取此图像,然后将其发送到下一个表单 [英] how to get this image in canvas and next send it to next form

查看:64
本文介绍了如何在画布中获取此图像,然后将其发送到下一个表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <script type="text/javascript">
    function a () {
    var c = document.getElementById("myCanvas");
    var ctx = c.getContext("2d");
    var img = document.getElementById("Image1");
   ctx.drawImage(img, 20, 30,10,10);
   function copy() {
    var imgData = ctx.getImageData("img");
    ctx.putImageData(imgData, 10, 70);
 }
 </script>
</head>
<form id="form1" runat="server">
 <body onload =a()>
      <asp:Image ID="Image1" runat="server" ImageUrl="~/q.jpg" width="300px" Height="200px"/>
   <canvas id="myCanvas" style="border:1px solid #000000;"></canvas>
  <button onclick="copy()">Copy</button>
   </body>
  </form>
  </html>

推荐答案

您可以将图像添加到画布并从保存的图像中加载它。这是你的意思吗?
You can add an image to a canvas and load it from the image you saved. Is that what you mean ?


这篇关于如何在画布中获取此图像,然后将其发送到下一个表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆