在给定像素数组的情况下用 C 语言实现波纹效果
我必须在像素数组上实现波纹效果。每个像素都是代表 ARGB 颜色的 32 位整数。有人对如何开始有什么建议吗?
I have to implement a ripple effect on an array of pixels. Each pixel is a 32 bit integer representing an ARGB color. Does anyone have any suggestions on how to start?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,波纹效应是图像的某种失真,其中失真量以“波浪”图案从点到点变化。因此第一个任务是创建一个“深度映射”,为每个像素生成一个数字。直观上,深度图将表示原始像素上方波纹水面的高度。实验的起点可以是
当你有了深度图(如果你想要的只是将相同的波纹应用于许多不同的图像,则可以预先计算深度图),你可以选择如何处理它:
可能需要对这些方法的组合和变化进行一些实验才能大致了解您所期望的效果。
Generally, a ripple effect is some kind of distortion of the image where the amount of distortion varies from point to point in a "wavy" pattern. So the first task is to create a "depth mapping" producing a number for each pixel. Intuitively the depth map will represent the height of a rippled water surface above the original pixels. A starting point for experimentation could be
When you have the depth map (which can be precomputed if all you want is to apply the same ripple to many different images), you have various options for what to do with it:
It may take some experimentation with combinations and variations of these to approximate your mental picture of the desired effect.