Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. GDI+ and DrawString

GDI+ and DrawString

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestionc++winformsjson
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    A A 0
    wrote on last edited by
    #1

    There is an interesting behaviour, in that when I repaint something twice with the same string in GDI+ it becomes brighter, so I was wondering if the way that it paints the same string is not consistent. I tried to test this by setting the background to black, and repainting the string with the background color, then repainting another string. If you look closely you can see the residue of the first DrawString(alot more aparent if you set background to brighter color). Code Snippet: Graphics g(/*set DC*/); SolidBrush b(Color(255, 0, 0, 255)); SolidBrush bk(Color(255, 0, 0, 0)); // set FontFamily, Font, and PointF g.DrawString(A2CW("100"), -1, &font, pointF, &b); g.DrawString(A2CW("100"), -1, &font, pointF, &bk); g.DrawString(A2CW("101"), -1, &font, pointF, &b); So question is: Is this a feature, or am I missing something basic, or is it something so obvious that I should just rest, and think about it when I am up to speed again? Side Note: Don't really consider this a VC++ question though posted here for a lack of a more suitable forum...

    C 1 Reply Last reply
    0
    • A A A 0

      There is an interesting behaviour, in that when I repaint something twice with the same string in GDI+ it becomes brighter, so I was wondering if the way that it paints the same string is not consistent. I tried to test this by setting the background to black, and repainting the string with the background color, then repainting another string. If you look closely you can see the residue of the first DrawString(alot more aparent if you set background to brighter color). Code Snippet: Graphics g(/*set DC*/); SolidBrush b(Color(255, 0, 0, 255)); SolidBrush bk(Color(255, 0, 0, 0)); // set FontFamily, Font, and PointF g.DrawString(A2CW("100"), -1, &font, pointF, &b); g.DrawString(A2CW("100"), -1, &font, pointF, &bk); g.DrawString(A2CW("101"), -1, &font, pointF, &b); So question is: Is this a feature, or am I missing something basic, or is it something so obvious that I should just rest, and think about it when I am up to speed again? Side Note: Don't really consider this a VC++ question though posted here for a lack of a more suitable forum...

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      If you're drawing using smoothing, there may be some alpha blending going on, which would account for the brightening. Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002 Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002

      A 1 Reply Last reply
      0
      • C Christian Graus

        If you're drawing using smoothing, there may be some alpha blending going on, which would account for the brightening. Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002 Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002

        A Offline
        A Offline
        A A 0
        wrote on last edited by
        #3

        Went back and rechecked my assumptions, realized the default wasn't high quality. I take that to mean the algorithim used to fill doesn't always produce the same pixels. Thanks for the input, that made me even more eager to look around tonight. Wish MSDN docs were more detailed on this subject.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups