久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <small id='MRlnv'></small><noframes id='MRlnv'>

    <tfoot id='MRlnv'></tfoot>
    <legend id='MRlnv'><style id='MRlnv'><dir id='MRlnv'><q id='MRlnv'></q></dir></style></legend>

    1. <i id='MRlnv'><tr id='MRlnv'><dt id='MRlnv'><q id='MRlnv'><span id='MRlnv'><b id='MRlnv'><form id='MRlnv'><ins id='MRlnv'></ins><ul id='MRlnv'></ul><sub id='MRlnv'></sub></form><legend id='MRlnv'></legend><bdo id='MRlnv'><pre id='MRlnv'><center id='MRlnv'></center></pre></bdo></b><th id='MRlnv'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='MRlnv'><tfoot id='MRlnv'></tfoot><dl id='MRlnv'><fieldset id='MRlnv'></fieldset></dl></div>

        <bdo id='MRlnv'></bdo><ul id='MRlnv'></ul>

      如何旋轉 HTML5 畫布的現有內容?

      How to rotate the existing content of HTML5 canvas?(如何旋轉 HTML5 畫布的現有內容?)

        <small id='P2B0O'></small><noframes id='P2B0O'>

            <tbody id='P2B0O'></tbody>
              <bdo id='P2B0O'></bdo><ul id='P2B0O'></ul>

              1. <legend id='P2B0O'><style id='P2B0O'><dir id='P2B0O'><q id='P2B0O'></q></dir></style></legend>
              2. <tfoot id='P2B0O'></tfoot>
              3. <i id='P2B0O'><tr id='P2B0O'><dt id='P2B0O'><q id='P2B0O'><span id='P2B0O'><b id='P2B0O'><form id='P2B0O'><ins id='P2B0O'></ins><ul id='P2B0O'></ul><sub id='P2B0O'></sub></form><legend id='P2B0O'></legend><bdo id='P2B0O'><pre id='P2B0O'><center id='P2B0O'></center></pre></bdo></b><th id='P2B0O'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='P2B0O'><tfoot id='P2B0O'></tfoot><dl id='P2B0O'><fieldset id='P2B0O'></fieldset></dl></div>
                本文介紹了如何旋轉 HTML5 畫布的現有內容?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                有沒有辦法通過 Javascript 來旋轉 HTML5 畫布的現有內容?我知道可以旋轉將要繪制到畫布上的圖像,但我想旋轉已繪制到畫布上的內容,例如 400x400 畫布的 200x200 角,或現有畫布的任何特定區域.

                Is there a way to rotate the existing content of HTML5 canvas by Javascript? I know it's possible to rotate an image that will be drawn on to canvas, but I want to rotate the content that has been drawn on to canvas, for example, a 200x200 corner of a 400x400 canvas, or any specific region of an existing canvas.

                縮放現有畫布內容的相同問題...

                Same question to scale the existing canvas content...

                我知道 getImageData/putImageData 提供了轉換像素數組的潛力,但它太慢且效率低下.

                I know getImageData/putImageData provide a potential to transform the pixel array, but it's just too slow and inefficient.

                推薦答案

                使用臨時畫布非常容易.

                It's pretty easy to do with a temp canvas.

                現場演示

                現場演示動畫(只是為了見鬼)

                Live Demo Animated (just for the heck of it)

                上面的例子畫了 2 個盒子,然后在 0,0 到 200,200 之間旋轉和縮放

                The above example draws 2 boxes, then rotates and scales from 0,0 to 200,200

                var canvas = document.getElementById("canvas"),
                    ctx = canvas.getContext("2d");
                
                canvas.width = canvas.height = 400;
                
                // fill the canvas black, and draw 2 boxes
                ctx.fillStyle = "#000";
                ctx.fillRect(0,0,400,400);
                ctx.fillStyle = "rgb(255,0,0)";
                
                ctx.fillRect(10,10,190,190);
                ctx.fillStyle = "rgb(255,255,0)";
                ctx.fillRect(250,250,90,90);
                
                // Create a temp canvas to store our data (because we need to clear the other box after rotation.
                var tempCanvas = document.createElement("canvas"),
                    tempCtx = tempCanvas.getContext("2d");
                
                tempCanvas.width = canvas.width;
                tempCanvas.height = canvas.height;
                // put our data onto the temp canvas
                tempCtx.drawImage(canvas,0,0,canvas.width,canvas.height);
                
                // Append for debugging purposes, just to show what the canvas did look like before the transforms.
                document.body.appendChild(tempCanvas);
                
                // Now clear the portion to rotate.
                ctx.fillStyle = "#000";
                ctx.fillRect(0,0,200,200);
                ctx.save();
                // Translate (190/2 is half of the box we drew)
                ctx.translate(190/2, 0);
                // Scale
                ctx.scale(0.5,0.5);  
                // Rotate it
                ctx.rotate(45*Math.PI/180);
                // Finally draw the image data from the temp canvas.
                ctx.drawImage(tempCanvas,0,0,200,200,10,10,190,190);
                ctx.restore();
                

                這篇關于如何旋轉 HTML5 畫布的現有內容?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                Restrictions of XMLHttpRequest#39;s getResponseHeader()?(XMLHttpRequest 的 getResponseHeader() 的限制?)
                <i id='ocQ1N'><tr id='ocQ1N'><dt id='ocQ1N'><q id='ocQ1N'><span id='ocQ1N'><b id='ocQ1N'><form id='ocQ1N'><ins id='ocQ1N'></ins><ul id='ocQ1N'></ul><sub id='ocQ1N'></sub></form><legend id='ocQ1N'></legend><bdo id='ocQ1N'><pre id='ocQ1N'><center id='ocQ1N'></center></pre></bdo></b><th id='ocQ1N'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ocQ1N'><tfoot id='ocQ1N'></tfoot><dl id='ocQ1N'><fieldset id='ocQ1N'></fieldset></dl></div>
                <legend id='ocQ1N'><style id='ocQ1N'><dir id='ocQ1N'><q id='ocQ1N'></q></dir></style></legend>

                <tfoot id='ocQ1N'></tfoot>
                  <tbody id='ocQ1N'></tbody>
                  <bdo id='ocQ1N'></bdo><ul id='ocQ1N'></ul>

                          <small id='ocQ1N'></small><noframes id='ocQ1N'>

                          主站蜘蛛池模板: 四虎在线视频 | 国产激情片在线观看 | 中文福利视频 | 久久一二区 | 久久逼逼 | 欧洲精品码一区二区三区免费看 | 国产精品久久久久久婷婷天堂 | 成人国产精品久久 | 亚洲国产精品第一区二区 | 91av视频在线播放 | 精品国产一区二区三区久久久蜜月 | 97国产精品 | 九色 在线 | 无码国模国产在线观看 | 欧美日韩高清 | 久久机热| 九九一级片 | 成人国产免费观看 | 黄色大片毛片 | 91亚洲国产成人久久精品网站 | 国产一区二区三区在线看 | 精品国产一区二区三区久久狼黑人 | 精品无码久久久久国产 | 国产精品欧美一区二区 | 熟女毛片 | 日本超碰 | 看片wwwwwwwwwww| 中文字幕视频在线观看 | 亚洲精品中文字幕中文字幕 | 麻豆视频国产在线观看 | 亚洲一区二区视频在线播放 | 日韩精品一区二区三区视频播放 | 婷婷激情综合 | 免费观看一级特黄欧美大片 | 午夜成人在线视频 | 综合久久av | 91精品国产高清一区二区三区 | 99精品国产一区二区三区 | 日韩一区二区三区四区五区六区 | 精品一级毛片 | 国产精品视频在线免费观看 |