コード例 #1
0
ファイル: juce_AudioThumbnail.cpp プロジェクト: Krewn/LIOS
void AudioThumbnail::drawChannels (Graphics& g, const Rectangle<int>& area, double startTimeSeconds,
                                   double endTimeSeconds, float verticalZoomFactor)
{
    for (int i = 0; i < numChannels; ++i)
    {
        const int y1 = roundToInt ((i * area.getHeight()) / numChannels);
        const int y2 = roundToInt (((i + 1) * area.getHeight()) / numChannels);

        drawChannel (g, Rectangle<int> (area.getX(), area.getY() + y1, area.getWidth(), y2 - y1),
                     startTimeSeconds, endTimeSeconds, i, verticalZoomFactor);
    }
}
コード例 #2
0
void SummaryDrawWidget::paintEvent( QPaintEvent * )
{
  Channel *ch;

  //if((right - left) <= 0) return;
  View *view = gdata->view;
/*  if (view->totalTime() == 0) {
    buffer = new QPixmap(size());
    buffer->fill(myBackgroundColor);
    bitBlt(this, 0, 0, buffer); */
  if(gdata->totalTime() < 0) return;

  double timeRatio = double(width()) / gdata->totalTime();
  double pitchRatio = double(height()) / (gdata->topPitch() / scaler);

  beginDrawing();

  //draw all the channels
  for(int j = 0; j < (int)gdata->channels.size(); j++) {
    ch = gdata->channels.at(j);
    if(!ch->isVisible()) continue;

    //drawChannel(ch, p, view->leftTime(), (view->totalTime() / (double) width()), 0.0f, (double) view->topNote() / (double) height(), DRAW_VIEW_SUMMARY);
    drawChannel(*this, ch, p, gdata->leftTime(), view->currentTime(), (gdata->totalTime() / (double) width()), 0.0f, (double) gdata->topPitch() / (double) height(), DRAW_VIEW_SUMMARY);
  }

  //draw the view rectangle 
  p.setPen(QPen(colorGroup().highlight(), 1));
  p.drawRect(int((gdata->leftTime()+view->viewLeft())*timeRatio), height()-1-int((view->viewTop())*pitchRatio),
             int(view->viewWidth()*timeRatio), int(view->viewHeight()*pitchRatio));

  //draw the current time line
  p.setPen(QPen(colorGroup().foreground(), 1));
  //p.moveTo(int((gdata->leftTime()+view->currentTime())*timeRatio), 0);
  //p.lineTo(int((gdata->leftTime()+view->currentTime())*timeRatio), height()-1);
  p.drawLine(int((gdata->leftTime()+view->currentTime())*timeRatio), 0, 
             int((gdata->leftTime()+view->currentTime())*timeRatio), height()-1);

  endDrawing();
}