当前位置: 首页>>代码示例>>C++>>正文


C++ curColor函数代码示例

本文整理汇总了C++中curColor函数的典型用法代码示例。如果您正苦于以下问题:C++ curColor函数的具体用法?C++ curColor怎么用?C++ curColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了curColor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: spatium

void ChordLine::draw(QPainter* painter) const
      {
      qreal _spatium = spatium();

      if (this->isStraight()) {
            painter->scale(_spatium, _spatium);
            painter->setPen(QPen(curColor(), .15, Qt::SolidLine));
            painter->setBrush(Qt::NoBrush);

            QPainterPath pathOffset = path;
            float offset = 0.5;

            if (_chordLineType == ChordLineType::FALL)
                  pathOffset.translate(offset, -offset);
            else if (_chordLineType == ChordLineType::DOIT)
                  pathOffset.translate(offset, offset);
            else if (_chordLineType == ChordLineType::SCOOP)
                  pathOffset.translate(-offset, offset);
            else if (_chordLineType == ChordLineType::PLOP)
                  pathOffset.translate(-offset, -offset);

            painter->drawPath(pathOffset);
            painter->scale(1.0/_spatium, 1.0/_spatium);
            }
      else  {
            painter->scale(_spatium, _spatium);
            painter->setPen(QPen(curColor(), .15, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
            painter->setBrush(Qt::NoBrush);
            painter->drawPath(path);
            painter->scale(1.0/_spatium, 1.0/_spatium);
            }
      }
开发者ID:Tarkiyah,项目名称:MuseScore,代码行数:32,代码来源:chordline.cpp

示例2: pen

void SlurSegment::draw(QPainter* painter) const
      {
      QPen pen(curColor());
      if (slurTie()->lineType() == 0) {
            painter->setBrush(QBrush(QColor(curColor())));
            pen.setCapStyle(Qt::RoundCap);
            pen.setJoinStyle(Qt::RoundJoin);
            qreal lw = point(score()->styleS(ST_SlurEndWidth));
            pen.setWidthF(lw);
            }
      else if (slurTie()->lineType() == 1) {
            painter->setBrush(Qt::NoBrush);
            qreal lw = point(score()->styleS(ST_SlurDottedWidth));
            pen.setWidthF(lw);
            pen.setStyle(Qt::DotLine);
            }
      else if (slurTie()->lineType() == 2) {
            painter->setBrush(Qt::NoBrush);
            qreal lw = point(score()->styleS(ST_SlurDottedWidth));
            pen.setWidthF(lw);
            pen.setStyle(Qt::DashLine);
            }
      painter->setPen(pen);
      painter->drawPath(path);
      }
开发者ID:kuribas,项目名称:MuseScore,代码行数:25,代码来源:slur.cpp

示例3: spatium

void Ambitus::draw(QPainter* p) const
      {
      qreal _spatium = spatium();
      qreal lw = lineWidth().val() * _spatium;
      p->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::RoundCap));
      drawSymbol(noteHead(), p, _topPos);
      drawSymbol(noteHead(), p, _bottomPos);
      if (_hasLine)
            p->drawLine(_line);

      // draw ledger lines (if not in a palette)
      if (segment() && track() > -1) {
            int tick          = segment()->tick();
            Staff* stf        = score()->staff(staffIdx());
            qreal lineDist    = stf->lineDistance(tick);
            int numOfLines    = stf->lines(tick);
            qreal step        = lineDist * _spatium;
            qreal stepTolerance = step * 0.1;
            qreal ledgerOffset = score()->styleS(Sid::ledgerLineLength).val() * 0.5 * _spatium;
            p->setPen(QPen(curColor(), score()->styleS(Sid::ledgerLineWidth).val() * _spatium,
                        Qt::SolidLine, Qt::RoundCap) );
            if (_topPos.y()-stepTolerance <= -step) {
                  qreal xMin = _topPos.x() - ledgerOffset;
                  qreal xMax = _topPos.x() + headWidth() + ledgerOffset;
                  for (qreal y = -step; y >= _topPos.y()-stepTolerance; y -= step)
                        p->drawLine(QPointF(xMin, y), QPointF(xMax, y));
                  }
            if (_bottomPos.y()+stepTolerance >= numOfLines * step) {
                  qreal xMin = _bottomPos.x() - ledgerOffset;
                  qreal xMax = _bottomPos.x() + headWidth() + ledgerOffset;
                  for (qreal y = numOfLines*step; y <= _bottomPos.y()+stepTolerance; y += step)
                        p->drawLine(QPointF(xMin, y), QPointF(xMax, y));
                  }
            }
      }
开发者ID:IsaacWeiss,项目名称:MuseScore,代码行数:35,代码来源:ambitus.cpp

示例4: staff

void Stem::draw(QPainter* painter) const
      {
      Staff* st = staff();
      bool useTab = st && st->isTabStaff();

      if (useTab && st->staffType()->slashStyle())
            return;
      qreal lw = lineWidth();
      painter->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::RoundCap));
      painter->drawLine(line);
      if (!useTab)
            return;

      // TODO: adjust bounding rectangle in layout() for dots and for slash
      StaffTypeTablature* stt = static_cast<StaffTypeTablature*>(st->staffType());
      qreal sp = spatium();

      // slashed half note stem
      if (chord() && chord()->durationType().type() == TDuration::V_HALF
         && stt->minimStyle() == TAB_MINIM_SLASHED) {
            qreal wdt   = sp * STAFFTYPE_TAB_SLASH_WIDTH;
            qreal sln   = sp * STAFFTYPE_TAB_SLASH_SLANTY;
            qreal thk   = sp * STAFFTYPE_TAB_SLASH_THICK;
            qreal displ = sp * STAFFTYPE_TAB_SLASH_DISPL;
            QPainterPath path;

            qreal y = stt->stemsDown() ?
                         _len - STAFFTYPE_TAB_SLASH_2STARTY_DN*sp :
                        -_len + STAFFTYPE_TAB_SLASH_2STARTY_UP*sp;
            for (int i = 0; i < 2; ++i) {
                  path.moveTo( wdt*0.5-lw, y);        // top-right corner
                  path.lineTo( wdt*0.5-lw, y+thk);    // bottom-right corner
                  path.lineTo(-wdt*0.5,    y+thk+sln);// bottom-left corner
                  path.lineTo(-wdt*0.5,    y+sln);    // top-left corner
                  path.closeSubpath();
                  y += displ;
                  }
//            setbbox(path.boundingRect());
            painter->setBrush(QBrush(curColor()));
            painter->setPen(Qt::NoPen);
            painter->drawPath(path);
            }

      // dots
      // NOT THE BEST PLACE FOR THIS?
      // with tablatures, dots are not drawn near 'notes', but near stems
      int nDots = chord()->dots();
      if (nDots > 0) {
            qreal y = stemLen() - (stt->stemsDown() ?
                        (STAFFTYPE_TAB_DEFAULTSTEMLEN_DN - 0.75) * sp : 0.0 );
            symbols[score()->symIdx()][dotSym].draw(painter, magS(),
                        QPointF(STAFFTYPE_TAB_DEFAULTDOTDIST_X * sp, y), nDots);
            }
      }
开发者ID:santh,项目名称:MuseScore,代码行数:54,代码来源:stem.cpp

示例5: bbox

void Tremolo::draw(QPainter* painter) const
      {
      painter->setBrush(QBrush(curColor()));
      painter->setPen(Qt::NoPen);
      painter->drawPath(path);
      if ((parent() == 0) && !twoNotes()) {
            qreal x = 0.0; // bbox().width() * .25;
            QPen pen(curColor(), point(score()->styleS(ST_stemWidth)));
            painter->setPen(pen);
            qreal _spatium = spatium();
            painter->drawLine(QLineF(x, -_spatium*.5, x, path.boundingRect().height() + _spatium));
            }
      }
开发者ID:derAbgang,项目名称:MuseScore,代码行数:13,代码来源:tremolo.cpp

示例6: draw

void Symbol::draw(QPainter* p) const
      {
      if (type() != NOTEDOT || !staff()->isTabStaff()) {
            p->setPen(curColor());
            symbols[score()->symIdx()][_sym].draw(p, magS());
            }
      }
开发者ID:Isenbarth,项目名称:MuseScore,代码行数:7,代码来源:symbol.cpp

示例7: staff

void Stem::draw(QPainter* painter) const
      {
      bool useTab = false;
      Staff* st = staff();
      if (st && st->isTabStaff()) {     // stems used in palette do not have a staff
            if (st->staffType()->slashStyle())
                  return;
            useTab = true;
            }
      qreal lw = point(score()->styleS(ST_stemWidth));
      painter->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::RoundCap));
      painter->drawLine(line);

      // NOT THE BEST PLACE FOR THIS?
      // with tablatures, dots are not drawn near 'notes', but near stems
      // TODO: adjust bounding rectangle in layout()
      if (useTab) {
            int nDots = chord()->dots();
            if (nDots > 0) {
                  qreal sp = spatium();
                  qreal y = stemLen() - ( ((StaffTypeTablature*)st->staffType())->stemsDown() ?
                              (STAFFTYPE_TAB_DEFAULTSTEMLEN_DN - 0.75) * sp : 0.0 );
                  symbols[score()->symIdx()][dotSym].draw(painter, magS(),
                              QPointF(STAFFTYPE_TAB_DEFAULTDOTDIST_X * sp, y), nDots);
                  }
            }
      }
开发者ID:kuribas,项目名称:MuseScore,代码行数:27,代码来源:stem.cpp

示例8: pen

void TremoloBar::draw(QPainter* painter) const
      {
      if (staff() && !staff()->isTabStaff())
            return;
      QPen pen(curColor(), _lw, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
      painter->setPen(pen);
      painter->setBrush(QBrush(Qt::black));

      qreal _spatium = spatium();
      const TextStyle* st = &score()->textStyle(TEXT_STYLE_BENCH);
      QFont f = st->fontPx(_spatium);
      painter->setFont(f);

      int n    = _points.size();
//      int pt   = 0;
//      qreal x = noteWidth;
//      qreal y = -_spatium * .8;
//      qreal x2, y2;

      for (int pt = 0; pt < n; ++pt) {
            if (pt == (n-1))
                  break;
//            int pitch = _points[pt].pitch;
            }
      //debug:
      painter->drawLine(QLineF(0.0, 0.0, _spatium*1.5, _spatium*3));
      painter->drawLine(QLineF(_spatium*1.5, _spatium*3, _spatium*3, 0.0));
      }
开发者ID:Annovae,项目名称:MuseScore,代码行数:28,代码来源:tremolobar.cpp

示例9: pen

void TremoloBar::draw(QPainter* painter) const
      {
      if (staff() && !staff()->isTabStaff())
            return;
      QPen pen(curColor(), _lw, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
      painter->setPen(pen);
      painter->setBrush(QBrush(Qt::black));

      qreal _spatium = spatium();
      const TextStyle* st = &score()->textStyle(TextStyleType::BENCH);
      QFont f = st->fontPx(_spatium);
      painter->setFont(f);

      int n    = _points.size();

      int previousTime = _points[0].time;
      int previousPitch = _points[0].pitch;
      /* we place the tremolo bars starting slightly before the
       *  notehead, and end it slightly after, drawing above the
       *  note. The values specified in Guitar Pro are very large, too
       *  large for the scale used in Musescore. We used the
       *  timeFactor and pitchFactor below to reduce these values down
       *  consistently to values that make sense to draw with the
       *  Musescore scale. */
      int timeFactor = 10;
      int pitchFactor = 25;
      for (int pt = 1; pt < n; ++pt) {
            painter->drawLine(QLineF(previousTime/timeFactor, -previousPitch/pitchFactor-_spatium*3,
                                     _points[pt].time/timeFactor, -_points[pt].pitch/pitchFactor-_spatium*3));
            previousTime = _points[pt].time;
            previousPitch = _points[pt].pitch;
            }
      }
开发者ID:ArminBra,项目名称:MuseScore,代码行数:33,代码来源:tremolobar.cpp

示例10: draw

void Clef::draw(QPainter* painter) const
      {
      if (symId == SymId::noSym || (staff() && !staff()->staffType()->genClef()))
            return;
      painter->setPen(curColor());
      drawSymbol(symId, painter);
      }
开发者ID:ajyoon,项目名称:MuseScore,代码行数:7,代码来源:clef.cpp

示例11: draw

void NoteDot::draw(QPainter* p) const
      {
      if (!staff()->useTablature()) {
            p->setPen(curColor());
            symbols[score()->symIdx()][dotSym].draw(p, magS());
            }
      }
开发者ID:Archer90,项目名称:MuseScore,代码行数:7,代码来源:notedot.cpp

示例12: draw

void Accidental::draw(QPainter* painter) const
      {
      if (staff() && staff()->isTabStaff())        //in TAB, accidentals are not shown
            return;
      painter->setPen(curColor());
      foreach(const SymElement& e, el)
            score()->scoreFont()->draw(e.sym, painter, magS(), QPointF(e.x, 0.0));
      }
开发者ID:dc7kr,项目名称:MuseScore,代码行数:8,代码来源:accidental.cpp

示例13: init

// createTrans0
//---------------------------------------------------------------------------
void ColorTable::createTrans0(
    const int  &color1Percent,
    const int  &color2Percent,
    const char *filename)
{
    init(256 * 256);

    if(FileSystem::exists(filename)) {
        try {
            loadTable(filename);
            return;
        } catch(Exception e) {
            LOG( ("Error while loading palette'%s': %s", filename, e.what()) );
        }
    }

    LOG ( ("Creating colortable '%s'.", filename) );
    float color1        = float(color1Percent) / 100.0f;
    float color2        = float(color2Percent) / 100.0f;
    //int	  totalColors   = colorCount;
    //int   curColorIndex = 0;
    //int   num           = 0;
    //int   numInterval   = (totalColors) / 100;

    // Since the file was not found, create the color tables and dump
    // it to a file.
    unsigned curOffset = 0;

    for (unsigned index = 0; index < 256; index++) {
        const RGBColor col = Palette::color[index];

        for (unsigned indexPic = 0; indexPic < 256; indexPic++) {
            const RGBColor colPic = Palette::color[indexPic];

            curOffset = (int(index) << 8) + indexPic;

            RGBColor curColor((int) (color1 * col.red   + color2 * colPic.red),
                              (int) (color1 * col.green + color2 * colPic.green),
                              (int) (color1 * col.blue  + color2 * colPic.blue));

            // Makes the color table use color 0 as transparent.

            if (indexPic == 0) {
                setColor(curOffset, index);
            } else {

                setColor(curOffset, Palette::findNearestColor(curColor));
            }
        }
    }

    try {
        saveTable(filename);
    } catch(Exception e) {
        LOG ( ("Caching of ColorTable '%s' failed: %s",
               filename, e.what()) );
    }
} // end ColorTable::createTrans0
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:60,代码来源:ColorTable.cpp

示例14: Vector3D

//Alters p to be a particle newly produced by the fountain.
void ParticleEngine::createParticle(Particle* p) {
    p->pos = Vector3D(0, 0, 0);
    p->velocity = curVelocity() + Vector3D(0.5f * randomFloat() - 0.25f,
                                           0.5f * randomFloat() - 0.25f,
                                           0.5f * randomFloat() - 0.25f);
    p->color = curColor();
    p->timeAlive = 0;
    p->lifespan = randomFloat() + 1;
}
开发者ID:korkesh,项目名称:2D-Platformer,代码行数:10,代码来源:particle.cpp

示例15: draw

void NoteDot::draw(QPainter* p) const
      {
      if (note() && note()->dotsHidden())     // don't draw dot if note is hidden
            return;
      if (!staff()->isTabStaff() || ((StaffTypeTablature*)staff()->staffType())->stemThrough()) {
            p->setPen(curColor());
            drawSymbol(SymId::augmentationDot, p);
            }
      }
开发者ID:33akash,项目名称:MuseScore,代码行数:9,代码来源:notedot.cpp


注:本文中的curColor函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。