来自另一幅图像的 Gdiplus 掩模图像
有没有办法使用另一个图像的 Alpha 来操纵图像的 Alpha?
假设我有一个图像,我想改变它的 alpha,从左侧开始不透明,在右侧完全透明,目前我用 LinearGradientBrush 绘制另一个图像,并通过逐像素循环从第二个图像设置原始图像的 alpha,Gdiplus 中还有另一种方法吗、一些图像蒙版,或者混合两个图像的 alpha?
结论:GDI+ 中似乎没有办法混合两个图像,唯一的方法似乎是通过迭代像素的手动方式。
Is there a way to manipulate alpha of an image using alpha from another image?
Suppose I have a Image and I want to alter its alpha starting opaque at left and totally transparent at right, currently I draw another image with LinearGradientBrush and set alpha of orginal image from second image by looping pixel by pixel, is there another way in Gdiplus, some image mask, or blending alpha of two images?
Conclusion: it seems there is no way in GDI+ to blend two images, only way seems to be the manual way by iterating thru pixels.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你是正确的,因为你必须逐像素地执行此操作。 我还寻找了一种更“纯粹”的方法来做到这一点,但这就是我最终得到的:
I think you're correct in that you have to do this pixel-by-pixel. I've also searched for a more "pure" way to do it, but this is what I ended up with: