本文整理汇总了C++中ofColor::getHue方法的典型用法代码示例。如果您正苦于以下问题:C++ ofColor::getHue方法的具体用法?C++ ofColor::getHue怎么用?C++ ofColor::getHue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofColor
的用法示例。
在下文中一共展示了ofColor::getHue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: distanceBetween
float distanceBetween(ofColor a,ofColor b) {
float hue = a.getHue()/255.0f *TWO_PI;
float hue2 = b.getHue()/255.0f * TWO_PI;
ofVec3f v1((cos(hue) * a.getSaturation()/255.0f),
(sin(hue) * a.getSaturation()/255.0f), a.getBrightness()/255.0f);
ofVec3f v2((cos(hue2) * b.getSaturation()/255.0f),
(sin(hue2) * b.getSaturation()/255.0f), b.getBrightness()/255.0f);
return v1.distance(v2);
}
示例2: rotateRYB
ofColor rotateRYB(ofColor col,int theta) {
float h = (float) col.getHue()/255.0 * 360;
vector<float> hsb;
hsb.push_back((float) col.getHue()/255.0) ;
hsb.push_back((float) col.getSaturation()/255.0) ;
hsb.push_back((float) col.getBrightness()/255.0) ;
theta %= 360;
float resultHue = 0;
vector<ofVec2f> RYB_WHEEL = getRYB_WHEEL();
for (int i = 0; i < RYB_WHEEL.size() - 1; i++) {
ofVec2f p = RYB_WHEEL[i];
ofVec2f q = RYB_WHEEL[i + 1];
if (q.y < p.y) {
q.y += 360;
}
if (p.y <= h && h <= q.y) {
resultHue = p.x + (q.x - p.x) * (h - p.y) / (q.y - p.y);
break;
}
}
//fmod = %, ie remainder
// And the user-given angle (e.g. complement).
resultHue = fmod((resultHue + theta),360);
// For the given angle, find out what hue is
// located there on the artistic color wheel.
for (int i = 0; i < RYB_WHEEL.size() - 1; i++) {
ofVec2f p = RYB_WHEEL[i];
ofVec2f q = RYB_WHEEL[i + 1];
if (q.y < p.y) {
q.y += 360;
}
if (p.x <= resultHue && resultHue <= q.x) {
h = p.y + (q.y - p.y) * (resultHue - p.x) / (q.x - p.x);
break;
}
}
hsb[0] = fmod(h, 360) / 360.0f;
ofColor newCol;
newCol.setHsb(hsb[0]*255, hsb[1]*255, hsb[2]*255);
return newCol;
}
示例3: computeColor
//--------------------------------------------------------------
void DevicePacket::computeColor(const ofColor& deviceColor, bool isColor, bool isInvert)
{
float volume = isInvert ? 1.0f-m_volume : m_volume;
if (isColor)
{
m_color.setHue(deviceColor.getHue());
m_color.setSaturation(deviceColor.getSaturation());
m_color.setBrightness(volume*255.0f);
}
else
{
m_color.set(volume*255.0f,volume*255.0f,volume*255.0f);
}
}
示例4: drawCube
void testApp::drawCube(float x_,float y_,float z_,ofColor top_, ofColor bottom_, ofColor front_, ofColor back_, ofColor left_, ofColor right_){
float x = x_/2;
float y = y_/2;
float z = z_/2;
glBegin(GL_QUADS);
pSetHSV(top_.getHue(),top_.getSaturation(),top_.getBrightness());
glColor3f(cols[0],cols[1],cols[2]);
glVertex3f( x, y,-z); // Top Right Of The Quad (Top)
glVertex3f(-x, y,-z); // Top Left Of The Quad (Top)
glVertex3f(-x, y, z); // Bottom Left Of The Quad (Top)
glVertex3f( x, y, z); // Bottom Right Of The Quad (Top)
pSetHSV(bottom_.getHue(),bottom_.getSaturation(),bottom_.getBrightness());
glColor3f(cols[0],cols[1],cols[2]);
glVertex3f( x,-y, z); // Top Right Of The Quad (Bottom)
glVertex3f(-x,-y, z); // Top Left Of The Quad (Bottom)
glVertex3f(-x,-y,-z); // Bottom Left Of The Quad (Bottom)
glVertex3f( x,-y,-z); // Bottom Right Of The Quad (Bottom)
pSetHSV(front_.getHue(),front_.getSaturation(),front_.getBrightness());
glColor3f(cols[0],cols[1],cols[2]);
glVertex3f( x, y, z); // Top Right Of The Quad (Front)
glVertex3f(-x, y, z); // Top Left Of The Quad (Front)
pSetHSV(60,100,100);
glColor3f(cols[0],cols[1],cols[2]);
glVertex3f(-x,-y, z); // Bottom Left Of The Quad (Front)
glVertex3f( x,-y, z); // Bottom Right Of The Quad (Front)
pSetHSV(back_.getHue(),back_.getSaturation(),back_.getBrightness());
glColor3f(cols[0],cols[1],cols[2]);
glVertex3f( x,-y,-z); // Bottom Left Of The Quad (Back)
glVertex3f(-x,-y,-z); // Bottom Right Of The Quad (Back)
glVertex3f(-x, y,-z); // Top Right Of The Quad (Back)
glVertex3f( x, y,-z); // Top Left Of The Quad (Back)
pSetHSV(left_.getHue(),left_.getSaturation(),left_.getBrightness());
glColor3f(cols[0],cols[1],cols[2]);
glVertex3f(-x, y, z); // Top Right Of The Quad (Left)
glVertex3f(-x, y,-z); // Top Left Of The Quad (Left)
glVertex3f(-x,-y,-z); // Bottom Left Of The Quad (Left)
glVertex3f(-x,-y, z); // Bottom Right Of The Quad (Left)
pSetHSV(right_.getHue(),right_.getSaturation(),right_.getBrightness());
glColor3f(cols[0],cols[1],cols[2]);
glVertex3f( x, y,-z); // Top Right Of The Quad (Right)
glVertex3f( x, y, z); // Top Left Of The Quad (Right)
glVertex3f( x,-y, z); // Bottom Left Of The Quad (Right)
glVertex3f( x,-y,-z); // Bottom Right Of The Quad (Right)
glEnd(); // Done Drawing The Quad
}
示例5: makeParticleForPipe
void EffectPipeOrganLines :: makeParticleForPipe(int pipeindex, ofColor col) {
if(pipeOrganData == NULL) return;
ParticleSystemManager& psm = *(ParticleSystemManager::instance());
ParticleSystem &ps = *psm.getParticleSystem();
ParticleSystemSettings pss;
pss.emitLifeTime = 0.1;
pss.emitMode = PARTICLE_EMIT_BURST;
pss.emitCount = 1;
pss.renderer = new ParticleRendererLaser();
pss.speedMin = 600 ;
pss.speedMax = 650;
pss.drag = 0.9;
//pss.gravity.set(0,500,0);
pss.sizeStartMin = pss.sizeStartMax = 1;
pss.sizeChangeRatio = 0.1;
//pss.emitShape = &explodeMesh;
pss.directionYVar = pss.directionZVar = 0;
pss.directionY = 0;
pss.directionX = -35;
pss.hueStartMin = pss.hueStartMax = col.getHue();
pss.hueChange = 0;
pss.saturationMin = pss.saturationMax = 255;
pss.saturationEnd = 255;
pss.brightnessStartMin = pss.brightnessStartMax =pss.brightnessEnd = 255;
pss.lifeMin = pss.lifeMax = 0.5;
pss.shimmerMin = 0;
pss.timeSpeed = 0.7;
//pss.doNotScale = true;
ps.pos = pipeOrganData->pipes[pipeindex].top;
ps.init(pss);
}
示例6: sortHue
//--------------------------------------------------------------
// sort by hue function
bool sortHue( ofColor a, ofColor b){
return( a.getHue() < b.getHue() );
}
示例7: compareHue
bool compareHue( const ofColor& s1, const ofColor& s2 ) {
return s1.getHue() < s2.getHue();
}