GDI+ and DrawString
-
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... -
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...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
-
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
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.