用Canvas对象中的Background图像填充fillRect [英] fillRect with Background image in Canvas object

查看:372
本文介绍了用Canvas对象中的Background图像填充fillRect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Canvas对象FillRect方法可以将背景图像放置在矩形上

using Canvas object FillRect method is it possible to put background image on rectangle

推荐答案

您可以使用模式

示例:

  var pattern = context.createPattern(image, repetition);
  context.fillStyle = pattern;
  context.fillRect(x, y, width, height);

这篇关于用Canvas对象中的Background图像填充fillRect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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