本文整理汇总了C++中QColor::greenF方法的典型用法代码示例。如果您正苦于以下问题:C++ QColor::greenF方法的具体用法?C++ QColor::greenF怎么用?C++ QColor::greenF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QColor
的用法示例。
在下文中一共展示了QColor::greenF方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDiffuse
void setDiffuse(const QColor &diffuse)
{
GLfloat diffuseMaterial[] = { static_cast<GLfloat>(diffuse.redF()),
static_cast<GLfloat>(diffuse.greenF()),
static_cast<GLfloat>(diffuse.blueF()),
1.0f};
setMaterial(NO_MATERIAL,
diffuseMaterial,
NO_MATERIAL,
SHININESS_ZERO,
NO_MATERIAL);
}
示例2: attrib_buffers
// set-up the uniform attributes of the shader programs.
void Scene_item::attrib_buffers(CGAL::Three::Viewer_interface* viewer,
int program_name) const
{
viewer->attrib_buffers(program_name);
QColor c = this->color();
if(program_name == Scene_item::PROGRAM_WITH_TEXTURE)
{
if(is_selected) c = c.lighter(120);
viewer->getShaderProgram(program_name)->setAttributeValue
("color_facets",
c.redF(),
c.greenF(),
c.blueF());
}
else if(program_name == PROGRAM_WITH_TEXTURED_EDGES)
{
if(is_selected) c = c.lighter(50);
viewer->getShaderProgram(program_name)->setUniformValue
("color_lines",
QVector3D(c.redF(), c.greenF(), c.blueF()));
}
}
示例3: setColor
void OSGTextNode::setColor(const QColor &color)
{
osg::Vec4 osgColor(
color.redF(),
color.greenF(),
color.blueF(),
color.alphaF());
if (h->text->getColor() != osgColor) {
h->text->setColor(osgColor);
emit colorChanged(color);
}
}
示例4: setColour
void GLWindow::setColour()
{
QColor colour = QColorDialog::getColor();
if( colour.isValid())
{
ngl::ShaderLib *shader=ngl::ShaderLib::instance();
(*shader)["Phong"]->use();
m_colour.m_r=colour.redF();
m_colour.m_g=colour.greenF();
m_colour.m_b=colour.blueF();
updateGL();
}
}
示例5: setControlPointValue
//-----------------------------------------------------------------------------
void ctkVTKColorTransferFunction::setControlPointValue(int index, const QVariant& value)
{
Q_D(ctkVTKColorTransferFunction);
Q_ASSERT(value.value<QColor>().isValid());
QColor rgb = value.value<QColor>();
double values[6];
d->ColorTransferFunction->GetNodeValue(index, values);
values[1] = rgb.redF();
values[2] = rgb.greenF();
values[3] = rgb.blueF();
// setNodeValue should eventually fired the signal changed()
d->ColorTransferFunction->SetNodeValue(index, values);
}
示例6: createCurvatureVertColor
QByteArray BrainSurfaceTreeItem::createCurvatureVertColor(const VectorXf& curvature, const QColor& colSulci, const QColor& colGyri)
{
QByteArray arrayCurvatureColor;
arrayCurvatureColor.resize(curvature.rows() * 3 * (int)sizeof(float));
float *rawColorArray = reinterpret_cast<float *>(arrayCurvatureColor.data());
int idxColor = 0;
for(int i = 0; i<curvature.rows(); i++) {
//Color (this is the default color and will be used until the updateVertColor function was called)
if(curvature[i] >= 0) {
rawColorArray[idxColor++] = colSulci.redF();
rawColorArray[idxColor++] = colSulci.greenF();
rawColorArray[idxColor++] = colSulci.blueF();
} else {
rawColorArray[idxColor++] = colGyri.redF();
rawColorArray[idxColor++] = colGyri.greenF();
rawColorArray[idxColor++] = colGyri.blueF();
}
}
return arrayCurvatureColor;
}
示例7: onColorChanged
// --------------------------------------------------------------------------
void ctkVTKSurfaceMaterialPropertyWidget::onColorChanged(const QColor& newColor)
{
Q_D(ctkVTKSurfaceMaterialPropertyWidget);
this->Superclass::onColorChanged(newColor);
if (d->Property.GetPointer() != 0)
{
// the value might have changed since we fired the signal, use the current
// up-to-date value then.
const QColor c = this->color();
// Need to work around a VTK bug of SetColor() that fires event
// in an unstable state:
// d->Property->SetColor(c.redF(), c.greenF(), c.blueF());
d->SettingColor = true;
d->Property->SetAmbientColor(c.redF(), c.greenF(), c.blueF());
d->Property->SetDiffuseColor(c.redF(), c.greenF(), c.blueF());
d->Property->SetSpecularColor(c.redF(), c.greenF(), c.blueF());
d->SettingColor = false;
// update just in case something connected to the modified event of the
// vtkProperty modified any attribute
this->updateFromProperty();
}
}
示例8: drawVertex
void Viewer::drawVertex(const Point_3& p, const QColor& clr, float r)
{
/* Draw regular points */
if( m_isFlat ) {
// disable lighting
::glDisable( GL_LIGHTING );
::glPointSize(8.0);
qglColor( clr );
::glBegin(GL_POINTS);
::glVertex3f( p.x(), p.y(), p.z() );
::glEnd();
// resume lighting
::glEnable( GL_LIGHTING );
return;
}
/* Draw vertices as 3D balls */
GLboolean lighting, colorMaterial;
::glGetBooleanv( GL_LIGHTING, &lighting );
::glGetBooleanv( GL_COLOR_MATERIAL, &colorMaterial );
::glEnable( GL_LIGHTING );
::glDisable(GL_COLOR_MATERIAL);
float color[4];
color[0] = clr.redF();
color[1] = clr.greenF();
color[2] = clr.blueF();
color[3] = clr.alphaF();
// move to the point
::glPushMatrix();
::glTranslatef( p.x(), p.y(), p.z() );
// draw
GLUquadricObj* quadratic = ::gluNewQuadric(); // Create A Pointer To The Quadric Object
::gluQuadricNormals( quadratic, GLU_SMOOTH ); // Create Smooth Normals
::glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color );
::gluSphere( quadratic, r, 16, 16 );
// move back to origin
::glPopMatrix();
if ( colorMaterial )
::glEnable( GL_COLOR_MATERIAL );
if ( !lighting )
::glDisable( GL_LIGHTING );
}
示例9: insertControlPoint
//-----------------------------------------------------------------------------
int ctkVTKColorTransferFunction::insertControlPoint(const ctkControlPoint& cp)
{
Q_D(ctkVTKColorTransferFunction);
int index = -1;
if (d->ColorTransferFunction.GetPointer() == 0)
{
return index;
}
QColor rgb = cp.value().value<QColor>();
const ctkNonLinearControlPoint* nonLinearCp = dynamic_cast<const ctkNonLinearControlPoint*>(&cp);
if (nonLinearCp)
{
// TODO retrieve midpoint & sharpness
index = d->ColorTransferFunction->AddRGBPoint(
cp.x(), rgb.redF(), rgb.greenF(), rgb.blueF());
}
else
{
index = d->ColorTransferFunction->AddRGBPoint(
cp.x(), rgb.redF(), rgb.greenF(), rgb.blueF());
}
return index;
}
示例10: getIdFromPos
bool Dataset3D::mousePick( int pickId, QVector3D pos, Qt::KeyboardModifiers modifiers, QString target )
{
int paintMode = m_properties["maingl"].get( Fn::Property::D_PAINTMODE ).toInt();
if ( pickId == 0 || paintMode == 0 || !( modifiers & Qt::ControlModifier ) )
{
return false;
}
QColor paintColorC = m_properties["maingl"].get( Fn::Property::D_PAINTCOLOR ).value<QColor>();
QVector3D paintValue;
int type = m_properties["maingl"].get( Fn::Property::D_DATATYPE ).toInt();
if ( type == DT_UNSIGNED_CHAR )
{
paintValue = QVector3D( paintColorC.red(), paintColorC.green(), paintColorC.blue() );
}
else
{
paintValue = QVector3D( paintColorC.redF(), paintColorC.greenF(), paintColorC.blueF() );
}
float dx = m_properties["maingl"].get( Fn::Property::D_DX ).toFloat();
float dy = m_properties["maingl"].get( Fn::Property::D_DY ).toFloat();
float dz = m_properties["maingl"].get( Fn::Property::D_DZ ).toFloat();
m_data[ getIdFromPos( pos.x(), pos.y(), pos.z() ) ] = paintValue;
int brushSize = m_properties["maingl"].get( Fn::Property::D_PAINTSIZE ).toInt();
for ( int i = 0; i < brushSize; ++i )
{
for ( int j = 0; j < brushSize; ++j )
{
for ( int k = 0; k < brushSize; ++k )
{
m_data[ getIdFromPos( pos.x() - i * dx, pos.y() - j * dy, pos.z() - k * dz ) ] = paintValue;
m_data[ getIdFromPos( pos.x() - i * dx, pos.y() - j * dy, pos.z() + k * dz ) ] = paintValue;
m_data[ getIdFromPos( pos.x() - i * dx, pos.y() + j * dy, pos.z() - k * dz ) ] = paintValue;
m_data[ getIdFromPos( pos.x() - i * dx, pos.y() + j * dy, pos.z() + k * dz ) ] = paintValue;
m_data[ getIdFromPos( pos.x() + i * dx, pos.y() - j * dy, pos.z() - k * dz ) ] = paintValue;
m_data[ getIdFromPos( pos.x() + i * dx, pos.y() - j * dy, pos.z() + k * dz ) ] = paintValue;
m_data[ getIdFromPos( pos.x() + i * dx, pos.y() + j * dy, pos.z() - k * dz ) ] = paintValue;
m_data[ getIdFromPos( pos.x() + i * dx, pos.y() + j * dy, pos.z() + k * dz ) ] = paintValue;
}
}
}
glDeleteTextures( 1, &m_textureGLuint );
m_textureGLuint = 0;
return true;
}
示例11: paintGL
void BasicOpenGLView::paintGL()
{
// given our timer, this should be 20
int elapsed = mAnimationTimer.elapsed();
float secondsElapsed = elapsed * 0.001f;
// JB: removed light position/colour change
mLightPos.x = sin(secondsElapsed) * 20.0f;
mLightPos.z = cos(secondsElapsed) * 20.0f;
mLightPos.y = cos(secondsElapsed * 0.5f) * 20.0f;
QColor curColor;
curColor.setHsvF(fabs(cos(secondsElapsed / 20.0f)), 1.0, 1.0);
mLightCol.x = curColor.redF();
mLightCol.y = curColor.greenF();
mLightCol.z = curColor.blueF();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if(mRenderOrtho)
{
float mAspectRatio = ((float)this->width()) / this->height();
mProjectionMatrix.ortho(-mDistance,
mDistance,
mDistance * mAspectRatio,
-mDistance * mAspectRatio,
-0.1,
-500.0);
}
std::map<std::string, Geometry *>::iterator it = mGeometries.begin();
while (it != mGeometries.end())
{
it->second->createModelMatrix(mUsePostMultiply);
it->second->draw(mProjectionMatrix,
mViewMatrix,
mUsePostMultiply,
mLightPos,
mLightCol,
mTextureHandle,
mBumpTextureHandle,
mAlphaTextureHandle,
mProgram);
++it;
}
}
示例12:
void GLC_WorldTo3dxml::writeLineAttributes(const QColor& color)
{
m_pOutStream->writeStartElement("LineAttributes");
m_pOutStream->writeAttribute("lineType", "SOLID");
m_pOutStream->writeAttribute("thickness", "1");
m_pOutStream->writeStartElement("Color");
m_pOutStream->writeAttribute("xsi:type", "RGBAColorType");
m_pOutStream->writeAttribute("red", QString::number(color.redF()));
m_pOutStream->writeAttribute("green", QString::number(color.greenF()));
m_pOutStream->writeAttribute("blue", QString::number(color.blueF()));
m_pOutStream->writeAttribute("alpha", QString::number(color.alphaF()));
m_pOutStream->writeEndElement(); // Color
m_pOutStream->writeEndElement(); // LineAttributes
}
示例13: paintEvent
void Checkbox::paintEvent(QPaintEvent *e) {
Painter p(this);
float64 over = a_over.current(), checked = a_checked.current();
bool cnone = (over == 0. && checked == 0.), cover = (over == 1. && checked == 0.), cchecked = (checked == 1.);
bool cbad = !cnone && !cover && !cchecked;
QColor color;
if (cbad) {
float64 onone = (1. - over) * (1. - checked), oover = over * (1. - checked), ochecked = checked;
color.setRedF(_st.checkFg->c.redF() * onone + _st.checkFgOver->c.redF() * oover + _st.checkFgActive->c.redF() * ochecked);
color.setGreenF(_st.checkFg->c.greenF() * onone + _st.checkFgOver->c.greenF() * oover + _st.checkFgActive->c.greenF() * ochecked);
color.setBlueF(_st.checkFg->c.blueF() * onone + _st.checkFgOver->c.blueF() * oover + _st.checkFgActive->c.blueF() * ochecked);
}
QRect r(e->rect());
p.setClipRect(r);
p.fillRect(r, _st.textBg->b);
if (_checkRect.intersects(r)) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
QPen pen;
if (cbad) {
pen = QPen(color);
} else {
pen = (cnone ? _st.checkFg : (cover ? _st.checkFgOver : _st.checkFgActive))->p;
color = (cnone ? _st.checkFg : (cover ? _st.checkFgOver : _st.checkFgActive))->c;
}
pen.setWidth(_st.thickness);
p.setPen(pen);
if (checked > 0) {
color.setRedF(color.redF() * checked + st::white->c.redF() * (1. - checked));
color.setGreenF(color.greenF() * checked + st::white->c.greenF() * (1. - checked));
color.setBlueF(color.blueF() * checked + st::white->c.blueF() * (1. - checked));
p.setBrush(color);
} else {
p.setBrush(st::white);
}
p.drawRoundedRect(QRectF(_checkRect).marginsRemoved(QMarginsF(_st.thickness / 2, _st.thickness / 2, _st.thickness / 2, _st.thickness / 2)), st::msgRadius, st::msgRadius);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
if (checked > 0) {
p.drawSpriteCenter(_checkRect, _st.checkIcon);
}
}
if (_checkRect.contains(r)) return;
p.setPen(_st.textFg);
p.setFont(_st.font);
p.drawTextLeft(_st.textPosition.x(), _st.textPosition.y(), width(), _text, _textWidth);
}
示例14: changedAttachedBodyColor
void RobotStateDisplay::changedAttachedBodyColor()
{
if (robot_)
{
QColor color = attached_body_color_property_->getColor();
std_msgs::ColorRGBA color_msg;
color_msg.r = color.redF();
color_msg.g = color.greenF();
color_msg.b = color.blueF();
color_msg.a = robot_alpha_property_->getFloat();
robot_->setDefaultAttachedObjectColor(color_msg);
update_state_ = true;
}
}
示例15: SbColor
bool
ColorList::findColor(const char *color)
{
QColor col;
col.setAllowX11ColorNames(true);
col.setNamedColor(color);
if (!col.isValid())
return false;
_colors.last()->_list.append(
new SbColor(col.redF(), col.greenF(), col.blueF()));
return true;
}