[Mono-dev] GDI+ and GetNearestColor

Zac Bowling zac at zacbowling.com
Sun Mar 5 21:37:28 EST 2006

Hey guys,

Here is a little patch I'm using to get some 3rd party controls working 
with SWF. They seem to be calling the NearestColor in System.Drawing 
(translates to GdipGetNearestColor) which is suppost to look up the 
closest color on the current system palette. Lots of documentation 
about this being useful on Windows CE and how it will return a color 
that work on the screen (like if you got a 8 tone monochrome screen) 
but on Windows it doesn't give much detail on what it does exactly 
underneath. Returning Ok instead of NotImplemented (which causes an 
exception when it returns to the managed layer) and just passing back 
the same color in this function it receives (in the argb pointer), I 
haven't seen any issues I from my testing. I don't think we can 
implement this to easy like Win32 can.

Index: src/graphics.c
--- src/graphics.c      (revision 57498)
+++ src/graphics.c      (working copy)
@@ -4043,7 +4043,7 @@
GdipGetNearestColor (GpGraphics *graphics, ARGB *argb)
-       return NotImplemented;
+       return Ok;


Zac Bowling

This message was sent using IMP, the Internet Messaging Program.

More information about the Mono-devel-list mailing list