渲染从多个线程单个位图对象 [英] Rendering to a single Bitmap object from multiple threads

查看:100
本文介绍了渲染从多个线程单个位图对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么IM做的是使一些位图到一个位图。可能有数百个图像和所述位图被呈现到可能超过1000×1000个像素。

What im doing is rendering a number of bitmaps to a single bitmap. There could be hundreds of images and the bitmap being rendered to could be over 1000x1000 pixels.

林希望通过使用多线程来加速这个过程,但由于位图对象不是线程安全的它不能被渲染,直接兼任。什么即时通讯思想是对大位图分割成每个CPU部分,分别使它们然后在最后加入他们重新走到一起。 /我没有这样做还柜面你们女生有什么更好的建议。

Im hoping to speed up this process by using multiple threads but since the Bitmap object is not thread-safe it cant be rendered to directly concurrently. What im thinking is to split the large bitmap into sections per cpu, render them separately then join them back together at the end. I haven't done this yet incase you guys/girls have any better suggestions.

任何想法?谢谢

推荐答案

您可以使用在图像的各个部分LockBits和工作。

You could use LockBits and work on individual sections of the image.

有关的如何做到这一点,你可以看一下Paint.Net源$ C ​​$ C,特别是<一个例子href=\"http://$c$c.google.com/p/paint-mono/source/browse/trunk/src/Effects/BackgroundEffectRenderer.cs\"相对=nofollow> BackgroundEffectsRenderer (是的,这是单支的链接,但Paint.Net主要code似乎只在zip文件可用)。

For an example of how this is done you can look at the Paint.Net source code, especially the BackgroundEffectsRenderer (yes that is a link to the mono branch, but the Paint.Net main code seems to be only available in zip files).

这篇关于渲染从多个线程单个位图对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆