如何将图像插入到 PolygonMorph 中?
我需要将纹理放入 PolygonMorph,但这些似乎需要 InfiniteForm 作为颜色/填充。
InfiniteForm 不是解决方案,因为我需要稍后旋转 PolygonMorph 并且移动 PolygonMorph 也会对显示的纹理产生副作用。
如果也可以缩放插入的纹理,那将非常有用。
在不替换现有 PolygonMorph(或至少保持 PolygonMorph 的形状)的情况下,您将如何做到这一点?
I need to get a texture into a PolygonMorph, but these seem to require an InfiniteForm as color/ filling.
The InfiniteForm is no solution as i need to rotate the PolygonMorph later on and moving the PolygonMorph around also has sideeffects on the displayed texture.
It would be very useful if it would be possible to scale the inserted texture as well.
How would you do this without replacing the existing PolygonMorph (or at least keeping the PolygonMorph's shape)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是解决您问题的另一个想法。
该解决方案包括 2 个阶段。
第 1 阶段:(drawTextures)我们使用 BitBlt 用我们的纹理图块填充表单。该形式存储在称为纹理的实例变量中。此表单在第 2 阶段中进行剪辑
第 2 阶段:(clipTextures) 现在我们生成一个形状像我们的多边形且具有多边形filledForm 的表单。然后我们从完全黑色的形式中减去它。现在我们有了一个负的多边形形状。这样我们就可以剪辑纹理了。现在我们可以创建一个图像变形并将其添加到多边形或任何我们想要用它做的事情中。
不幸的是,filledForm 实现无法处理凸形状。所以要小心你的多边形的样子。
该解决方案非常快,也可以在运行时应用。我们每 10 毫秒改变一次多边形的形状,并且渲染效果很好。
Heres another idea for your problem.
The solution includes 2 phases.
Phase 1: (drawTextures) We use BitBlt to fill a Form with our texture tiles. The form is stored in an instance variable called texturing. This form is clipped in phase 2
Phase 2: (clipTextures) Now we produce a form which is shaped like our polygon with polygon filledForm. Afterwards we substract this from a completley black form. Now we have a negative shape of the polygon. With this we clip the texturing. Now we can create an Image Morph and add it to the polygon or whatever we want to do with it.
Unfortunately the filledForm implementation cannot deal with convec shapes. So be careful how your polygon looks like.
This solution is pretty fast and can also be applied during run time. We are changing the shape of the polygon every 10msec and its rendering fine.