color_picker.h 564 B

123456789101112131415161718192021222324
  1. namespace ImGui
  2. {
  3. bool ColorPicker4(float* col, bool show_alpha);
  4. bool ColorPicker3(float col[3]);
  5. inline bool ColorEdit4(const char* label, uint32_t* _rgba, bool show_alpha = true)
  6. {
  7. uint8_t* rgba = (uint8_t*)_rgba;
  8. float col[4] =
  9. {
  10. rgba[0]/255.0f,
  11. rgba[1]/255.0f,
  12. rgba[2]/255.0f,
  13. rgba[3]/255.0f,
  14. };
  15. bool result = ColorEdit4(label, col, show_alpha);
  16. rgba[0] = uint8_t(col[0]*255.0f);
  17. rgba[1] = uint8_t(col[1]*255.0f);
  18. rgba[2] = uint8_t(col[2]*255.0f);
  19. rgba[3] = uint8_t(col[3]*255.0f);
  20. return result;
  21. }
  22. } // namespace ImGui