Search code examples
gtkcairogdk

Is there support for the HSV color model in cairo / gdk / gtk?


Well, the question is quite simple I think. I would like to specify colors using the HSV color model (https://en.wikipedia.org/wiki/HSL_and_HSV). However, all the cairo code seems to work exclusively with RGB / RGBA specifications. I could not find any ways to convert colors in gtk / gdk either. Am I missing something or is there some simple, portable way to convert colors (without additional libraries)?


Solution

  • Convertion HSV to RGB is just a couple of lines of code, see for example here (no code) or this SO question.


    But to answer your original question:

    AFAIK cairo is entirly based on RGBA model, see cairo_format_t in manual.