If you don't share the resources between threads it should be safe.
There have been some years, wouldn't it have been faster to try already?
drawing to a bitmap from a thread Topic is solved
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: drawing to a bitmap from a thread
catalin wrote:If you don't share the resources between threads it should be safe.
There have been some years, wouldn't it have been faster to try already?
I already use the other suggestion to draw on a wxBitmap with a wxMemoryDC inside the thread, convert it to wxImage, send it with an wxThreadEvent to the main thread, convert it back to wxBitmap and paint it to the screen. I just found your suggestion interesting when i reread the topic here and wanted to learn if some other way would be possible. Do you have a link to an article where I can read about shared resources and threads?
Re: drawing to a bitmap from a thread
No, sorry. But any article on the subject will be good enough, there is nothing wx-specific about it. Just consider native resources (which are almost always used by graphic APIs) as not thread safe. Apart from that, Google or any decent library are very good friends.
Re: drawing to a bitmap from a thread
Just for the reference, this topic has been discussed on wx-dev recently:
https://groups.google.com/d/topic/wx-us ... discussion
If I understood it correctly, GDI objects can be used in worker threads as long as it is ensured they are accessed always only from the thread they were created in.
https://groups.google.com/d/topic/wx-us ... discussion
If I understood it correctly, GDI objects can be used in worker threads as long as it is ensured they are accessed always only from the thread they were created in.
-
- Ultimate wxWidgets Guru
- Posts: 539
- Joined: Fri May 22, 2009 8:52 am
- Location: Bremen, Germany
Re: drawing to a bitmap from a thread
Good read, I understand now, thank you everyone!PB wrote:Just for the reference, this topic has been discussed on wx-dev recently:
https://groups.google.com/d/topic/wx-us ... discussion
If I understood it correctly, GDI objects can be used in worker threads as long as it is ensured they are accessed always only from the thread they were created in.