简体   繁体   English

jCanvas-用图像填充矩形

[英]jCanvas - Fill Rectangles with image

Is there a possibility to fill a rectangle with a picture and not with color in jCanvas? 在jCanvas中是否可以用图片而不是颜色填充矩形?

I would repeat the pic in the rectangle like in css for example: 我会像在CSS中那样在矩形中重复图片,例如:

background-repeat: repeat;

To fill a pattern with an image, use the createPattern() method built into jCanvas. 要用图像填充图案,请使用jCanvas中内置的createPattern()方法。 However, due to the limitations of the HTML5 canvas API, you cannot offset a pattern (so as to move it with a draggable layer). 但是,由于HTML5 canvas API的限制,您无法偏移图案(以便使用可拖动的图层移动它)。

-Caleb -卡莱布

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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