[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Question on GDI vs GDI+

Posted on 2012-04-12
7
Medium Priority
?
477 Views
Last Modified: 2012-06-27
Graphics g = Graphics.FromImage(bm)

...

...

 g.FillRectangle(solidWhiteBrush, 0, 0, bm.Width, bm.Height);

 g.DrawString(AnnotationText, AnnotationFont, solidBlackBrush, new PointF(7f, 2f));


Here are my questions:

1)This is GDI+, correct?
(Running this on Windows 7)

2)What is the difference between GDI and GDI+?  Is the version of GDI tied to a particular OS?

3)Can the above code be optimized to run faster?

The intent of the code is to annotate an image with some text (a date stamp).
0
Comment
Question by:Tom Knowlton
  • 4
  • 3
7 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 37840349
In a nutshell:
WinForms is based on GDI+, while WPF is based on DirectX.
GDI was used before XP, while GDI+ is used in XP and above.
*Vista and Win 7 actually use a completely different drawing system (The Desktop Window Manager) that buffers GDI+ into a composite image with DirectX to render the operating system.

So yes, and no.  Yes, you are using GDI+ to add text to your image.  But when it gets displayed on the screen it's actually using DirectX because you are running Win 7.

Don't think you can make the code much faster.

Instead of FillRectangle(), you can do this to paint your bitmap a solid color:

    g.Clear(Color.White);
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 37840362
Is it possible to use or hook into WPF if I am running from inside a console app in C#?


Essentially, I have a console app (NO GUI) just running and it is annotating images using (at the moment) calls to GDI+.

I want to do the same thing in the console app, except I want to access either WPF or SharpDX libraries.  Again -- there is no GUI -- this is all done sight unseen.
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37840375
I'm not sure how you'd do it with WPF, but you can probably just add a REFERENCE to the Console app?
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
LVL 5

Author Comment

by:Tom Knowlton
ID: 37840377
No idea either.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 37840385
What do you know about SharpDX, Idle?
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 37840386
Absolutely nothing, other than it wraps a bunch of DirectX stuff for you.  =\
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 37840393
That is about what I know, too.  :(


One way or another I am sure I'll figure this out.

I have a few other questions on this topic right now.  If you know any EE gurus on SharpDX please send them my way, okay?  Any C# / XNA / game developer types you are acquainted with might know about SharpDX.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month20 days, 5 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question