By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,285 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,285 IT Pros & Developers. It's quick & easy.

Mixing GDI+ and GDI in .NET application

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/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.

--
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

P: n/a

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

P: n/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.

--
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

P: n/a

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

P: n/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.

--
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

P: n/a

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 discussion thread is closed

Replies have been disabled for this discussion.