473,835 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4601
I'm fairly confident that DirectX would be faster, try porting it to DirectX
and let me know how it goes.

"Scatropoli s" <ch*****@frayed .net> wrote in message
news:%2******** ********@TK2MSF TNGP10.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, "Scatropoli s" <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, "Scatropoli s" <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, "Scatropoli s" <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,
AllPaintingInWm Paint are always on, and so is TransparentBack Color 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.

"Scatropoli s" <ch*****@frayed .net> wrote in message
news:#u******** ******@TK2MSFTN GP10.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********@yah oo.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 rfsystemwindows formscontrolcla sssetstyletopic .asp
For controls that I do my own painting for, DoubleBuffer, UserPaint,
AllPaintingInW mPaint are always on, and so is TransparentBack Color 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******* *******@TK2MSFT NGP10.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
2562
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 out there does know any thing about this issue in VS 2005 + ..NET 2.0 ? Has Microsoft solved this performance problem, or we will have to again stick to that DX for simple animations in our applications? ( and since Microsoft doesn't support DDraw...
15
1695
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 instances of my class, the whole program runs slowly in a way that I have to close the program. I have tried to create a new thread for each class, but that throws an exception , because a separated thread can't be added to a form from a child...
6
6283
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 comprehensive list would be great.... *** Sent via Developersdex http://www.developersdex.com ***
0
4748
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 checkboxes for my test app i get a gdi handle leak anyone got any ideas on this one? using System;
7
3127
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 = system.drawing.bitmap.fromFile(filestring) newImage = new bitmpa(sourceImage, newWidth, newHeight) newImage.save(newFileString) Anyone knows of any faster methods?
7
5979
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" Graphics object which is done as a side-effect to GetHDC() call - could you confirm? Another question that comes to my mind when planning mentioned operation is: if the control painted on uses double-buffering style, will GDI calls make use of "back...
6
4380
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 refresh the screen about five times faster. What might I use else? DirectX ? I need only to draw, rotate and translate bitmap with alpha channel.
6
7515
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 small, compilable and runnable program that shows the
5
3656
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 (which clear all the bills and reshow all of them) four to five times and I get a Error creating window handle. I investigated on all of this, a lot, and still I'm not able to find where this problem come from. I know that the GDI objects column in...
0
9653
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10815
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10526
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10563
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6970
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5808
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3094
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.