<bdo id='8911f'></bdo><ul id='8911f'></ul>

        <small id='8911f'></small><noframes id='8911f'>

        <legend id='8911f'><style id='8911f'><dir id='8911f'><q id='8911f'></q></dir></style></legend>
      1. <tfoot id='8911f'></tfoot>
        <i id='8911f'><tr id='8911f'><dt id='8911f'><q id='8911f'><span id='8911f'><b id='8911f'><form id='8911f'><ins id='8911f'></ins><ul id='8911f'></ul><sub id='8911f'></sub></form><legend id='8911f'></legend><bdo id='8911f'><pre id='8911f'><center id='8911f'></center></pre></bdo></b><th id='8911f'></th></span></q></dt></tr></i><div id='8911f'><tfoot id='8911f'></tfoot><dl id='8911f'><fieldset id='8911f'></fieldset></dl></div>
      2. 画布绘制图像缩放

        Canvas drawImage scaling(画布绘制图像缩放)

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

              <bdo id='nsUQW'></bdo><ul id='nsUQW'></ul>
            • <legend id='nsUQW'><style id='nsUQW'><dir id='nsUQW'><q id='nsUQW'></q></dir></style></legend>
                <tfoot id='nsUQW'></tfoot>

                    <tbody id='nsUQW'></tbody>

                1. <small id='nsUQW'></small><noframes id='nsUQW'>

                2. 本文介绍了画布绘制图像缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试按比例缩放图像到画布.我可以用固定的宽度和高度来缩放它:

                  I'm trying to scale an image proportionately to the canvas. I'm able to scale it with fixed width and height as so:

                  context.drawImage(imageObj, 0, 0, 100, 100)
                  

                  但我只想调整宽度并按比例调整高度.类似于以下内容:

                  But I only want to resize the width and have the height resize proportionately. Something like the following:

                  context.drawImage(imageObj, 0, 0, 100, auto)
                  

                  我到处寻找我能想到的地方,但还没有看到这是否可能.

                  I've looked everywhere I can think of and haven't seen if this is possible.

                  推荐答案

                  context.drawImage(imageObj, 0, 0, 100, 100 * imageObj.height / imageObj.width)
                  

                  这篇关于画布绘制图像缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How does object-fit work with canvas element?(对象适合如何与画布元素一起使用?)
                  How to make rooftext effect and valley text effect in HTML5 (or Fabric.js)(如何在 HTML5(或 Fabric.js)中制作屋顶文字效果和山谷文字效果)
                  Draw border around nontransparent part of image on canvas(在画布上的图像不透明部分周围绘制边框)
                  dragging and resizing an image on html5 canvas(在 html5 画布上拖动图像并调整其大小)
                  What#39;s the difference between a boolean as primitive and a boolean as property of an object?(作为原始对象的布尔值和作为对象属性的布尔值有什么区别?)
                  I want to do animation of an object along a particular path(我想沿特定路径对对象进行动画处理)

                    • <bdo id='nm53F'></bdo><ul id='nm53F'></ul>

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

                            <tbody id='nm53F'></tbody>

                          <i id='nm53F'><tr id='nm53F'><dt id='nm53F'><q id='nm53F'><span id='nm53F'><b id='nm53F'><form id='nm53F'><ins id='nm53F'></ins><ul id='nm53F'></ul><sub id='nm53F'></sub></form><legend id='nm53F'></legend><bdo id='nm53F'><pre id='nm53F'><center id='nm53F'></center></pre></bdo></b><th id='nm53F'></th></span></q></dt></tr></i><div id='nm53F'><tfoot id='nm53F'></tfoot><dl id='nm53F'><fieldset id='nm53F'></fieldset></dl></div>
                            <legend id='nm53F'><style id='nm53F'><dir id='nm53F'><q id='nm53F'></q></dir></style></legend>
                            <tfoot id='nm53F'></tfoot>