469,133 Members | 1,003 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,133 developers. It's quick & easy.

Faster than GDI+

Is GDI as fast as drawing gets? I'm writing a program that deals with
drawing a ridiculous amount of lines and am finding GDI a little slow, or just
maybe how I'm using it. I was looking at some DirectX documents and wondering
if that was the way to go. Any help would be appreciated.

Thanks.
Nov 16 '05 #1
6 4463
I'm fairly confident that DirectX would be faster, try porting it to DirectX
and let me know how it goes.

"Scatropolis" <ch*****@frayed.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is GDI as fast as drawing gets? I'm writing a program that deals with
drawing a ridiculous amount of lines and am finding GDI a little slow, or just maybe how I'm using it. I was looking at some DirectX documents and wondering if that was the way to go. Any help would be appreciated.

Thanks.

Nov 16 '05 #2
On Fri, 7 May 2004 19:53:06 -0700, "Scatropolis" <ch*****@frayed.net>
wrote:
Is GDI as fast as drawing gets?


If you're drawing directly to the screen, then yes, that's it. Keep
in mind that .NET languages have a P/Invoke overhead for calling GDI
routines, too!

However, you could lock a GDI+ bitmap in memory and directly
manipulate the bits, then copy the result back to your control surface
-- you'll have to write your own drawing routines but they should be
plenty fast. And you won't have to mess with DirectX.
--
http://www.kynosarges.de
Nov 16 '05 #3
How exactly would I go about doing that. At the moment I'm using a Image in
memory then showing it in a pictureBox. What do you mean?
thanks

On 08/05/2004 Christoph Nahr <ch************@kynosarges.de> wrote:
On Fri, 7 May 2004 19:53:06 -0700, "Scatropolis" <ch*****@frayed.net>
wrote:
Is GDI as fast as drawing gets?


If you're drawing directly to the screen, then yes, that's it. Keep
in mind that .NET languages have a P/Invoke overhead for calling GDI
routines, too!

However, you could lock a GDI+ bitmap in memory and directly
manipulate the bits, then copy the result back to your control surface
-- you'll have to write your own drawing routines but they should be
plenty fast. And you won't have to mess with DirectX.

Nov 16 '05 #4
Take a look at the Bitmap.LockBits method.

On Sat, 8 May 2004 13:09:46 -0700, "Scatropolis" <ch*****@frayed.net>
wrote:
How exactly would I go about doing that. At the moment I'm using a Image in
memory then showing it in a pictureBox. What do you mean?
thanks

--
http://www.kynosarges.de
Nov 16 '05 #5
Did you set the style of the control you are painting on to DoubleBuffer?
This will make sure all the drawing is done in memory first then the final
result will be painted to the surface instead of drawing each line or object
realtime.

See this page here:

http://msdn.microsoft.com/library/de...styletopic.asp

For controls that I do my own painting for, DoubleBuffer, UserPaint,
AllPaintingInWmPaint are always on, and so is TransparentBackColor just for
fun and special effects. Sometimes, ResizeRedraw is also handy if your
control needs to repaint when resized automatically.

I've noticed with these styles on, GDI+ is extremely fast and I don't notice
any unusual slowness at all. But let me know if that helps or not.

If you need to do a lot of realtime drawing without slowing up the rest of
your app, worker threads might also help.

"Scatropolis" <ch*****@frayed.net> wrote in message
news:#u**************@TK2MSFTNGP10.phx.gbl...
Is GDI as fast as drawing gets? I'm writing a program that deals with
drawing a ridiculous amount of lines and am finding GDI a little slow, or just maybe how I'm using it. I was looking at some DirectX documents and wondering if that was the way to go. Any help would be appreciated.

Thanks.

Nov 16 '05 #6
At the moment I have the drawing all done on an Image in another class. Then
just drawn on the pictureBox. Though I'm wonder if all those white spaces
are causing my bottle neck.

On 10/05/2004 "Eric" <ej********@yahoo.com> wrote:
Did you set the style of the control you are painting on to DoubleBuffer?
This will make sure all the drawing is done in memory first then the final
result will be painted to the surface instead of drawing each line or object
realtime.

See this page here:

http://msdn.microsoft.com/library/de...cpref/html/frl rfsystemwindowsformscontrolclasssetstyletopic.asp
For controls that I do my own painting for, DoubleBuffer, UserPaint,
AllPaintingInWmPaint are always on, and so is TransparentBackColor just for
fun and special effects. Sometimes, ResizeRedraw is also handy if your
control needs to repaint when resized automatically.

I've noticed with these styles on, GDI+ is extremely fast and I don't notice
any unusual slowness at all. But let me know if that helps or not.

If you need to do a lot of realtime drawing without slowing up the rest of
your app, worker threads might also help.

"Scatropolis" <ch*****@frayed.net> wrote in message
news:#u**************@TK2MSFTNGP10.phx.gbl...
Is GDI as fast as drawing gets? I'm writing a program that deals with
drawing a ridiculous amount of lines and am finding GDI a little slow, or

just
maybe how I'm using it. I was looking at some DirectX documents and

wondering
if that was the way to go. Any help would be appreciated.

Thanks.


Nov 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by **ham | last post: by
15 posts views Thread by ham-z | last post: by
6 posts views Thread by James dean | last post: by
reply views Thread by Brian Keating | last post: by
7 posts views Thread by Marcin Rzeznicki | last post: by
6 posts views Thread by Marco Trapanese | last post: by
6 posts views Thread by Martijn Mulder | last post: by
5 posts views Thread by Jonathan Boivin | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.