Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. BUG? QColor::fromCmyk() produces dark output
Forum Updated to NodeBB v4.3 + New Features

BUG? QColor::fromCmyk() produces dark output

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Code_ReaQtor
    wrote on last edited by
    #1

    Hi! I am working on my project, "libqpsd":https://github.com/Code-ReaQtor/libqpsd

    Currently I am on the CMYK color mode. I found something odd in the "QColor::fromCmyk()":http://qt-project.org/doc/qt-4.8/qcolor.html#fromCmyk

    The output produced has inverted colors (black becomes white, white becomes black).

    I was able to correct it by using this:
    @QColor color = QColor::fromCmyk(255-cyan, 255-magenta,255-yellow, 255-key);
    //cyan, magenta, yellow, key are all quint8 taken from QDatastream@

    but I am not satisfied since it should be like this, AFAIK:
    @QColor color = QColor::fromCmyk(cyan, magenta, yellow, key);@

    EDIT: I am using QColor::rgb() to convert it to RGB

    Is this a BUG in the QColor class?

    Please visit my open-source projects at https://github.com/Code-ReaQtor.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      It's not a bug, it's intended. CMY are the basic colors of the "subtractive color system":http://en.wikipedia.org/wiki/Subtractive_color that is usually used to print on white backgrounds so more color means darker and less color means lighter and that is the exact opposite of what happens using RGB as base colors to paint on a black background

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Code_ReaQtor
        wrote on last edited by
        #3

        Thanks VRonin, I understand what CMYK is.

        But was QColor::rgb(), "supposedly", convert it to the right RGB (light) color and not retaining the CMYK style (dark)?

        Please visit my open-source projects at https://github.com/Code-ReaQtor.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved