本文整理汇总了C++中app::Color::getHue方法的典型用法代码示例。如果您正苦于以下问题:C++ Color::getHue方法的具体用法?C++ Color::getHue怎么用?C++ Color::getHue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app::Color
的用法示例。
在下文中一共展示了Color::getHue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onSetColor
void HsvSliders::onSetColor(const app::Color& color)
{
setAbsSliderValue(0, color.getHue());
setAbsSliderValue(1, color.getSaturation());
setAbsSliderValue(2, color.getValue());
setAbsSliderValue(3, color.getAlpha());
}
示例2: pickSample
void EyedropperCommand::pickSample(const doc::Site& site,
const gfx::Point& pixelPos,
app::Color& color)
{
// Check if we've to grab alpha channel or the merged color.
Preferences& pref = Preferences::instance();
bool allLayers =
(pref.eyedropper.sample() == app::gen::EyedropperSample::ALL_LAYERS);
ColorPicker picker;
picker.pickColor(site,
pixelPos,
(allLayers ?
ColorPicker::FromComposition:
ColorPicker::FromActiveLayer));
app::gen::EyedropperChannel channel =
pref.eyedropper.channel();
app::Color picked = picker.color();
switch (channel) {
case app::gen::EyedropperChannel::COLOR_ALPHA:
color = picked;
break;
case app::gen::EyedropperChannel::COLOR:
if (picked.getAlpha() > 0)
color = app::Color::fromRgb(picked.getRed(),
picked.getGreen(),
picked.getBlue(),
color.getAlpha());
break;
case app::gen::EyedropperChannel::ALPHA:
switch (color.getType()) {
case app::Color::RgbType:
case app::Color::IndexType:
color = app::Color::fromRgb(color.getRed(),
color.getGreen(),
color.getBlue(),
picked.getAlpha());
break;
case app::Color::HsvType:
color = app::Color::fromHsv(color.getHue(),
color.getSaturation(),
color.getValue(),
picked.getAlpha());
break;
case app::Color::GrayType:
color = app::Color::fromGray(color.getGray(),
picked.getAlpha());
break;
}
break;
case app::gen::EyedropperChannel::RGBA:
if (picked.getType() == app::Color::RgbType)
color = picked;
else
color = app::Color::fromRgb(picked.getRed(),
picked.getGreen(),
picked.getBlue(),
picked.getAlpha());
break;
case app::gen::EyedropperChannel::RGB:
if (picked.getAlpha() > 0)
color = app::Color::fromRgb(picked.getRed(),
picked.getGreen(),
picked.getBlue(),
color.getAlpha());
break;
case app::gen::EyedropperChannel::HSVA:
if (picked.getType() == app::Color::HsvType)
color = picked;
else
color = app::Color::fromHsv(picked.getHue(),
picked.getSaturation(),
picked.getValue(),
picked.getAlpha());
break;
case app::gen::EyedropperChannel::HSV:
if (picked.getAlpha() > 0)
color = app::Color::fromHsv(picked.getHue(),
picked.getSaturation(),
picked.getValue(),
color.getAlpha());
break;
case app::gen::EyedropperChannel::GRAYA:
if (picked.getType() == app::Color::GrayType)
color = picked;
else
color = app::Color::fromGray(picked.getGray(),
picked.getAlpha());
break;
case app::gen::EyedropperChannel::GRAY:
if (picked.getAlpha() > 0)
color = app::Color::fromGray(picked.getGray(),
color.getAlpha());
//.........这里部分代码省略.........
示例3: setAbsolutePaletteEntryChannel
void PaletteEntryEditor::setAbsolutePaletteEntryChannel(ColorSliders::Channel channel, const app::Color& color)
{
PalettePicks entries;
getPicks(entries);
int picksCount = entries.picks();
uint32_t src_color;
int r, g, b;
Palette* palette = get_current_palette();
for (int c=0; c<palette->size(); c++) {
if (!entries[c])
continue;
// Get the current RGB values of the palette entry
src_color = palette->getEntry(c);
r = rgba_getr(src_color);
g = rgba_getg(src_color);
b = rgba_getb(src_color);
switch (m_type) {
case app::Color::RgbType:
// Modify one entry
if (picksCount == 1) {
r = color.getRed();
g = color.getGreen();
b = color.getBlue();
}
// Modify one channel a set of entries
else {
// Setup the new RGB values depending of the modified channel.
switch (channel) {
case ColorSliders::Red:
r = color.getRed();
case ColorSliders::Green:
g = color.getGreen();
break;
case ColorSliders::Blue:
b = color.getBlue();
break;
}
}
break;
case app::Color::HsvType:
{
Hsv hsv;
// Modify one entry
if (picksCount == 1) {
hsv.hue(color.getHue());
hsv.saturation(double(color.getSaturation()) / 100.0);
hsv.value(double(color.getValue()) / 100.0);
}
// Modify one channel a set of entries
else {
// Convert RGB to HSV
hsv = Hsv(Rgb(r, g, b));
// Only modify the desired HSV channel
switch (channel) {
case ColorSliders::Hue:
hsv.hue(color.getHue());
break;
case ColorSliders::Saturation:
hsv.saturation(double(color.getSaturation()) / 100.0);
break;
case ColorSliders::Value:
hsv.value(double(color.getValue()) / 100.0);
break;
}
}
// Convert HSV back to RGB
Rgb rgb(hsv);
r = rgb.red();
g = rgb.green();
b = rgb.blue();
}
break;
}
palette->setEntry(c, doc::rgba(r, g, b, 255));
}
}