Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.8 KiB

  1. /*++
  2. Copyright (C) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. visuals.cpp
  5. Abstract:
  6. Miscellaneous visual utility routines.
  7. --*/
  8. //==========================================================================//
  9. // Includes //
  10. //==========================================================================//
  11. #include <windows.h>
  12. #include "visuals.h"
  13. //==========================================================================//
  14. // Exported data structures //
  15. //==========================================================================//
  16. COLORREF argbStandardColors[] = {
  17. RGB (0xff, 0x00, 0x00),
  18. RGB (0x00, 0x80, 0x00),
  19. RGB (0x00, 0x00, 0xff),
  20. RGB (0xff, 0xff, 0x00),
  21. RGB (0xff, 0x00, 0xff),
  22. RGB (0x00, 0xff, 0xff),
  23. RGB (0x80, 0x00, 0x00),
  24. RGB (0x40, 0x40, 0x40),
  25. RGB (0x00, 0x00, 0x80),
  26. RGB (0x80, 0x80, 0x00),
  27. RGB (0x80, 0x00, 0x80),
  28. RGB (0x00, 0x80, 0x80),
  29. RGB (0x40, 0x00, 0x00),
  30. RGB (0x00, 0x40, 0x00),
  31. RGB (0x00, 0x00, 0x40),
  32. RGB (0x00, 0x00, 0x00)
  33. };
  34. //==========================================================================//
  35. // Exported Functions //
  36. //==========================================================================//
  37. INT
  38. ColorToIndex(
  39. COLORREF rgbColor
  40. )
  41. {
  42. // Returns NumColorStandardColorIndices() if not found. This index is
  43. // used to indicate custom color.
  44. INT iColorIndex;
  45. for (iColorIndex = 0;
  46. iColorIndex < NumStandardColorIndices();
  47. iColorIndex++) {
  48. if (argbStandardColors[iColorIndex] == rgbColor) {
  49. break;
  50. }
  51. }
  52. return iColorIndex;
  53. }