?
Solved

Question on GDI vs GDI+

Posted on 2012-04-12
7
Medium Priority
?
463 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

 
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

777 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