Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use drawImage in HTML5

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article is a detailed introduction to "how to use drawImage in HTML5". The content is detailed, the steps are clear, and the details are properly handled. I hope this article "how to use drawImage in HTML5" can help you solve your doubts. Let's go deeper and learn new knowledge together with the ideas of Xiaobian.

The code is as follows:

$(function() { var jsCanv = document.getElementById("canv"); var oCanv = jsCanv.getContext("2d"); var img = new Image(); img.src = "img.png"; oCanv.drawImage(img, 220, 30); })

browser does not support

In fact, this writing is wrong, in fact, as long as a refresh image is not displayed. To ensure that the display refreshes properly, you need to redraw it once during Image onload. This is a test of what happens in chrome 19.

solutions

The code is as follows:

$(function() { var jsCanv = document.getElementById("canv"); var oCanv = jsCanv.getContext("2d"); var img = new Image(); img.src = "img.png"; img.onload = function() { oCanv.drawImage(img, 220, 30); } }) browser does not support Read here, this article "how to use drawImage in HTML5" article has been introduced, want to master the knowledge of this article also need to practice before you can understand, if you want to know more related content of the article, welcome to pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report