473,461 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Mixing GDI+ and GDI in .NET application

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 buffer" or will they mess it somehow eg drawing directly
to screen bypassing back buffer (I think it depends on what is returned
via GetHDC() - hndle to back buffer context or just control window
context)? Thank you in advance for your answers.

Mar 3 '06 #1
7 5948
Hello,

We have a Opening for Java located in North Jersey.

JAVA Requirement:

· Very strong in - JAVA fundamentals
· J2EE, EJB (stateless Session beans ect...)
· Server lets, Life cycle of EJB's
· JAVA threads, web logics 8.1
· Unix
· Web Services- very strong
· J unit, importance of quality
· SDLC process
· Version control software
· Should be very good team player
· Strong Communication and Technical Skills
· Work independently

If you are interested and find yourself eligible for this post conatct
me so that we can further proceed.

Thanks and Regards,
Sudha
Phone- 732-981-0450 ext-110

Mar 3 '06 #2
GDI+ and GDI calls is a great technique for increasing performance as long
as you stick with the right memory, IE screen memory.

Some GDI operations don't work well on double buffered controls because many
of the advantages of GDI come from hardware acceleration that is impossible
on in-memory bitmaps.

When the GDI drivers attempt to work on certain memory they are unable to do
the operation with hardware and revert to software for the task.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Marcin Rzeznicki" <ma**************@gmail.com> wrote in message
news:11*********************@j33g2000cwa.googlegro ups.com...
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 buffer" or will they mess it somehow eg drawing directly
to screen bypassing back buffer (I think it depends on what is returned
via GetHDC() - hndle to back buffer context or just control window
context)? Thank you in advance for your answers.

Mar 5 '06 #3

Bob Powell [MVP] napisal(a):
GDI+ and GDI calls is a great technique for increasing performance as long
as you stick with the right memory, IE screen memory.

Some GDI operations don't work well on double buffered controls because many
of the advantages of GDI come from hardware acceleration that is impossible
on in-memory bitmaps.

When the GDI drivers attempt to work on certain memory they are unable to do
the operation with hardware and revert to software for the task.


I mainly think about GDI text output operations. Another question is,
is it possible to interchange GDI and GDI+ measurements eg text
bounding rectangle. Text is printed out to screen and measured with
GDI, and the rest of the drawing process using the rectangle measured
in logical units of device is performed in GD+I. I think of two ways -
computing coordinates by myself or changing Grpahics PageUnit property
- which seems to be perfectly suited to the problem. Do you agree?

Mar 5 '06 #4
Unfortunately, the GDI+ renderer and that of GDI are completely different.
There is little correlation between the text measurements of the two
systems.

From experiance I can say that if you try to measure with one and output
with the other you're moving into a world of pain.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Marcin Rzeznicki" <ma**************@gmail.com> wrote in message
news:11*********************@t39g2000cwt.googlegro ups.com...

Bob Powell [MVP] napisal(a):
GDI+ and GDI calls is a great technique for increasing performance as
long
as you stick with the right memory, IE screen memory.

Some GDI operations don't work well on double buffered controls because
many
of the advantages of GDI come from hardware acceleration that is
impossible
on in-memory bitmaps.

When the GDI drivers attempt to work on certain memory they are unable to
do
the operation with hardware and revert to software for the task.


I mainly think about GDI text output operations. Another question is,
is it possible to interchange GDI and GDI+ measurements eg text
bounding rectangle. Text is printed out to screen and measured with
GDI, and the rest of the drawing process using the rectangle measured
in logical units of device is performed in GD+I. I think of two ways -
computing coordinates by myself or changing Grpahics PageUnit property
- which seems to be perfectly suited to the problem. Do you agree?

Mar 6 '06 #5

Bob Powell [MVP] napisal(a):
Unfortunately, the GDI+ renderer and that of GDI are completely different.
There is little correlation between the text measurements of the two
systems.

From experiance I can say that if you try to measure with one and output
with the other you're moving into a world of pain.


Actually, I would like to measure and output within single API but
"use" measurements across APIs' boundaries. For example: text would be
rendered and its bounding rectangle would be computed in GDI, the
rectangle would be passed to GDI+ and there used, for example, text
would be underscored. I suppose that setting GDI mapping mode to
MM_TEXT would resolve problem of different coordinate systems.

Mar 6 '06 #6
The GDI+ rendering pipeline is sane and sensible whereas the GDI system of
viewport and window extents isn't.

Measurements in GDI+ will render nice floating point values and it's
difficult, well almost impossible, to use these in the GDI system.

For a comparison of the two systems see the GDI+ FAQ.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Marcin Rzeznicki" <ma**************@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...

Bob Powell [MVP] napisal(a):
Unfortunately, the GDI+ renderer and that of GDI are completely
different.
There is little correlation between the text measurements of the two
systems.

From experiance I can say that if you try to measure with one and output
with the other you're moving into a world of pain.


Actually, I would like to measure and output within single API but
"use" measurements across APIs' boundaries. For example: text would be
rendered and its bounding rectangle would be computed in GDI, the
rectangle would be passed to GDI+ and there used, for example, text
would be underscored. I suppose that setting GDI mapping mode to
MM_TEXT would resolve problem of different coordinate systems.

Mar 6 '06 #7

Bob Powell [MVP] napisal(a):
The GDI+ rendering pipeline is sane and sensible whereas the GDI system of
viewport and window extents isn't.

Measurements in GDI+ will render nice floating point values and it's
difficult, well almost impossible, to use these in the GDI system.

For a comparison of the two systems see the GDI+ FAQ.


Hello Bob,
I've read it and I must assume that I quite don't catch it. What is
wrong with setting GDI mapping mode to MM_TEXT, which gives us logical
coordinates expressed in pixels, and setting viewport origin to (0,0)
which gives us GDI+ like coordinate system. Then assuming GDI
measurments give us rectangle (0,0,10,10) - we are able to use that
rectangle in GDI+ (no need for floats) as well as in GDI, just because
we have set up correct coordinate system (pixel-based and with origin
located at viewport upper left corner)/ Could you explain that?

Mar 8 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michael Kennedy [UB] | last post by:
Hi Everyone, I have this multithreaded C# windows forms application which does a lot of image processing. Occasionally, I get the following error: A generic error occurred in GDI+....
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: Wiktor Zychla | last post by:
today we've found a critical issue regarding the ListView from Windows.Forms. it was confirmed on several machines with Win2K and XP. here's the problem: create a ListView with about 50000 rows....
5
by: anonymous | last post by:
I'm writing a program that deals extensively with the printer. For the most part my application runs fine, but occasionally I run into some Exceptions. The most common exceptions I run into are...
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...
0
by: Lloyd Dupont | last post by:
In the same OnPaint() method I could mix GDI+ and GDI drawing. I have some hard to track nasty bug that appears sometimes (mainly when I print) and I wonder if any of the things I do are not...
0
by: James Wong | last post by:
Hi everybody, I'm facing a serious trouble relating to GDI+ generic error. The error message is "A Generic error occured in GDI+" and the following information is stored in Excepton object:...
14
by: James Wong | last post by:
Hi everybody, I'm facing a serious trouble relating to GDI+ generic error. The error message is "A Generic error occured in GDI+" and the following information is stored in Excepton object:...
2
by: rejidasan | last post by:
Hello All, I have a MFC Dialog based application. I am not using GDI or GDI+ libraries. I need to load PNG and JPEG images in this Dialog Based application. Can you suggest me how to to do...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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
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...
0
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,...
0
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...
0
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...

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.