简体   繁体   中英

Crop image in HTML5

I am using below given fiddle to apply zoom in and zoom out on my canvas image, but when i zoom out my image it shows multiple images slices. This problem does not show in fiddle possibly because its image background is white. If any one knows how to solve this problem kindly give an idea about it. Thanks

It sounds like you forget to clear your canvas between each draw :

http://www.w3schools.com/tags/canvas_clearrect.asp

context.clearRect(0, 0, canvas.width, canvas.height);

请注意,对于clearRect,您需要具有未转换的上下文,或者需要跟踪您的实际边界。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM