473,395 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 4586
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: **ham | last post by:
I know that's an old dirty issue; GDI+ almost -the slowest part of the framework - has bothered many developers using it in animations. Even in managed C++ the performance is awful. Now, any dude...
15
by: ham-z | last post by:
I have written the following Win app in VB.NET 2003 . The class is simply picture boxes that behave in a random order after they have been instantiated and added to a form. When I create 15 or more...
6
by: James dean | last post by:
I want a good site that will show clearly how much more functionality GDI+ has. I cannot seem to find anything other than sites that list "some" of the new functionality that GDI+ offers. A...
0
by: Brian Keating | last post by:
hi there i've a test program that creates a treeview and destroys it over and over, i keep track of the gdi object count for the process and see if they are ok. However when i switch on...
7
by: chad | last post by:
is it just me or does anybody else find the Image.RotateFlip method kind of slow? (I'm comparing to commercial softwares). Same for resizing. I'm using sourceImage =...
7
by: Marcin Rzeznicki | last post by:
Hello, Do you think it is legitimate practice to mix GDI+ and GDI calls (via Get/ReleaseHDC()) in paint event of a control? I've heard there is possibility of performance loss while "locking"...
6
by: Marco Trapanese | last post by:
Hi, I wrote an application that draw on a form complex graphics. Tons of image with transparencies. I used GDI+ of course... but they are so slow! The paint event takes about 250 ms... I need to...
6
by: Martijn Mulder | last post by:
/* BitBlt.cs C# code using P/Invoke I have good reasons to use P/Invoke to get access to the Win32 API function BitBlt(). But I have trouble understanding the workings of it. Below is a...
5
by: Jonathan Boivin | last post by:
Hi, I've got some problems with loading bills using a bill usercontrol I built. If I load all current bills in my test environment (156) everything is fine once, but repeating the operation...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.