Difference between revisions of "Color Model HSV"
m (Text replacement - "modo.sdk.thefoundry.co.uk//wiki/" to "modo.sdk.thefoundry.co.uk/wiki/") |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 369: | Line 369: | ||
bool withHexPrefix = false) | bool withHexPrefix = false) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 421: | Line 395: | ||
float *hsv) | float *hsv) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 464: | Line 406: | ||
float *rgb) | float *rgb) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
</pre> | </pre> | ||
Line 532: | Line 418: | ||
QueryCommandString (const char *cmdName, const char *argName) | QueryCommandString (const char *cmdName, const char *argName) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 548: | Line 424: | ||
QueryCommandInt (const char *cmdName, int defaultValue = 0) | QueryCommandInt (const char *cmdName, int defaultValue = 0) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
static double | static double | ||
QueryCommandFloat (const char *cmdName, double defaultValue = 0.0) | QueryCommandFloat (const char *cmdName, double defaultValue = 0.0) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}</pre> | }</pre> | ||
Line 579: | Line 436: | ||
ExecuteCommand (const char *cmdName) | ExecuteCommand (const char *cmdName) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 593: | Line 446: | ||
HSVColor &baseColor) | HSVColor &baseColor) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 632: | Line 453: | ||
string &path) | string &path) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 655: | Line 466: | ||
string &swatchPath) | string &swatchPath) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}</pre> | }</pre> | ||
Line 749: | Line 478: | ||
Metrics &metrics) | Metrics &metrics) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}</pre> | }</pre> | ||
Line 810: | Line 495: | ||
LXtFVector hsv) | LXtFVector hsv) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}</pre> | }</pre> | ||
Line 855: | Line 503: | ||
HueRGBtoRYB (float hue) | HueRGBtoRYB (float hue) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 886: | Line 512: | ||
HueRYBtoRGB (float hue) | HueRYBtoRGB (float hue) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}</pre> | }</pre> | ||
Line 924: | Line 521: | ||
struct CHSVColorModelPersist | struct CHSVColorModelPersist | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}; | }; | ||
Line 950: | Line 529: | ||
class CHSVColorModelPersistVisitor : public CLxImpl_AbstractVisitor | class CHSVColorModelPersistVisitor : public CLxImpl_AbstractVisitor | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
}; | }; | ||
Line 968: | Line 545: | ||
CHSVColorModelPersistVisitor::Evaluate () | CHSVColorModelPersistVisitor::Evaluate () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}</pre> | }</pre> | ||
Line 1,056: | Line 568: | ||
CHSVColorModelNotifier::cn_Flags (int code) | CHSVColorModelNotifier::cn_Flags (int code) | ||
{ | { | ||
− | + | ... | |
}</pre> | }</pre> | ||
− | This section implements the functions of the CHueAsWheelColorModelCommand class. Its constructor sets it so that it takes a boolean value. The CmdFlags function indicates that the command affects the command ui. The notifier goes off whenever the notifier(http://sdk. | + | This section implements the functions of the CHueAsWheelColorModelCommand class. Its constructor sets it so that it takes a boolean value. The CmdFlags function indicates that the command affects the command ui. The notifier goes off whenever the notifier(http://modo.sdk.thefoundry.co.uk/wiki/Notifier_Object) in 407-424 goes off or the selected color has changed. The enables command enables the command if the strip is not set to the hue axis. The cmd_execute portion is the actual command. Cmd_Query asks for the value of a relevant argument index. |
<pre> | <pre> | ||
Line 1,067: | Line 579: | ||
enum | enum | ||
{ | { | ||
− | + | ... | |
}; | }; | ||
Line 1,074: | Line 586: | ||
CHueAsWheelHSVColorModelCommand::CHueAsWheelHSVColorModelCommand () | CHueAsWheelHSVColorModelCommand::CHueAsWheelHSVColorModelCommand () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
} | } | ||
Line 1,082: | Line 592: | ||
CHueAsWheelHSVColorModelCommand::basic_CmdFlags () | CHueAsWheelHSVColorModelCommand::basic_CmdFlags () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 1,091: | Line 601: | ||
string &args) | string &args) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,110: | Line 607: | ||
CHueAsWheelHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | CHueAsWheelHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
} | } | ||
enum | enum | ||
{ | { | ||
− | + | ... | |
− | + | ||
}; | }; | ||
Line 1,125: | Line 618: | ||
CHueAsWheelHSVColorModelCommand::cmd_Execute (unsigned int flags) | CHueAsWheelHSVColorModelCommand::cmd_Execute (unsigned int flags) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,145: | Line 624: | ||
CHueAsWheelHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) | CHueAsWheelHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
}</pre> | }</pre> | ||
Line 1,155: | Line 632: | ||
enum | enum | ||
{ | { | ||
− | + | ... | |
}; | }; | ||
Line 1,161: | Line 638: | ||
static LXtTextValueHint hint_hsvWheel[] = { | static LXtTextValueHint hint_hsvWheel[] = { | ||
− | + | ... | |
− | + | ||
− | + | ||
}; | }; | ||
CWheelHSVColorModelCommand::CWheelHSVColorModelCommand () | CWheelHSVColorModelCommand::CWheelHSVColorModelCommand () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,177: | Line 649: | ||
CWheelHSVColorModelCommand::basic_CmdFlags () | CWheelHSVColorModelCommand::basic_CmdFlags () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 1,186: | Line 658: | ||
string &args) | string &args) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,205: | Line 664: | ||
CWheelHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | CWheelHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | ||
{ | { | ||
− | + | ... | |
− | + | ||
} | } | ||
Line 1,212: | Line 670: | ||
CWheelHSVColorModelCommand::cmd_Execute (unsigned int flags) | CWheelHSVColorModelCommand::cmd_Execute (unsigned int flags) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,232: | Line 676: | ||
CWheelHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) | CWheelHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,253: | Line 693: | ||
enum | enum | ||
{ | { | ||
− | + | ... | |
}; | }; | ||
Line 1,259: | Line 699: | ||
static LXtTextValueHint hint_hsvRule[] = { | static LXtTextValueHint hint_hsvRule[] = { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}; | }; | ||
CRuleHSVColorModelCommand::CRuleHSVColorModelCommand () | CRuleHSVColorModelCommand::CRuleHSVColorModelCommand () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,281: | Line 710: | ||
CRuleHSVColorModelCommand::basic_CmdFlags () | CRuleHSVColorModelCommand::basic_CmdFlags () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 1,290: | Line 719: | ||
string &args) | string &args) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,309: | Line 725: | ||
CRuleHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | CRuleHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | ||
{ | { | ||
− | + | ... | |
− | + | ||
} | } | ||
Line 1,316: | Line 731: | ||
CRuleHSVColorModelCommand::cmd_Execute (unsigned int flags) | CRuleHSVColorModelCommand::cmd_Execute (unsigned int flags) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,338: | Line 739: | ||
ILxUnknownID vaQuery) | ILxUnknownID vaQuery) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,360: | Line 757: | ||
enum | enum | ||
{ | { | ||
− | + | ... | |
}; | }; | ||
Line 1,376: | Line 773: | ||
CRuleAdjustHSVColorModelCommand::CRuleAdjustHSVColorModelCommand () | CRuleAdjustHSVColorModelCommand::CRuleAdjustHSVColorModelCommand () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
} | } | ||
Line 1,384: | Line 779: | ||
CRuleAdjustHSVColorModelCommand::basic_CmdFlags () | CRuleAdjustHSVColorModelCommand::basic_CmdFlags () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 1,393: | Line 788: | ||
string &args) | string &args) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,412: | Line 794: | ||
CRuleAdjustHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | CRuleAdjustHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,423: | Line 800: | ||
CRuleAdjustHSVColorModelCommand::cmd_Execute (unsigned int flags) | CRuleAdjustHSVColorModelCommand::cmd_Execute (unsigned int flags) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,479: | Line 808: | ||
ILxUnknownID vaQuery) | ILxUnknownID vaQuery) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
} | } | ||
Line 1,489: | Line 816: | ||
CLxUser_UIHints &hints) | CLxUser_UIHints &hints) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
} | } | ||
Line 1,502: | Line 827: | ||
enum | enum | ||
{ | { | ||
− | + | ... | |
}; | }; | ||
Line 1,509: | Line 834: | ||
CLevelsHSVColorModelCommand::CLevelsHSVColorModelCommand () | CLevelsHSVColorModelCommand::CLevelsHSVColorModelCommand () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
} | } | ||
Line 1,517: | Line 840: | ||
CLevelsHSVColorModelCommand::basic_CmdFlags () | CLevelsHSVColorModelCommand::basic_CmdFlags () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 1,526: | Line 849: | ||
string &args) | string &args) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,545: | Line 855: | ||
CLevelsHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | CLevelsHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,555: | Line 861: | ||
CLevelsHSVColorModelCommand::cmd_Execute (unsigned int flags) | CLevelsHSVColorModelCommand::cmd_Execute (unsigned int flags) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,573: | Line 867: | ||
CLevelsHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) | CLevelsHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,584: | Line 875: | ||
CLxUser_UIHints &hints) | CLxUser_UIHints &hints) | ||
{ | { | ||
− | + | ... | |
− | + | ||
} | } | ||
Line 1,596: | Line 886: | ||
enum | enum | ||
{ | { | ||
− | + | ... | |
}; | }; | ||
CSaveAsPresetsHSVColorModelCommand::CSaveAsPresetsHSVColorModelCommand () | CSaveAsPresetsHSVColorModelCommand::CSaveAsPresetsHSVColorModelCommand () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
} | } | ||
Line 1,609: | Line 897: | ||
CSaveAsPresetsHSVColorModelCommand::basic_CmdFlags () | CSaveAsPresetsHSVColorModelCommand::basic_CmdFlags () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 1,618: | Line 906: | ||
string &args) | string &args) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,637: | Line 912: | ||
CSaveAsPresetsHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | CSaveAsPresetsHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) | ||
{ | { | ||
− | + | ... | |
− | + | ||
} | } | ||
Line 1,650: | Line 924: | ||
HSVColor &baseColor) | HSVColor &baseColor) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,689: | Line 931: | ||
string &path) | string &path) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,712: | Line 944: | ||
string &swatchPath) | string &swatchPath) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,800: | Line 950: | ||
CSaveAsPresetsHSVColorModelCommand::cmd_Execute (unsigned int flags) | CSaveAsPresetsHSVColorModelCommand::cmd_Execute (unsigned int flags) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,837: | Line 956: | ||
CSaveAsPresetsHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) | CSaveAsPresetsHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,849: | Line 964: | ||
CLxUser_UIHints &hints) | CLxUser_UIHints &hints) | ||
{ | { | ||
− | + | ... | |
}</pre> | }</pre> | ||
Line 1,882: | Line 997: | ||
struct Metrics | struct Metrics | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}; | }; | ||
Line 1,904: | Line 1,006: | ||
Metrics &metrics) | Metrics &metrics) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 1,967: | Line 1,025: | ||
LXtFVector hsv) | LXtFVector hsv) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,011: | Line 1,032: | ||
rangeWorker(NULL) | rangeWorker(NULL) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,062: | Line 1,050: | ||
const char **type) | const char **type) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,078: | Line 1,059: | ||
float *maxValue) | float *maxValue) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,095: | Line 1,067: | ||
float *rgb) | float *rgb) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
} | } | ||
Line 2,105: | Line 1,075: | ||
float *hsv) | float *hsv) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
} | } | ||
Line 2,120: | Line 1,088: | ||
HueRGBtoRYB (float hue) | HueRGBtoRYB (float hue) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,151: | Line 1,097: | ||
HueRYBtoRGB (float hue) | HueRYBtoRGB (float hue) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,193: | Line 1,110: | ||
typedef struct st_HSVColorModelDrawSlice_env | typedef struct st_HSVColorModelDrawSlice_env | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} HSVColorModelDrawSlice_env; | } HSVColorModelDrawSlice_env; | ||
Line 2,207: | Line 1,118: | ||
void *sharedData) | void *sharedData) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,306: | Line 1,128: | ||
const float *vec) | const float *vec) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
class RGBColor | class RGBColor | ||
{ | { | ||
− | + | ... | |
− | + | ||
}; | }; | ||
class Point2D | class Point2D | ||
{ | { | ||
− | + | ... | |
− | + | ||
}; | }; | ||
Line 2,512: | Line 1,149: | ||
const float *hsv) | const float *hsv) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,797: | Line 1,159: | ||
const float *newVec) | const float *newVec) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,827: | Line 1,176: | ||
unsigned *imgY) | unsigned *imgY) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 2,922: | Line 1,198: | ||
float *hsv) | float *hsv) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,030: | Line 1,212: | ||
float *hsv) | float *hsv) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,053: | Line 1,218: | ||
CHSVColorModel::HueAxisOnStrip () | CHSVColorModel::HueAxisOnStrip () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 3,059: | Line 1,224: | ||
CHSVColorModel::HueAsWheel () | CHSVColorModel::HueAsWheel () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 3,065: | Line 1,230: | ||
CHSVColorModel::Wheel () | CHSVColorModel::Wheel () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 3,071: | Line 1,236: | ||
CHSVColorModel::Rule () | CHSVColorModel::Rule () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 3,077: | Line 1,242: | ||
CHSVColorModel::RuleAdjust () | CHSVColorModel::RuleAdjust () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,116: | Line 1,248: | ||
CHSVColorModel::PresetRuleAdjust () | CHSVColorModel::PresetRuleAdjust () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,145: | Line 1,254: | ||
CHSVColorModel::Levels () | CHSVColorModel::Levels () | ||
{ | { | ||
− | + | ... | |
} | } | ||
Line 3,151: | Line 1,260: | ||
CHSVColorModel::SwatchCount () | CHSVColorModel::SwatchCount () | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,199: | Line 1,269: | ||
unsigned &baseColorIndex) | unsigned &baseColorIndex) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,268: | Line 1,281: | ||
unsigned &baseColorIndex) | unsigned &baseColorIndex) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,299: | Line 1,293: | ||
unsigned &baseColorIndex) | unsigned &baseColorIndex) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,341: | Line 1,305: | ||
unsigned &baseColorIndex) | unsigned &baseColorIndex) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,383: | Line 1,317: | ||
unsigned &baseColorIndex) | unsigned &baseColorIndex) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,436: | Line 1,329: | ||
unsigned &baseColorIndex) | unsigned &baseColorIndex) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,498: | Line 1,341: | ||
unsigned &baseColorIndex) | unsigned &baseColorIndex) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
Line 3,522: | Line 1,353: | ||
unsigned &baseColorIndex) | unsigned &baseColorIndex) | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
}</pre> | }</pre> | ||
Line 3,547: | Line 1,365: | ||
typedef struct st_HSVColorModelDrawSlice_env | typedef struct st_HSVColorModelDrawSlice_env | ||
{ | { | ||
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} HSVColorModelDrawSlice_env; | } HSVColorModelDrawSlice_env; | ||
Line 3,560: | Line 1,372: | ||
int index, | int index, | ||
void *sharedData) | void *sharedData) | ||
− | { | + | { |
− | + | ... | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
</pre> | </pre> |
Latest revision as of 15:26, 27 July 2015
Color_Model_HSV is a basic example plugin. This wiki page is intended as a walkthrough of the code in order to help you better understand the SDK.
When installed, this plugin adds a color model that enables picking colors using hue, saturation, and value color components.
The HSV color model.
Contents
Code Walkthrough
Class Declarations
This function allows the plugin to write to the log through by inheriting from the CLxLuxologyLogMessage class.
extern const char* SERVER_HSV_COLOR_MODEL;
class CHSVColorModelLog : public CLxLuxologyLogMessage { public: CHSVColorModelLog () : CLxLuxologyLogMessage (SERVER_HSV_COLOR_MODEL) { } const char * GetFormat () { return "HSV Color Model"; } };
These functions are basic commands that perform certain actions in running/setting up the color model. They have the general functions for the basic command class(Cmd_Flags, Enable, Notifier, Execute, and Query).
class CHueAsWheelHSVColorModelCommand : public CLxBasicCommand { public: CHueAsWheelHSVColorModelCommand (); virtual ~CHueAsWheelHSVColorModelCommand () {} int basic_CmdFlags () LXx_OVERRIDE; bool basic_Notifier (int index, std::string &name, std::string &args) LXx_OVERRIDE; bool basic_Enable (CLxUser_Message &msg) LXx_OVERRIDE; void cmd_Execute (unsigned int flags) LXx_OVERRIDE; LxResult cmd_Query (unsigned int index, ILxUnknownID vaQuery) LXx_OVERRIDE; }; class CWheelHSVColorModelCommand : public CLxBasicCommand { public: CWheelHSVColorModelCommand (); virtual ~CWheelHSVColorModelCommand () {} int basic_CmdFlags () LXx_OVERRIDE; bool basic_Notifier (int index, std::string &name, std::string &args) LXx_OVERRIDE; bool basic_Enable (CLxUser_Message &msg) LXx_OVERRIDE; void cmd_Execute (unsigned int flags) LXx_OVERRIDE; LxResult cmd_Query (unsigned int index, ILxUnknownID vaQuery) LXx_OVERRIDE; void atrui_UIHints (unsigned int index, CLxUser_UIHints &hints) LXx_OVERRIDE; }; class CRuleHSVColorModelCommand : public CLxBasicCommand { public: CRuleHSVColorModelCommand (); virtual ~CRuleHSVColorModelCommand () {} int basic_CmdFlags () LXx_OVERRIDE; bool basic_Notifier (int index, std::string &name, std::string &args) LXx_OVERRIDE; bool basic_Enable (CLxUser_Message &msg) LXx_OVERRIDE; void cmd_Execute (unsigned int flags) LXx_OVERRIDE; LxResult cmd_Query (unsigned int index, ILxUnknownID vaQuery) LXx_OVERRIDE; void atrui_UIHints (unsigned int index, CLxUser_UIHints &hints) LXx_OVERRIDE; }; class CRuleAdjustHSVColorModelCommand : public CLxBasicCommand { public: CRuleAdjustHSVColorModelCommand (); virtual ~CRuleAdjustHSVColorModelCommand () {} int basic_CmdFlags () LXx_OVERRIDE; bool basic_Notifier (int index, std::string &name, std::string &args) LXx_OVERRIDE; bool basic_Enable (CLxUser_Message &msg) LXx_OVERRIDE; void cmd_Execute (unsigned int flags) LXx_OVERRIDE; LxResult cmd_Query (unsigned int index, ILxUnknownID vaQuery) LXx_OVERRIDE; void atrui_UIHints (unsigned int index, CLxUser_UIHints &hints) LXx_OVERRIDE; }; class CLevelsHSVColorModelCommand : public CLxBasicCommand { public: CLevelsHSVColorModelCommand (); virtual ~CLevelsHSVColorModelCommand () {} int basic_CmdFlags () LXx_OVERRIDE; bool basic_Notifier (int index, std::string &name, std::string &args) LXx_OVERRIDE; bool basic_Enable (CLxUser_Message &msg) LXx_OVERRIDE; void cmd_Execute (unsigned int flags) LXx_OVERRIDE; LxResult cmd_Query (unsigned int index, ILxUnknownID vaQuery) LXx_OVERRIDE; void atrui_UIHints (unsigned int index, CLxUser_UIHints &hints) LXx_OVERRIDE; }; class CSaveAsPresetsHSVColorModelCommand : public CLxBasicCommand { public: CSaveAsPresetsHSVColorModelCommand (); virtual ~CSaveAsPresetsHSVColorModelCommand () {} int basic_CmdFlags () LXx_OVERRIDE; bool basic_Notifier (int index, std::string &name, std::string &args) LXx_OVERRIDE; bool basic_Enable (CLxUser_Message &msg) LXx_OVERRIDE; void cmd_Execute (unsigned int flags) LXx_OVERRIDE; LxResult cmd_Query (unsigned int index, ILxUnknownID vaQuery) LXx_OVERRIDE; void atrui_UIHints (unsigned int index, CLxUser_UIHints &hints) LXx_OVERRIDE; };
This function is a notifier which goes off when changes to the color model occur.
class CHSVColorModelNotifier : public CLxCommandNotifier { public: CHSVColorModelNotifier (); virtual ~CHSVColorModelNotifier () {} virtual void cn_Parse (std::string &args); virtual unsigned int cn_Flags (int code); };
This code block is an enumerated type that set the values corresponding to the different type of wheels.
enum { HSV_WHEEL_RGB, // Red, green, and blue is triadic. HSV_WHEEL_RYB // Red, yellow, and blue is triadic. };
This code black is an enumerated type that set the values corresponding to the rules related to building swatches.
enum {
HSV_RULE_SOLO, // Just the selected color. HSV_RULE_COMPLEMENTARY, // Selected color and its opposite. HSV_RULE_ANALOGOUS, // Adjacent colors. HSV_RULE_TRIADIC, // Three colors at 120 degree stops. HSV_RULE_TETRADIC, // Four colors at 45 degree stops. HSV_RULE_COMPOUND, // Five colors at 30 and 45 degree stops. HSV_RULE_TINTS, // Tinted variations. HSV_RULE_SHADES // Shaded variations.
};
This is the main function from which the color model will be built. It inherits from CLxImpl_ColorModel because it has the functions we need in order to create our color model, which we want the CHSVColorModel to create. Inside the class the functions with the colm prefix perform changes on the color model(the change is usually explained by the rest of the name. The functions without any special prefix either create the name of their function or query a value with its name. The rest of the functions have the Build prefix and build a certain type of swatch made obvious by the rest of the name.
class CHSVColorModel : public CLxImpl_ColorModel { CHSVColorModelLog m_log; ILxUnknownID rangeWorker; public: static LXtTagInfoDesc descInfo[]; CLxPolymorph<CHSVColorModelThreadRangeWorker> range_factory; CHSVColorModel (); virtual ~CHSVColorModel (); virtual int colm_NumComponents (void) LXx_OVERRIDE; virtual LxResult colm_ComponentType ( unsigned componentIndex, const char **type) LXx_OVERRIDE; virtual LxResult colm_ComponentRange ( unsigned componentIndex, float *minValue, float *maxValue) LXx_OVERRIDE; virtual LxResult colm_ToRGB ( const float *hsv, float *rgb) LXx_OVERRIDE; virtual LxResult colm_FromRGB ( const float *rgb, float *hsv) LXx_OVERRIDE; virtual LxResult colm_DrawSlice ( ILxUnknownID image, unsigned xAxis, unsigned yAxis, const float *vec) LXx_OVERRIDE; virtual LxResult colm_DrawSliceMarker ( ILxUnknownID image, unsigned xAxis, unsigned yAxis, const float *downVec, const float *hsv) LXx_OVERRIDE; virtual LxResult colm_CanSliceBeReused ( unsigned xAxis, unsigned yAxis, const float *oldVec, const float *newVec) LXx_OVERRIDE; virtual LxResult colm_ToSlicePos ( unsigned xAxis, unsigned yAxis, unsigned imgW, unsigned imgH, const float *hsv, unsigned *imgX, unsigned *imgY) LXx_OVERRIDE; virtual LxResult colm_FromSlicePos ( unsigned xAxis, unsigned yAxis, unsigned imgW, unsigned imgH, unsigned imgX, unsigned imgY, float *downVec, float *hsv) LXx_OVERRIDE; virtual LxResult colm_StripBaseVector ( unsigned axis, int dynamic, float *hsv) LXx_OVERRIDE; static bool HueAxisOnStrip (); static bool HueAsWheel (); static unsigned Wheel (); static unsigned Rule (); static float RuleAdjust (); static float PresetRuleAdjust (); static unsigned Levels (); static unsigned SwatchCount (); static void BuildSwatches ( const HSVColor &baseColor, std::vector<HSVColor> &swatchColors, unsigned &baseColorIndex); private: static void BuildComplementarySwatches ( const HSVColor &baseColor, std::vector<HSVColor> &swatchColors, unsigned &baseColorIndex); static void BuildAnalogousSwatches ( const HSVColor &baseColor, std::vector<HSVColor> &swatchColors, unsigned &baseColorIndex); static void BuildTriadicSwatches ( const HSVColor &baseColor, std::vector<HSVColor> &swatchColors, unsigned &baseColorIndex); static void BuildTetradicSwatches ( const HSVColor &baseColor, std::vector<HSVColor> &swatchColors, unsigned &baseColorIndex); static void BuildCompoundSwatches ( const HSVColor &baseColor, std::vector<HSVColor> &swatchColors, unsigned &baseColorIndex); static void BuildTintsSwatches ( const HSVColor &baseColor, std::vector<HSVColor> &swatchColors, unsigned &baseColorIndex); static void BuildShadesSwatches ( const HSVColor &baseColor, std::vector<HSVColor> &swatchColors, unsigned &baseColorIndex); CLxUser_Image primary_marker; CLxUser_Image secondary_marker; };
Initialization
This function initializes each server, or in other words tells Modo that this plugin will be adding certain features.
void initialize () { // Color Model server. LXx_ADD_SERVER (ColorModel, CHSVColorModel, SERVER_HSV_COLOR_MODEL); CLxGenericPolymorph *srv; // Hue As Wheel command. srv = new CLxPolymorph<CHueAsWheelHSVColorModelCommand>; srv->AddInterface (new CLxIfc_Command <CHueAsWheelHSVColorModelCommand>); srv->AddInterface (new CLxIfc_Attributes<CHueAsWheelHSVColorModelCommand>); thisModule.AddServer ("color.hsvHueAsWheel", srv); // Wheel command. srv = new CLxPolymorph<CWheelHSVColorModelCommand>; srv->AddInterface (new CLxIfc_Command <CWheelHSVColorModelCommand>); srv->AddInterface (new CLxIfc_Attributes<CWheelHSVColorModelCommand>); srv->AddInterface (new CLxIfc_AttributesUI<CWheelHSVColorModelCommand>); thisModule.AddServer ("color.hsvWheel", srv); // Rule command. srv = new CLxPolymorph<CRuleHSVColorModelCommand>; srv->AddInterface (new CLxIfc_Command <CRuleHSVColorModelCommand>); srv->AddInterface (new CLxIfc_Attributes<CRuleHSVColorModelCommand>); srv->AddInterface (new CLxIfc_AttributesUI<CRuleHSVColorModelCommand>); thisModule.AddServer ("color.hsvRule", srv); // Rule Adjust command. srv = new CLxPolymorph<CRuleAdjustHSVColorModelCommand>; srv->AddInterface (new CLxIfc_Command <CRuleAdjustHSVColorModelCommand>); srv->AddInterface (new CLxIfc_Attributes<CRuleAdjustHSVColorModelCommand>); srv->AddInterface (new CLxIfc_AttributesUI<CRuleAdjustHSVColorModelCommand>); thisModule.AddServer ("color.hsvRuleAdjust", srv); // Levels command. srv = new CLxPolymorph<CLevelsHSVColorModelCommand>; srv->AddInterface (new CLxIfc_Command <CLevelsHSVColorModelCommand>); srv->AddInterface (new CLxIfc_Attributes<CLevelsHSVColorModelCommand>); srv->AddInterface (new CLxIfc_AttributesUI<CLevelsHSVColorModelCommand>); thisModule.AddServer ("color.hsvLevels", srv); // Save as Presets command. srv = new CLxPolymorph<CSaveAsPresetsHSVColorModelCommand>; srv->AddInterface (new CLxIfc_Command <CSaveAsPresetsHSVColorModelCommand>); srv->AddInterface (new CLxIfc_Attributes<CSaveAsPresetsHSVColorModelCommand>); srv->AddInterface (new CLxIfc_AttributesUI<CSaveAsPresetsHSVColorModelCommand>); thisModule.AddServer ("color.hsvSaveAsPresets", srv); // Notifier. srv = new CLxPolymorph<CHSVColorModelNotifier>; srv->AddInterface (new CLxIfc_Notifier<CHSVColorModelNotifier>); thisModule.AddServer (HSV_COLOR_MODEL_NOTIFIER, srv); }
This function cleans up the persistent data
void cleanup () { if (persist) { delete persist; } }
Helper Functions
These are conversion utilities that will be used later on in implementing the class functions.
string IntegerToString ( unsigned value, unsigned padding = 0, bool asHexadecimal = false, bool withHexPrefix = false) { ... } const float PI = 3.1415926535897932384626433832795f; const float TWO_PI = PI * 2.0f; // 360 degrees const float TWO_PI_OVER_THREE = TWO_PI / 3.0f; // 120 degrees const float HALF_PI = PI * 0.5f; // 90 degrees const float THIRD_PI = PI / 3.0f; // 60 degrees const float SIXTH_PI = PI / 6.0f; // 30 degrees const float QUARTER_PI = PI * 0.25f; // 45 degrees #define _R rgb[0] #define _G rgb[1] #define _B rgb[2] #define _H hsv[0] #define _S hsv[1] #define _V hsv[2] /* * rgb in [0, 1]; h in [0, TWO_PI], s and v in [0, 1] */ static void RGB2HSV ( const float *rgb, float *hsv) { ... } /* * rgb in [0, 1]; h in [0, TWO_PI], s and v in [0, 1] */ static void HSV2RGB ( const float *hsv, float *rgb) { ... }
These are utilities that retrieve the values in certain argument indeces.
const unsigned MAX_COMMAND_VALUE_LEN = 256; static string QueryCommandString (const char *cmdName, const char *argName) { ... } static int QueryCommandInt (const char *cmdName, int defaultValue = 0) { ... static double QueryCommandFloat (const char *cmdName, double defaultValue = 0.0) { ... }
This function takes a string and executes a command with a name that matches that string.
ExecuteCommand (const char *cmdName) { ... }
This code block is a set of helper functions that Query a series of color.value commands, to retrieve the selected base color's component values, from which the rule-based color swatches will be built and Execute the color.presetSaveWithModel commmand, to generate a preset for the given swatch. These are then used for the cmd_Execute of CSaveAsPresetsHSVColorModelCommand
static bool QueryColorValueCmd ( HSVColor &baseColor) { ... } static bool QueryPBViewPathCmd ( string &path) { ... } /* * Execute the color.presetSaveWithModel commmand, * to generate a preset for the given swatch. */ static void ExecuteHSVPresetSaveWithModelCmd ( const HSVColor &hsvColor, unsigned swatchIndex, string &swatchPath) { ... }
This function resizes wheel and rule swatches.
static void ResizeWheelAndRuleSwatches ( unsigned sliceWidth, unsigned sliceHeight, Metrics &metrics) { ... }
This function returns whether or not the given image (X, Y) coordinates are tracking within a swatch.
static bool TrackSwatch ( Metrics &metrics, unsigned xAxis, unsigned yAxis, unsigned imageWidth, unsigned imageHeight, unsigned imageX, unsigned imageY, LXtFVector downVec, LXtFVector hsv) { ... }
These are helper functions that Remap an HSV hue such that red, yellow, and blue are triadic, instead of red, green, and blue and perform the reverse.
static inline float HueRGBtoRYB (float hue) { ... } /* * The inverse of HueRGBtoRYB. */ static inline float HueRYBtoRGB (float hue) { ... }
Persistent Data
This is a struct that holds the persistent data of the color model
struct CHSVColorModelPersist { ... };
This is a function that visits every attribute in the struct above and sets its value to that of the matching persistent data object.
class CHSVColorModelPersistVisitor : public CLxImpl_AbstractVisitor { ... }; static const char* ATOM_TAG_HUE_AS_WHEEL = "hsv.hue.as.wheel"; static const char* ATOM_TAG_WHEEL = "hsv.wheel"; static const char* ATOM_TAG_RULE = "hsv.rule"; static const char* ATOM_TAG_RULE_ADJUST_COMPLEMENTARY = "hsv.rule.adjust_complementary"; static const char* ATOM_TAG_RULE_ADJUST_ANALOGOUS = "hsv.rule.adjust_analogous"; static const char* ATOM_TAG_RULE_ADJUST_TRIADIC = "hsv.rule.adjust_triadic"; static const char* ATOM_TAG_RULE_ADJUST_TETRADIC = "hsv.rule.adjust_tetradic"; static const char* ATOM_TAG_RULE_ADJUST_COMPOUND = "hsv.rule.adjust_compound"; static const char* ATOM_TAG_LEVELS = "hsv.levels"; LxResult CHSVColorModelPersistVisitor::Evaluate () { ... }
This function is a notifier with flags that have it go off whenever a value changes or if the command is not working.
static const char *HSV_COLOR_MODEL_NOTIFIER = "hsv.color.model.notifier"; CHSVColorModelNotifier::CHSVColorModelNotifier () : CLxCommandNotifier (HSV_COLOR_MODEL_NOTIFIER) { } void CHSVColorModelNotifier::cn_Parse (string &args) { } unsigned int CHSVColorModelNotifier::cn_Flags (int code) { ... }
This section implements the functions of the CHueAsWheelColorModelCommand class. Its constructor sets it so that it takes a boolean value. The CmdFlags function indicates that the command affects the command ui. The notifier goes off whenever the notifier(http://modo.sdk.thefoundry.co.uk/wiki/Notifier_Object) in 407-424 goes off or the selected color has changed. The enables command enables the command if the strip is not set to the hue axis. The cmd_execute portion is the actual command. Cmd_Query asks for the value of a relevant argument index.
#define LXsCOMMAND_COLOR_UPDATE_VIEW "color.updateView" #define LXsCOMMAND_COLOR_MODEL_AXIS "color.modelAxis" enum { ... }; const bool PRESET_HSV_HUE_AS_WHEEL = true; CHueAsWheelHSVColorModelCommand::CHueAsWheelHSVColorModelCommand () { ... } int CHueAsWheelHSVColorModelCommand::basic_CmdFlags () { ... } bool CHueAsWheelHSVColorModelCommand::basic_Notifier ( int index, string &name, string &args) { ... } bool CHueAsWheelHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) { ... } enum { ... }; void CHueAsWheelHSVColorModelCommand::cmd_Execute (unsigned int flags) { ... } LxResult CHueAsWheelHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) { ... }
This code block implements the same basic set of functions for the rest of the basic commands plus the atrui_UIHints function, which creates some relevant ui hints.
enum { ... }; const int PRESET_HSV_WHEEL = 0; static LXtTextValueHint hint_hsvWheel[] = { ... }; CWheelHSVColorModelCommand::CWheelHSVColorModelCommand () { ... } int CWheelHSVColorModelCommand::basic_CmdFlags () { ... } bool CWheelHSVColorModelCommand::basic_Notifier ( int index, string &name, string &args) { ... } bool CWheelHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) { ... } void CWheelHSVColorModelCommand::cmd_Execute (unsigned int flags) { ... } LxResult CWheelHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) { ... } void CWheelHSVColorModelCommand::atrui_UIHints ( unsigned int index, CLxUser_UIHints &hints) { } /* * --------------------------------------------------------------------------- * CRuleHSVColorModelCommand */ enum { ... }; const int PRESET_HSV_RULE = 0; static LXtTextValueHint hint_hsvRule[] = { ... }; CRuleHSVColorModelCommand::CRuleHSVColorModelCommand () { ... } int CRuleHSVColorModelCommand::basic_CmdFlags () { ... } bool CRuleHSVColorModelCommand::basic_Notifier ( int index, string &name, string &args) { ... } bool CRuleHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) { ... } void CRuleHSVColorModelCommand::cmd_Execute (unsigned int flags) { ... } LxResult CRuleHSVColorModelCommand::cmd_Query ( unsigned int index, ILxUnknownID vaQuery) { ... } void CRuleHSVColorModelCommand::atrui_UIHints ( unsigned int index, CLxUser_UIHints &hints) { } /* * --------------------------------------------------------------------------- * CRuleAdjustHSVColorModelCommand */ enum { ... }; /* * Preset rule adjust values vary by rule. */ const double DEG2RAD = 0.017453292519943295769236907684886; const double PRESET_HSV_RULE_ADJUST_COMPLEMENTARY = 180.0 * DEG2RAD; const double PRESET_HSV_RULE_ADJUST_ANALOGOUS = 30.0 * DEG2RAD; const double PRESET_HSV_RULE_ADJUST_TRIADIC = 120.0 * DEG2RAD; const double PRESET_HSV_RULE_ADJUST_TETRADIC = 45.0 * DEG2RAD; const double PRESET_HSV_RULE_ADJUST_COMPOUND = 30.0 * DEG2RAD; CRuleAdjustHSVColorModelCommand::CRuleAdjustHSVColorModelCommand () { ... } int CRuleAdjustHSVColorModelCommand::basic_CmdFlags () { ... } bool CRuleAdjustHSVColorModelCommand::basic_Notifier ( int index, string &name, string &args) { ... } bool CRuleAdjustHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) { ... } void CRuleAdjustHSVColorModelCommand::cmd_Execute (unsigned int flags) { ... } LxResult CRuleAdjustHSVColorModelCommand::cmd_Query ( unsigned int index, ILxUnknownID vaQuery) { ... } void CRuleAdjustHSVColorModelCommand::atrui_UIHints ( unsigned int index, CLxUser_UIHints &hints) { ... } /* * --------------------------------------------------------------------------- * CLevelsHSVColorModelCommand */ enum { ... }; const int PRESET_HSV_LEVELS = 11; CLevelsHSVColorModelCommand::CLevelsHSVColorModelCommand () { ... } int CLevelsHSVColorModelCommand::basic_CmdFlags () { ... } bool CLevelsHSVColorModelCommand::basic_Notifier ( int index, string &name, string &args) { ... } bool CLevelsHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) { ... } void CLevelsHSVColorModelCommand::cmd_Execute (unsigned int flags) { ... } LxResult CLevelsHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) { ... } void CLevelsHSVColorModelCommand::atrui_UIHints ( unsigned int index, CLxUser_UIHints &hints) { ... } /* * --------------------------------------------------------------------------- * CSaveAsPresetsHSVColorModelCommand */ enum { ... }; CSaveAsPresetsHSVColorModelCommand::CSaveAsPresetsHSVColorModelCommand () { ... } int CSaveAsPresetsHSVColorModelCommand::basic_CmdFlags () { ... } bool CSaveAsPresetsHSVColorModelCommand::basic_Notifier ( int index, string &name, string &args) { ... } bool CSaveAsPresetsHSVColorModelCommand::basic_Enable (CLxUser_Message &msg) { ... } /* * Query a series of color.value commands, to retrieve the selected * base color's component values, from which the rule-based color * swatches will be built. */ static bool QueryColorValueCmd ( HSVColor &baseColor) { ... } static bool QueryPBViewPathCmd ( string &path) { ... } /* * Execute the color.presetSaveWithModel commmand, * to generate a preset for the given swatch. */ static void ExecuteHSVPresetSaveWithModelCmd ( const HSVColor &hsvColor, unsigned swatchIndex, string &swatchPath) { ... } void CSaveAsPresetsHSVColorModelCommand::cmd_Execute (unsigned int flags) { ... } LxResult CSaveAsPresetsHSVColorModelCommand::cmd_Query (unsigned int index, ILxUnknownID vaQuery) { ... } void CSaveAsPresetsHSVColorModelCommand::atrui_UIHints ( unsigned int index, CLxUser_UIHints &hints) { ... }
This code block implements all the functions for the CHSVColorModel model object class. The utility of each specific function I described above in documenting their declaration.
LXtTagInfoDesc CHSVColorModel::descInfo[] = { { LXsLOD_CLASSLIST, LXa_COLORMODEL }, { LXsSRV_USERNAME, "HSV" }, { LXsSRV_LOGSUBSYSTEM, SERVER_HSV_COLOR_MODEL }, { 0 } }; /* * The minimum margin in pixels on all sides. */ const float HUE_WHEEL_MARGIN = 5.0f; /* * The percentage of the major dimension to use for rule-based swatches. */ const float MINIMUM_SWATCH_SIZE = 0.15f; /* * Aspect ratio. */ enum { WHEEL_ASPECT_HORIZONTAL, WHEEL_ASPECT_VERTICAL }; struct Metrics { ... }; static void ResizeWheelAndRuleSwatches ( unsigned sliceWidth, unsigned sliceHeight, Metrics &metrics) { ... } /* * Return whether or not the given image (X, Y) coordinates are * tracking within a swatch. */ static bool TrackSwatch ( Metrics &metrics, unsigned xAxis, unsigned yAxis, unsigned imageWidth, unsigned imageHeight, unsigned imageX, unsigned imageY, LXtFVector downVec, LXtFVector hsv) { ... } CHSVColorModel::CHSVColorModel () : rangeWorker(NULL) { ... } CHSVColorModel::~CHSVColorModel () { } int CHSVColorModel::colm_NumComponents (void) { return 3; // H, S, and V } LxResult CHSVColorModel::colm_ComponentType ( unsigned componentIndex, const char **type) { ... } LxResult CHSVColorModel::colm_ComponentRange ( unsigned componentIndex, float *minValue, float *maxValue) { ... } LxResult CHSVColorModel::colm_ToRGB ( const float *hsv, float *rgb) { ... } LxResult CHSVColorModel::colm_FromRGB ( const float *rgb, float *hsv) { ... } #define LERP(a,l,h) ((l) + (((h) - (l)) * (a))) const float DEG2RADF = static_cast<float>(DEG2RAD); /* * Remap an HSV hue such that red, yellow, and blue are triadic, * instead of red, green, and blue. */ static inline float HueRGBtoRYB (float hue) { ... } /* * The inverse of HueRGBtoRYB. */ static inline float HueRYBtoRGB (float hue) { ... } CHSVColorModelThreadRangeWorker::CHSVColorModelThreadRangeWorker () { } CHSVColorModelThreadRangeWorker::~CHSVColorModelThreadRangeWorker () { } typedef struct st_HSVColorModelDrawSlice_env { ... } HSVColorModelDrawSlice_env; LxResult CHSVColorModelThreadRangeWorker::rngw_Execute ( int index, void *sharedData) { ... } LxResult CHSVColorModel::colm_DrawSlice ( ILxUnknownID image, unsigned xAxis, unsigned yAxis, const float *vec) { ... } class RGBColor { ... }; class Point2D { ... }; LxResult CHSVColorModel::colm_DrawSliceMarker ( ILxUnknownID image, unsigned xAxis, unsigned yAxis, const float *downVec, const float *hsv) { ... } LxResult CHSVColorModel::colm_CanSliceBeReused ( unsigned xAxis, unsigned yAxis, const float *oldVec, const float *newVec) { ... } /* * Calculate imgX and imgY in [0, imgW], [0, imgH], from hsv color * components on the plane specified by xAxis, yAxis. */ LxResult CHSVColorModel::colm_ToSlicePos ( unsigned xAxis, unsigned yAxis, unsigned imgW, unsigned imgH, const float *hsv, unsigned *imgX, unsigned *imgY) { ... } /* * Calculate color model components hsv using imgX and imgY in [0, 1], * on the plane specified by xAxis, yAxis. * * NOTE: The other axis (the one that is neither x nor y) component value * should already be set by the last bar selection or the initial * color load. */ LxResult CHSVColorModel::colm_FromSlicePos ( unsigned xAxis, unsigned yAxis, unsigned imgW, unsigned imgH, unsigned imgX, unsigned imgY, float *downVec, float *hsv) { ... } /* * Return a clean vector so the color picker can drawn the horizontal * strip properly. For hue, this is 0, 1, 1, for saturation we set the * value to 1 but leave the rest alone, and for value we set the hue to zero. */ LxResult CHSVColorModel::colm_StripBaseVector ( unsigned axis, int dynamic, float *hsv) { ... } bool CHSVColorModel::HueAxisOnStrip () { ... } bool CHSVColorModel::HueAsWheel () { ... } unsigned CHSVColorModel::Wheel () { ... } unsigned CHSVColorModel::Rule () { ... } float CHSVColorModel::RuleAdjust () { ... } float CHSVColorModel::PresetRuleAdjust () { ... } unsigned CHSVColorModel::Levels () { ... } unsigned CHSVColorModel::SwatchCount () { ... } void CHSVColorModel::BuildSwatches ( const HSVColor &baseColor, vector<HSVColor> &swatchColors, unsigned &baseColorIndex) { ... } /* * Selected color and its opposite. */ void CHSVColorModel::BuildComplementarySwatches ( const HSVColor &baseColor, vector<HSVColor> &swatchColors, unsigned &baseColorIndex) { ... } /* * Adjacent colors. */ void CHSVColorModel::BuildAnalogousSwatches ( const HSVColor &baseColor, vector<HSVColor> &swatchColors, unsigned &baseColorIndex) { ... } /* * Three colors at 120 degree stops. */ void CHSVColorModel::BuildTriadicSwatches ( const HSVColor &baseColor, vector<HSVColor> &swatchColors, unsigned &baseColorIndex) { ... } /* * Four colors at 45 degree stops. */ void CHSVColorModel::BuildTetradicSwatches ( const HSVColor &baseColor, vector<HSVColor> &swatchColors, unsigned &baseColorIndex) { ... } /* * Five colors at 30 and 45 degree stops. */ void CHSVColorModel::BuildCompoundSwatches ( const HSVColor &baseColor, vector<HSVColor> &swatchColors, unsigned &baseColorIndex) { ... } /* * Variations by tint. */ void CHSVColorModel::BuildTintsSwatches ( const HSVColor &baseColor, vector<HSVColor> &swatchColors, unsigned &baseColorIndex) { ... } /* * Variations by shade. */ void CHSVColorModel::BuildShadesSwatches ( const HSVColor &baseColor, vector<HSVColor> &swatchColors, unsigned &baseColorIndex) { ... }
This code block implements the functions of the CHSVColorModelThreadRangeWorker class
CHSVColorModelThreadRangeWorker::~CHSVColorModelThreadRangeWorker () { } typedef struct st_HSVColorModelDrawSlice_env { ... } HSVColorModelDrawSlice_env; LxResult CHSVColorModelThreadRangeWorker::rngw_Execute ( int index, void *sharedData) { ... }