Search code examples
gdi+gdi

Is GDI+ just a layer on top of GDI, or something new?


When GDI+ came out, I remember all the brouhaha about how it was the "new, faster, better" way to display stuff in Windows. But everytime I looked at it, it seemed to me that it was really just a COM wrapper around GDI.

Is that true? Or is GDI+ really an independent graphical library that simply shares some paradigms with GDI?

Personally, I'm not sure how it could be independent, but I never saw a definite statement one way or another.


Solution

  • Many GDI functions are accelerated by the graphics hardware, and some GDI+ routines may use GDI underneath. But most of GDI+ is independant of GDI.

    An important, and telling, example is text rendering. In GDI+ text rendering is done completely in software; the anti-aliasing, glyph pixel-fitting and other effects is done without the video card.

    alt text
    (source: microsoft.com)

    Microsoft's Chris Jackson had an interesting blog post where he profiled the speed difference between text rendering in GDI and GDI+:

    ...my GDI code path was rendering approximately 99,000 glyphs per second, while my GDI+ code path was rendering approximately 16,000 glyphs per second.

    Another example is line drawing. GDI+ supports anti-aliased line/polygon and circle/ellipse drawing, while GDI does not:

    alt text
    (source: microsoft.com)
    alt text
    (source: microsoft.com)

    alt text
    (source: microsoft.com)