在P5J中创建掩码层
我想绘制一个模式,然后只有该模式“通过”它与我指定的形状重叠。类似于掩码层在Photoshop中的工作方式。有人知道我如何处理吗?
I would like to draw a pattern, and then only have that pattern ‘show through’ where it overlaps with a shape that I specify. Similar to how a mask layer works in Photoshop. Does anyone know how I can approach this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将使用这个4步过程:
使用beginshape()/endShape创建掩码,而beginContour()/endContour()中间,以显示要显示的区域。您可以在缓冲区上执行此操作。
然后为模式创建不同的缓冲区
现在从掩码加载像素,并在图案上每个相应像素的alpha级别上使用每个像素的alpha值。
最后,只需使用
image(模式,0,0)
将结果缓冲区添加到主画布中
请仔细地查看此工作示例! :d
I would use this 4 step process:
create your mask with beginShape()/endShape and a beginContour()/endContour() in the middle for the area to be shown. You do this on a buffer.
Then create a different buffer for the pattern
Now load pixels from the mask and use the alpha value of each pixel on the alpha level of each corresponding pixel on the pattern.
Finally, just add the resulting buffer to your main canvas with
image(pattern,0,0)
Take a look at this working example carefully coded just for you! :D