Reputation: 972
I'm making a program in SDL.NET, where I need to draw a filled polygon. I figured it might be good to reuse the polygon surface instead of remaking it every time i need to draw, so I make the surface like this, and then save it to a dictionary afterwards:
polySur = Video.Screen.CreateCompatibleSurface(70, 70, true);
polySur.TransparentColor = Color.Magenta;
polySur.Fill(Color.Magenta);
polySur.Transparent = true;
poly.Draw(polySur, Color.LightGreen, false, true);
poly
is the Polygon
object I've created beforehand.
You might think that this will draw a light green polygon when the surface is blitted to the screen; it doesn't. The resulting polygon is cyan! I discovered through experimentation that if I make a Color with Color.FromArgb
, the R channel becomes red, G channel becomes cyan, and B channel becomes black.
However, if I set the second boolean in the Draw call to false (disabling the filling), i get a light green outline. Obviously, the fill operation is causing the colors to mess up.
Any ideas?
Upvotes: 1
Views: 229
Reputation: 31
It's a bug: http://sourceforge.net/tracker/index.php?func=detail&aid=3127181&group_id=52340&atid=466516
Line 196 of Polygon uses the color RGG to fill instead of RGB. This make sit impossible to get a blue color, and tends to tint any color other than red.
Frustrating, yes. Especially when your game hinges on being able to draw polygons.
Upvotes: 0