示例#1
0
void Screen::saveBmp(char * outputFilename) const {
  clock_t startTimer, endTimer;

  printf("Saving file to \"%s\"...", outputFilename);
  fflush(stdout);
  startTimer = clock();
  int pixelCount = height * width;
  C_FLT * redChannel = new C_FLT[pixelCount],
        * greenChannel = new C_FLT[pixelCount],
        * blueChannel = new C_FLT[pixelCount];

  for (int i = 0, j = pixelCount - 1; i < pixelCount; i++, j--) {
    redChannel[i] = pixels[j].r;
    greenChannel[i] = pixels[j].g;
    blueChannel[i] = pixels[j].b;
  }

  bitmap_image bmpImage(width, height);
  bmpImage.import_rgb(redChannel, greenChannel, blueChannel);


  bmpImage.save_image(outputFilename);

  delete [] redChannel;
  delete [] greenChannel;
  delete [] blueChannel;
  endTimer = clock();
  printf("completed (%.3f seconds).\n", clockTime(startTimer, endTimer));
}
示例#2
0
void tst_storage::tst_origintimes()
{
  SqliteStorage *ss = dynamic_cast<SqliteStorage*>(m_storage.data());
  QVERIFY(ss);

  KDateTime utcTime(QDate(2014, 1, 15), QTime(), KDateTime::UTC);
  KDateTime clockTime(QDate(2014, 1, 15), QTime(), KDateTime::ClockTime);
  KDateTime localTime(QDate(2014, 1, 15), QTime(), KDateTime::LocalZone);

  // local origin time is the same as specific time set to utc
  // note: currently origin time of clock time is saved as time in current time zone.
  // that does not necessarily make sense, but better be careful when changing behavior there.
  QCOMPARE(ss->toOriginTime(utcTime), ss->toLocalOriginTime(utcTime));
  QCOMPARE(ss->toLocalOriginTime(clockTime), ss->toLocalOriginTime(utcTime));
  QCOMPARE(ss->toLocalOriginTime(localTime), ss->toLocalOriginTime(utcTime));
}
示例#3
0
void Screen::savePng(char * outputFilename) const {
  clock_t startTimer, endTimer;

  printf("Saving file to \"%s\"...", outputFilename);
  fflush(stdout);
  startTimer = clock();

  int pixelCount = height * width;
  std::vector<unsigned char> png;
  for (int i = pixelCount - 1; i >=0; i--) {
    RGBColor rgbColor(pixels[i]);
    png.push_back(rgbColor.r);
    png.push_back(rgbColor.g);
    png.push_back(rgbColor.b);
    png.push_back(255);
  }
  lodepng::encode(outputFilename, png, width, height);

  endTimer = clock();
  printf("completed (%.3f seconds).\n", clockTime(startTimer, endTimer));
}
示例#4
0
QTime Clock::time() const
{
    return clockTime().toTime();
}