+/*-------------------------------------------
+Markus Emmenegger <mege@iqe.ethz.ch>
+Find the pixel value with an assigned color closest to the desired color
+Used if color cell allocation fails
+As the returned pixel value may be in use by another application,
+the color might change anytime.
+But in many cases, that is still better than always using black.
+--
+Chris Breeze <chris@hel.co.uk>
+Improvements:
+1) More efficient calculation of RGB distance of colour cell from
+the desired colour. There is no need to take the sqrt of 'dist', and
+since we are only interested in the top 8-bits of R, G and B we
+can perform integer arithmetic.
+2) Attempt to allocate a read-only colour when a close match is found.
+A read-only colour will not change.
+3) Fall back to the closest match if no read-only colours are available.
+
+ Possible further improvements:
+ 1) Scan the lookup table and sort the colour cells in order of
+ increasing
+ distance from the desired colour. Then attempt to allocate a
+ read-only
+ colour starting from the nearest match.
+ 2) Linear RGB distance is not a particularly good method of colour
+ matching
+ (though it is quick). Converting the colour to HLS and then comparing
+ may give better matching.
+-------------------------------------------*/
+
+WXPixel wxGetBestMatchingPixel(Display *display, XColor *desiredColor, Colormap cmap)