在 Windows 窗体中在图像上绘制叠加层的最快方法
在 .net 中的图像上绘制最快的方法是什么?
我正在尝试在 Windows 窗体控件中的另一个图像之上绘制一个图像。 我知道当我尝试使用循环直接绘制它时,需要花费 Eon。
我听说过的选项有 GDI+、Direct Draw 或 DX10。 我从固定大小的位图开始,在将其分配给表单对象之前对其应用 3 个以上的覆盖层、图层。
谢谢,
What is the fastest way to draw an on an image in .net?
I'm trying to draw an image on top of another image that have in a windows form control. I know that when I try to draw it directly using loops it takes an Eon.
Options I have heard tossed around are GDI+, Direct Draw, or DX10. I start with a bitmap of a fixed size and after applying 3+ overlays, layers, to it before it is assigned to a form object.
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的叠加层是图像(可能是具有透明度的 PNG 图像),则一般技术是从您要在其上绘制的图像创建一个 Graphics 对象,然后将其他图像渲染到其上:
如果您的叠加层是绘制对象(文本、线条、形状等),然后您将创建或获取适当的画笔和笔,并使用 Graphics 对象将您想要的内容渲染到图像上。 务必确保在使用完一次性用品后将其丢弃。 使用 using 语句可以最方便地完成此操作。
If your overlays are images (perhaps PNG images with transparency), then the general technique is to create a Graphics object from the image onto which you'd like to draw, then render the other images onto it thusly:
If your overlays are drawn object (text, lines, shapes, etc.), then you would create or obtain the appropriate brushes and pens and use the Graphics object to render what you want onto the image. Always make sure you dispose of any disposables when you're done with them. This is most handily done with the using statement.