Thread: GDI+ Limitation?

  1. #1
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92

    Unhappy GDI+ Limitation?

    Hi all, long time no see-

    I'm developing a li'l app for advanced SodaConstructing (don't worry if you don't know the term, its not vital), and I've come to a point where I want to draw all my lines antialiased. So, I had a play with GDI+ to draw my lines, but it seems to have a major limitation as far as antialiasing goes. The Graphics::SetSmoothingMode method takes an item from the SmoothingMode enum as a parameter. The contents of the SmoothingMode enum as documented are as follows:

    Code:
    typedef enum {
        SmoothingModeInvalid = QualityModeInvalid,
        SmoothingModeDefault = QualityModeDefault,
        SmoothingModeHighSpeed = QualityModeLow,
        SmoothingModeHighQuality = QualityModeHigh,
        SmoothingModeNone,
        SmoothingModeAntiAlias8x4,
        SmoothingModeAntiAlias = SmoothingModeAntiAlias8x4,
        SmoothingModeAntiAlias8x8
    } SmoothingMode;
    However, this is not how it is defined in GdiPlusEnums.h:

    Code:
    enum SmoothingMode
    {
        SmoothingModeInvalid     = QualityModeInvalid,
        SmoothingModeDefault     = QualityModeDefault,
        SmoothingModeHighSpeed   = QualityModeLow,
        SmoothingModeHighQuality = QualityModeHigh,
        SmoothingModeNone,
        SmoothingModeAntiAlias
    };
    ...which leaves me unable to use an 8x8 box filter for my antialiasing, instead limiting me to an 8x4 box filter (SmoothingModeAntiAlias) which draws horrible lines when they are close to horizontal.

    Does this mean that this part of the GDI+ library is incomplete at this stage, or was it just never implemented? It seems odd to me that they'd document something which would (i presume) be so simple to implement, but never include it in the actual library...

    Does anybody...
    a: ...know a workaround (or tell me the stupid mistake i'm making ) to get 8x8 box filter antialiasing using GDI+?
    b: ...know why this apparent limitation exists in GDI+?
    c: ...know a good method, third party library or any other way to get antialiased lines without GDI+?

    Thanks all for your time!
    -jEFF
    psychobrat at gmail

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Hey, I stumbled accross the sodaplayer web site yesterday. Looks interesting. Are you writing a SodaConstructor in C++?

    If SmoothingModeAntiAlias8x8 did exist in the enum its value would be SmoothingModeAntiAlias + 1 so try passing this in the method call. If it is implemented in the dll it should work.

    If not, you may want to ask how to implement antialiasing in the game forum as they are the experts on graphics.

    P.S I couldn't get my model to move(at least not in any particular direction)!

  3. #3
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    "Hey, I stumbled accross the sodaplayer web site yesterday. Looks interesting. Are you writing a SodaConstructor in C++?"

    Exactly, but with more features that constructors have been asking for, that Ed (the creator of SodaPlay) has not had time to build into the official applets.

    "If SmoothingModeAntiAlias8x8 did exist in the enum its value would be SmoothingModeAntiAlias + 1 so try passing this in the method call. If it is implemented in the dll it should work."

    Yeah, I tried that, and many other static numbers - they're all interpereted as "no antialiasing".

    "If not, you may want to ask how to implement antialiasing in the game forum as they are the experts on graphics."

    Ok- thanks, but I'm pretty sure that if there's no way to do it well through GDI+ i'm going to move over to OGL... after hearing it praised by my brother a few minutes ago while playing table tennis --he showed me some examples and it looks incredibly easy to use.

    "P.S I couldn't get my model to move(at least not in any particular direction)!"

    You might want to have a look at http://www.sodaplaycentral.com for tips on constructing, and http://www.sodarace.net to ask questions on the official forum.

    Thanks!
    -jEFF
    psychobrat at gmail

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Download the latest Core SDK if you want to have the latest headers.

    gg

  5. #5
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    Thanks, but apparently that was last updated February 2003, and since I dowloaded it in March (right on my birthday as it were!) I think its safe to assume I have the latest version :P

    -jEFF
    psychobrat at gmail

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows GDI vs. Java Graphics
    By Perspective in forum Windows Programming
    Replies: 7
    Last Post: 05-07-2007, 10:05 AM
  2. GDI object lifetime and C++ object lifetime
    By VirtualAce in forum Windows Programming
    Replies: 4
    Last Post: 06-16-2006, 05:26 AM
  3. opengl, or gdi?
    By n3v in forum Game Programming
    Replies: 25
    Last Post: 05-21-2006, 05:02 PM
  4. Whats Peoples Problem With the GDI?
    By MicroFiend in forum Game Programming
    Replies: 6
    Last Post: 07-28-2003, 07:52 PM
  5. Double buffering in GDI -- easy?
    By fusikon in forum Game Programming
    Replies: 17
    Last Post: 02-15-2003, 10:03 PM